At 30-08-00 10:33 +0100, you wrote:
>I am validating address form entries.
>
>After validation if there are any errors the form is re-displayed and the
>form entries are rewritten into their fields as intended ie the properties
>get set in the bean.
>
><%@ page language="java" import="java.sql.*, java.util.*, AddrBean " %>
>
><jsp:useBean id="addrform" class="AddrBean" >
> <jsp:setProperty name="addrform" property="*" />
></jsp:useBean>
>
>However, when I make scope="session" the existing form entries are not
>rewritten
>
><%@ page language="java" import="java.sql.*, java.util.*, AddrBean " %>
>
><jsp:useBean id="addrform" class="AddrBean" scope="session">
> <jsp:setProperty name="addrform" property="*" />
></jsp:useBean>
Try putting <jsp:setProperty> outside the <jsp:useBean> tag:
<jsp:useBean id="addrform" class="AddrBean" scope="session" />
<jsp:setProperty name="addrform" property="*" />
The <jsp:setProperty> inside the <jsp:useBean> is executed only if the
class is not yet instantiated. Also, don't forget to include
<%@ page session="true" %>
on the pages that share the object.
It worked for me - I've been checking and debugging my JSP pages and
classes for three days when I found it explained somewhere in the JSP
specification...
Gorazd
===========================================================================
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