[jboss-user] [JBoss Seam] - Re: Pass JavaScript method outcome to server?

stu2 do-not-reply at jboss.com
Fri May 11 09:16:14 EDT 2007


"eirirlar" wrote : Hi,
  | 
  | I'm working with the richfaces gmap component. I need to send some data to the server that is the outcome of some JavaScript method call, along with calling an action method.
  | 
  | I would like this to be as easy as the following:
  | <h:commandButton action="#{bean.method(par1,par2,par3)}"/>
  | where parX is a JavaScript method outcome. EL doesn't work this way so I have to figure out something.
  | 
  | I was thinking of using a JavaScript "onclick" event on the commandButton that triggers some JavaScript code that somehow exposes parX to EL.
  | 
  | Another thought was as "onclick" that calls a Seam @Remote-method with the correct JavaScript parameters.
  | 
  | Or maybe create a custom component.
  | 
  | Any thoughts on what would be the best and cleanest solution?

Remember that EL for the button executes at render time, so I don't think your first option would work conceptually.  A simple option is to just put a plain old hidden field in your form, and have the javascript method set that prior to submit.  You can pick the value up in the beam as an @RequestParameter

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044981#4044981

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044981



More information about the jboss-user mailing list