struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alireza Fattahi <Alireza.Fatt...@pdpsoft.com>
Subject RE: Pre Population Problem with FormBean - Urgent
Date Mon, 03 Feb 2003 10:32:52 GMT
Little guide line: try to minimize the scope of the error, hope use full.

Try this could on you second page, to see what values are actually in
session:
<%
Enumeration enmAttributeNames;
String strAttributeName;
Object objAttributeValue;

request.getSession(true);

enmAttributeNames = session.getAttributeNames();
while (enmAttributeNames.hasMoreElements())
{
  out.println("<TR>");
  strAttributeName = (String) enmAttributeNames.nextElement();
  out.print("<TD><B>" + strAttributeName + ":</B></TD>" );
  objAttributeValue =  session.getAttribute(strAttributeName);
  out.println("<TD><PRE>" + objAttributeValue + "&nbsp;</PRE></TD>");
  out.println("</TR>");


}
%>

If the values are in session then it is tag problems, don't do any thing
with action.
Else the value is not actually in session so the tags ca not show them (fix
the action). Try to read the session without using struts tags.

-----Original Message-----
From: ashokd [mailto:ashokd@visualsoft-tech.com] 
Sent: Monday, January 28, 2002 9:23 PM
To: Struts Users Mailing List
Subject: Pre Population Problem with FormBean - Urgent

Hi,

 In my application in Action Class we are setting FormBean values for  next
screen.

 In this scenario first time the values are not pre populating in next
screen.

If we refreshed the page i.e: the action invoking once again then  the
values are prepopulating.


 Scope of the Next FormBean : Session

 Code in Action class:

     TestForm unitForm =
 (TestForm)aRequest.getSession().getAttribute("unitselForm");
     if(unitForm == null){
      unitForm = new TestForm( );
     }
           unitForm.setUnit("2");
            unitForm.setUserId("Ashok");



 Thanks in Advance,
 Ashok.D



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message