You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren McGuinness <Da...@morganstanley.com> on 2002/08/30 17:17:09 UTC

action mapping question

Hi,

Having a few problems getting my application working properly. Basically
I've got a logon.jsp page which posts to logon.do action, which then
validates and if successfull outputs search.jsp (shows in the browser as
/logon.do ).

then on search.jsp i have 2 forms, one to search.do and one to logoff.do

here's my action mapping for logoff:

  <action   path="/logoff"
              type="struts1.action.LogoffAction"
              name="logoffForm"
              input="/logon.do"
              scope="request">
            <forward name="success" path="/logon.jsp"/>
            <forward name="failure" path="/logon.jsp"/>
    </action>

first of all, i dont want to use a bean for the logoff action but it
complains otherwise, so for now i've used a form with a attribute dummy
with get/set/reset/validate  methods....is there a way not to have to do
this? if i dont have a form, I get an exception complaining the form
bean is null.....

second, what should 'input' be? if i leave it as "/logon.do" then it
works, but also if i put it as "/tapssearch.jsp" it works......so what
should it be? and how can i set action-mapping to accept input from any
page, seeing as for example i'll want to be able to log-off from any one
of the pages(bar the logon one of course!) So that i dont have to write
an action mapping for every page that has a logoff form....

cheers



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: action mapping question

Posted by Ted Husted <hu...@apache.org>.
The html:form tag expects there to be a ActionForm bean associated with 
the form. If you are using a button-only form, you still need to provide 
an ActionForm bean, even if it is an empty implementation. I generally 
keep one of these in my Struts toolkit to use throughout an application. 
Or, you could just use whatever bean is handy.

You don't need a bean with an Action, but you do need one to appease the 
html:form tag.

-Ted.

>
>
>then on search.jsp i have 2 forms, one to search.do and one to logoff.do
>
>here's my action mapping for logoff:
>
>  <action   path="/logoff"
>              type="struts1.action.LogoffAction"
>              name="logoffForm"
>              input="/logon.do"
>              scope="request">
>            <forward name="success" path="/logon.jsp"/>
>            <forward name="failure" path="/logon.jsp"/>
>    </action>
>
>first of all, i dont want to use a bean for the logoff action but it
>complains otherwise, so for now i've used a form with a attribute dummy
>with get/set/reset/validate  methods....is there a way not to have to do
>this? if i dont have a form, I get an exception complaining the form
>bean is null.....
>
>second, what should 'input' be? if i leave it as "/logon.do" then it
>works, but also if i put it as "/tapssearch.jsp" it works......so what
>should it be? and how can i set action-mapping to accept input from any
>page, seeing as for example i'll want to be able to log-off from any one
>of the pages(bar the logon one of course!) So that i dont have to write
>an action mapping for every page that has a logoff form....
>
>cheers
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>