You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "MARU, SOHIL (SBCSI)" <sm...@sbc.com> on 2004/04/21 00:33:47 UTC
Form Object is null
Hello All,
I have a page on which I have to update 2-3 fields based on value
selected by the user for another field. What I did was create an action
which I call by executing some javascript by capturing the onchange
event. Here is my struts-config.xml clip
<form-bean name="ApplicationForm"
type="com.sbc.hrtech.loa.ui.form.LoaApplicationForm"/>
...
...
...
..
<action path="/updateApplicationData" validate="false"
type="com.sbc.hrtech.loa.ui.action.UpdateApplicationDataAction"
scope="request" input="/WEB-INF/jsp/application.jsp"
name="ApplicationForm">
<forward name="success"
path="/WEB-INF/jsp/application.jsp"/>
</action>
In my html(actually XSL), I have the following javascript function
function updateDisplayData(fieldName){
document.ApplicationForm.action =
"/loa/updateApplicationData.do?changedField="+fieldName;
document.ApplicationForm.submit();
}
However in the action class, when I try to refer to the form, I get a
null pointer exception. Any ideas what I am doing wrong?
public ActionForward execute(ActionMapping am, ActionForm af,
HttpServletRequest req, HttpServletResponse res)
throws Exception {
HttpSession sess = req.getSession();
ActionErrors actionErrs = new ActionErrors();
LoaApplicationForm laf = (LoaApplicationForm)af;
--> LINE WHICH THROWS THE EXCEPTION BELOW
if(laf.validBeginDate(actionErrs) &&
laf.validEndDate(actionErrs)){
Thanks,
Sohil
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Form Object is null
Posted by Bill Siggelkow <bi...@bellsouth.net>.
Did you specify the form in the "name" attribute of the action mapping
for the "udpateApplicationData" action? If you still have problems try
setting the scope of the form to session.
MARU, SOHIL (SBCSI) wrote:
> Hello All,
> I have a page on which I have to update 2-3 fields based on value
> selected by the user for another field. What I did was create an action
> which I call by executing some javascript by capturing the onchange
> event. Here is my struts-config.xml clip
> <form-bean name="ApplicationForm"
> type="com.sbc.hrtech.loa.ui.form.LoaApplicationForm"/>
> ...
> ...
> ...
> ..
> <action path="/updateApplicationData" validate="false"
> type="com.sbc.hrtech.loa.ui.action.UpdateApplicationDataAction"
> scope="request" input="/WEB-INF/jsp/application.jsp"
> name="ApplicationForm">
> <forward name="success"
> path="/WEB-INF/jsp/application.jsp"/>
> </action>
>
> In my html(actually XSL), I have the following javascript function
> function updateDisplayData(fieldName){
> document.ApplicationForm.action =
> "/loa/updateApplicationData.do?changedField="+fieldName;
> document.ApplicationForm.submit();
> }
>
> However in the action class, when I try to refer to the form, I get a
> null pointer exception. Any ideas what I am doing wrong?
>
> public ActionForward execute(ActionMapping am, ActionForm af,
> HttpServletRequest req, HttpServletResponse res)
> throws Exception {
> HttpSession sess = req.getSession();
> ActionErrors actionErrs = new ActionErrors();
> LoaApplicationForm laf = (LoaApplicationForm)af;
> --> LINE WHICH THROWS THE EXCEPTION BELOW
> if(laf.validBeginDate(actionErrs) &&
> laf.validEndDate(actionErrs)){
>
> Thanks,
> Sohil
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org