Jason Wyatt wrote:
>
> Hi,
>
> I am using JBuilder 3.5 Enterprise & am having a problem with
> JSP's introspection, ie using setProperty<... property="*" ...> to
> set fields of the same name in a bean.
>
> I have two jsp pages, one to display a page (the 'view' page) and
> another to read the form which is generated from the view page
> submit (the 'reader' page). Both pages use the same bean - the
> view page uses it to read and display info from the ejbs, and the
> reader page uses it to do the introspection, and submision of info
> to the ejbs.
>
> My problem is this:
> The introspection works fine if the bean is instantiated with
> "request" scope in both pages, but this means that the bean is
> instantiated twice - once for the view page, and again for the reader
> page. I would prefer if the bean is instantiated with "session" scope
> in the view page, so that one instance is shared by the view and
> the reader. When I change the scope to "session" in both pages,
> the bean instance is available correctly to the reader, but the
> instrospection stops working. Does introspection rely on requests,
> or is there a way to use session scope?

A possible reason for what you see is using the <jsp:setProperty>
action within the body of the <jsp:useBean> action:

  <jsp:useBean id="foo" scope="session" ... >
    <jsp:setProperty name="foo" property="*" />
  </jsp:useBean>

If that's the case, the <jsp:setProperty> action is only called when
the bean is created, i.e. the first time you access this page within the
session. Change it to this instead:

  <jsp:useBean id="foo" scope="session" ... />
  <jsp:setProperty name="foo" property="*" />

With this syntax, <jsp:setProperty> is always called when you access the
page, changing the state of the bean if it already exists.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to