Tommy Berglund wrote:
>
> I've got a problem and it would really help if someone could answer it.
> The problem is that I want to call a method in my bean when an event is
> triggered in my .jsp document. The code looks something like this...
>
> <USEBEAN name = "bean" type = "beans.bean" lifespan = session></USEBEAN>
>
> <body>
>
> <a href="blabla.html">Go</a>
>
> </body>
>
> Now I would like to call a method, say called setProp() in my bean when
> the user clicks the link, that is having an onClick();-handler which
> calls the method, either through javascript or some other technique.
> Does anyone know how this can be done? It would make things so much
> easier for me. What I do now is that I pass a string to the next page
> like this "blabla.html?property=prop" and then I do this
> <%
> String prop = request.getParameter("property");
> bean.setProp(prop);
> %>
> which works, but doesn't look very good.

Assuming JSP .92 you could do something like:
<USEBEAN name = "bean" type = "beans.bean" lifespan = session>
<setfromrequest beanproperty=prop >
</USEBEAN>

where setfromrequest will try to match the parameter prop to setProp

Gabriel Wong
http://www.ezwebtools.com
-------------------------

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to