Skip to Content
avatar image
Former Member

Bean in Javascript

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 06, 2004 at 01:04 PM

    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.



    Add comment
    10|10000 characters needed characters exceeded