Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.