You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Chen, Gin" <Gi...@tvratings.com> on 2002/10/18 18:55:26 UTC

action mapping input

Hi all,
	I'm still new to struts and I cant find this in the documentation
but, lets say that you have one of the struts-config from the docs.

  <global-forwards type="org.apache.struts.action.ActionForward"/>
    <forward name="logon" path="/logon.jsp" redirect="false" />
  </global-forwards>
  <action-mappings>
    <action path="/logon" type="org.apache.struts.example.LogonAction"
name="logonForm" scope="request" input="/logon.jsp" unknown="false"
validate="true" />
  </action-mappings>

   Rather than have input="/logon.jsp" as in the snip can you have
input="logon" and have it use the path from the global-forwards?
   It just seems like it would make more sense since that means that you
only have to change one location in case the location of the file ever has
to change.

Thanks,
-Tim

-----Original Message-----
From: Eddie Bush [mailto:ekbush@swbell.net]
Sent: Wednesday, October 09, 2002 1:25 PM
To: Struts Users Mailing List
Subject: Re: "Avoid Heavy Use of Logic Tags" ???


... and now that we have the JSTL you can have your tags optimized into 
actual code.  It's my understanding, for example, that a forEach tag 
would be translated into an actual while (or was it for ...  anyway, you 
get the point).  So, you're bypassing the tag-usage overhead some.

Hopefully Martin will see this and elaborate (and correct me if I'm 
wrong).  I believe that's fairly close though ...

Of course - not all of us are on containers that even support the JSTL 
... but some of us are :-)

Robert wrote:

>I think that statement "Using custom tags for logic provides little
>benefit..." is bit vague. I would say that custom tags the do
>PRESENTATION logic are of benefit, e.g. iterators, formatting, html
>controls, etc. all fit into that category for me. You are right, you
>have to do it somehow, where otherwise you end up with just static HTML
>right?
>
>I'm not sure why he would say that XML syntax is more difficult to
>maintain than other types. That is probably more of an 'eye of the
>beholder' issue. If you have web developers that are unfamiliar with
>Java, then the XML syntax is probably easier than a bunch of scriptlets,
>no? Personally I think it is a lot easier to read than other dynamic
>page systems (ASP, PHP, etc.), but that is just me.
>
>- Robert
>
-- 
Eddie Bush




--
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>


Re: action mapping input

Posted by Kris Schneider <kr...@dotech.com>.
You can also leverage the input attribute in an action by returning the 
following from perform/execute:

new ActionForward(mapping.getInput())

Quoting John Nicholas <ja...@mobosplash.com>:

> Chen, Gin wrote:
> > Hi all,
> > 	I'm still new to struts and I cant find this in the documentation
> > but, lets say that you have one of the struts-config from the docs.
> > 
> >   <global-forwards type="org.apache.struts.action.ActionForward"/>
> >     <forward name="logon" path="/logon.jsp" redirect="false" />
> >   </global-forwards>
> >   <action-mappings>
> >     <action path="/logon" type="org.apache.struts.example.LogonAction"
> > name="logonForm" scope="request" input="/logon.jsp" unknown="false"
> > validate="true" />
> >   </action-mappings>
> > 
> >    Rather than have input="/logon.jsp" as in the snip can you have
> > input="logon" and have it use the path from the global-forwards?
> >    It just seems like it would make more sense since that means that you
> > only have to change one location in case the location of the file ever
> has
> > to change.
> > 
> 
> 
> The input attribute is used when validation of the form bean fails. if 
> the validation in the form bean (or the validator) fails the action is 
> never run so it couldn't use the forward. The controller is returning 
> you to the input page.
> 
> If a validation in the action fails (like a business logic failure)then 
> you can use a "failure" forward.
> 
> John Nicholas
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Re: action mapping input

Posted by John Nicholas <ja...@mobosplash.com>.
Chen, Gin wrote:
> Hi all,
> 	I'm still new to struts and I cant find this in the documentation
> but, lets say that you have one of the struts-config from the docs.
> 
>   <global-forwards type="org.apache.struts.action.ActionForward"/>
>     <forward name="logon" path="/logon.jsp" redirect="false" />
>   </global-forwards>
>   <action-mappings>
>     <action path="/logon" type="org.apache.struts.example.LogonAction"
> name="logonForm" scope="request" input="/logon.jsp" unknown="false"
> validate="true" />
>   </action-mappings>
> 
>    Rather than have input="/logon.jsp" as in the snip can you have
> input="logon" and have it use the path from the global-forwards?
>    It just seems like it would make more sense since that means that you
> only have to change one location in case the location of the file ever has
> to change.
> 


The input attribute is used when validation of the form bean fails. if 
the validation in the form bean (or the validator) fails the action is 
never run so it couldn't use the forward. The controller is returning 
you to the input page.

If a validation in the action fails (like a business logic failure)then 
you can use a "failure" forward.

John Nicholas



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