struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chen, Dean (Zhun)" <Dean.C...@gs.com>
Subject RE: NullPointerException when repopulate session scope form
Date Wed, 07 Aug 2002 14:36:19 GMT
I wonder if this is related to the question I posted yesterday.

************************************************
Hi,
I'm having a bit of trouble keeping DynaActionForm in session scope. Maybe
I'm overlooking something simple, so any help would be appreciated.

What I'm trying to do:
1. User clicks on link which displays a table. The table content is held in
"cgdCollection".  This step works fine. 
2. One the display page, the user needs to be able to sort a column, he/she
clicks on this link
/dynacommongrid.do?actionMethod=sortMethod&sortOrder=Account
3. The CGDynaAction tries to obtain the cgdCollection object from the form,
but returns null pointer instead. 

In the CGDynaAction, I have this:
	cgdCollection = (AtlaswebDynaCollection)
cgdForm.get("cgdCollection");

In struts-config.xml, I have this:

    <form-bean      name="cgdForm" 
    	dynamic="true"
                    type="org.apache.struts.action.DynaActionForm">
			<form-property name="sortOrder"
type="java.lang.String"/>
			<form-property name="cgdCollection"
type="AtlaswebDynaCollection"/>
    </form-bean>   

	<action    path="/dynacommongrid"
			type="CGDynaAction"
			name="cgdForm"
			scope="session"
			validate="false"
			input="/jsp/error.jsp"
			parameter="actionMethod">
			<forward name="sortMethod"
path="/jsp/commongrid/dynacommongrid.jsp"/>			
	</action>

Any ideas?

Thanks,

Dean Chen



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

-----Original Message-----
From: Struts Newsgroup [mailto:struts@basebeans.com]
Sent: Wednesday, August 07, 2002 6:25 AM
To: struts-user@jakarta.apache.org
Subject: NullPointerException when repopulate session scope form


Subject: NullPointerException when repopulate session scope form
From: "Hu Ji Rong" <hujirong888@yahoo.com>
 ===
Hi,

I want to repopulate session scope form but got some NullPointerException in
jsp pages. It happends when I want to simply display data from DB.

I did it like this:
Step1: get session scope form from session in action
    CountryDetailsForm form = (CountryDetailsForm)
session.getAttribute("CountryDetailsForm");
    I've checked this form is not null.
Step2: copy data from some DTO classes retrieved from DB into above form
Step3: put back the form into session
    session.setAttribute("CountryDetailsForm", form);

Here is the struts-config.xml for this action:

    <action    path="/country_retrieve"

type="net.lido.aims.interimdb.web.dmt.country.CountryRetrieveAction"
               name="CountryDetailsForm"
               scope="session"
               validate="false"
               parameter="action"
               input="/dmt/country/country_details.jsp">
     <forward name="success"   path="/dmt/country/country_details.jsp"/>
    </action>

What could be wrong?
Thanks in advance.
JiRong



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

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


Mime
View raw message