cancel
Showing results for 
Search instead for 
Did you mean: 

Bean in Javascript

Former Member
0 Kudos

A quickie. Is it possible to set a bean value in JavaScript. Cause I sure am trying to but no luck. Basically what i am trying to do is that when the user clicks a button on the jsp iview a popup appears. Now since there is more than one button in the jsp view i wish to set a state in the bean depending on which button was clicked and trap that in the doprocessbeforeoutput in the .java file. Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

No it is not possible. JSP scriptlets (contained within <% %> brackets) are executed at the server whereas javascripts are executed at the client. That means that the expression mySelectBean.setState(DEFAULT_STATE); will be executed before the response is sent to the client and not when the client execute the javascript function tester().

Hope this makes it a little clearer.

In general you may not manipulate the state of objects contained in the webserver (s.a. beans) in javascript functions.

Regards

/Fredrik