Calling Java class's method from javascript in a freemarker template -


i have freemarker template javascript in it, , i'm using spring mvc pass in java object "emailer".

somehow, in freemarker template, want call emailer object's "sendemail(params, ..)" method javascript within freemarker template. know how call java methods freemarker (the regular way - example: how call java methods on object freemarker template?) , don't know how within javascript.

is possible? if so, how? , if it's not, alternatives?

the overall goal value dropdown list (using javascript), , using value in java method gets called when button pressed.

thanks in advance! if more info needed, i'd happy provide it.

it's not possible combination of how these technologies work together, in usual flow of things, you're looking forward wouldn't possible:

  • a java call (mediated spring) renders freemarker, allowing calls java code processes.
  • this rendered string (which might happen contain javascript) shipped on http client browser. @ point java execution has completed.
  • in browser, generated text parsed, , javascript run. here there no direct knowledge of server, , there no way call completed thread of control.

so unless you're doing more unusual, no can't you're suggesting.

there tools allow client-side javascript call server , interact java there.; can rig up. not call java directly without more work.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -