You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Phillips, George H." <gh...@miami.edu> on 2001/01/09 19:10:58 UTC

mapping.getInput() returns null

Last week I replaced my 0.5 install of Struts under Tomcat 3.2 with the
12/30 build of Struts.  My app works fine
until I try to return to the originating page after a processing error. When
my action classes execute:

			return (new ActionForward(mapping.getInput()))

mapping.getInput() returns null so when the servlet tries to do a forward to
the originating page
I get:

java.lang.NullPointerException
	at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1562)
	etc...
	
A typical entry in my struts-config.xml is:

	<action	path="/jsp/signon"
  		type="edu.miami.ir.dmas.SignonAction"
    		name="signonForm"
    		scope="request"
		validate="false">
    		<forward name="success"		path="/jsp/mainMenu.jsp"/>
		<forward name="pwChange"	path="/jsp/pwChange.jsp" />
  	</action>
	
Am I understanding correctly that mapping.getInput() *should* be returning
the value in the "path" 
parameter in the action entry?  Am I missing something in the above xml, and
if not, can anyone 
suggest any other places to look for the solution?  Is there some way the
controller servlet can "drop" a mapping?  I can't find anything in the code,
though I must apologize that my understanding of mapping & the
controller servlet is pretty murky (too much code, not enough time).
Couldn't find anything in the archives relating (sure wish there was another
way to search for
message text strings beyond eyeballing)...

Thanks very much for any help!

George Phillips
University of Miami Information Technology
1365 Memorial Drive Rm. 202-H
Coral Gables, FL  33146
Phone: 305-284-5143
Email:  ghp@miami.edu


Re: mapping.getInput() returns null

Posted by Pierre Métras <ge...@sympatico.ca>.
Hi George,

Two months ago, when moving to 1.0, I was stroke by this one too...

Extract from Craig's response:
> > > mapping.getInput() works OK if you have the "input" attribute set in
> > > the corresponding action tag in struts-config.xml

So your strut-config.xml should be:

> <action path="/jsp/signon"
>   type="edu.miami.ir.dmas.SignonAction"
>     name="signonForm"
>     scope="request"

        input="/jsp/mainMenu.jsp"

> validate="false">
>     <forward name="success" path="/jsp/mainMenu.jsp"/>
> <forward name="pwChange" path="/jsp/pwChange.jsp" />
>   </action>

if you want the user to go back to "mainMenu.jsp" in case of input error.

Pierre Métras