In your jsp page, you should add one line:
session.putValue("any id", bean);

In your servlet, you add these:
HttpSession session = req.getSession();
bean.sampleBean bean = session.getValue("any id");

Then you should be able to access the same bean in anyway you want.
--Jun



                    Tommy Berglund
                    <[EMAIL PROTECTED]>          To:     [EMAIL PROTECTED]
                    Sent by: A               cc:
                    mailing list             Subject:     servlet to bean communication
                    about Java Server
                    Pages
                    specification and
                    reference
                    <JSP-INTEREST@JAV
                    A.SUN.COM>


                    05/26/99 10:11 AM
                    Please respond to
                    Tommy Berglund





Hello everyone,

I'm having some trouble with calling a bean-method from a servlet. I use
JSP1.0.

Now, this is what I do, I have a jsp-page with the following content...

<html>
<jsp:useBean id=bean class=bean.sampleBean scope=session />

<a href="/servlet/setInfo?param=value>Send Value</a>
</html>

The servlet (setInfo) code looks like this

String param = req.getParameter("param");

Now the servlet gets this value and what I want to do is to call a method
in the
sampleBean (the one in the jsp-page) from the servlet with this value and
then
continue to another page where the bean continues to live with this value
set. I
know how to pass control to another page, but the problem is how do I get
contact with the sampleBean from the servlet. It would help me a lot to get
this
working.

Regards

/Tommy

===========================================================================
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".

===========================================================================
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