struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David G. Friedman" <hum...@ix.netcom.com>
Subject RE: Redirect instead of forward in action mapping
Date Thu, 10 Feb 2005 22:29:20 GMT
A JSP can use the tiles taglib and pick a tiles definition to "show".  This
is how I setup my webapps' index.jsp page.  Tiles allows for two ways...

The first I use in my index page so my initial action does not have to be a
struts Action, just the plain old /index.jsp page:

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert template=".some.tiles.definition.name" />

The other includes a page and sets parameters of your choice (again, from
the tiles-defs.xml file or anything else your plugIn knows about) for you:

<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<tiles:insert page="/main.jsp" flush="true">
  <tiles:put name="title"  value="Page Title" />
  <tiles:put name="header" value="/header.jsp" />
  etc.....
</tiles:insert>

Regards,
David

-----Original Message-----
From: Benedict, Paul C [mailto:paul_benedict@merck.com]
Sent: Thursday, February 10, 2005 12:47 PM
To: 'Struts Users Mailing List'
Subject: RE: Redirect instead of forward in action mapping


Neil,

Unfortunately I know of no "better" way of accomplishing this. Redirects are
for the benefit of the user anyway -- they get a new address bar location --
and so this really shouldn't be an issue.

Thanks,
Paul

-----Original Message-----
From: Neil Aggarwal [mailto:neil@JAMMConsulting.com]
Sent: Thursday, February 10, 2005 12:40 PM
To: 'Struts Users Mailing List'
Subject: RE: Redirect instead of forward in action mapping


Paul:

I see.

I did this which worked:

    <action path="/registerForm"
            type="register.RegisterAction"
            name="registerForm"
            scope="request"
            input="register.index"
            validate="true">
      <forward name="success" path="/registerSuccess.do" redirect="true"/>
    </action>
    <action path="/registerSuccess" forward="register.success" />

Is there a better approach to doing this?

Thanks,
	Neil

--
Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by
17% or more in 6 months or less! http://newsletter.JAMMConsulting.com

> -----Original Message-----
> From: Benedict, Paul C [mailto:paul_benedict@merck.com]
> Sent: Thursday, February 10, 2005 11:30 AM
> To: 'Struts Users Mailing List'
> Cc: 'Neil Aggarwal'
> Subject: RE: Redirect instead of forward in action mapping
>
>
> Neil,
>
> You cannot redirect to a Tile. A Redirect is specific to a URI.
>
> Thanks,
> Paul
>
> -----Original Message-----
> From: Neil Aggarwal [mailto:neil@JAMMConsulting.com]
> Sent: Thursday, February 10, 2005 12:13 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Redirect instead of forward in action mapping
>
>
> Bill:
>
> I tried adding the redirect="true" parameter to my success
> forward and it does not seem to have an effect.  When
> I get to the success page and hit the reload button on my
> browser, the form data is posted again.
>
> You can try it by going to:
> https://dev.jammconsulting.com/pricetracker/register.do
> enter something (junk is OK) in the email address field
> and hit the Save button.  When you get to the
> success page, hit the reload button on the browser.
> You will get a pop up that tells you it is resending
> the information.
>
> Here is what I have in my struts-config.xml file:
>     <action path="/registerForm"
>             type="register.RegisterAction"
>             name="registerForm"
>             scope="request"
>             input="register.index"
>             validate="true">
>       <forward name="success" path="register.success"
> redirect="true"/>
>     </action>
>
> Any ideas why that did not work?
>
> Thanks,
> 	Neil
>
>
> --
> Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
> FREE! Valuable info on how your business can reduce operating costs by
> 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com
>
> > -----Original Message-----
> > From: news [mailto:news@sea.gmane.org] On Behalf Of Bill Siggelkow
> > Sent: Wednesday, February 09, 2005 10:23 PM
> > To: user@struts.apache.org
> > Subject: Re: Redirect instead of forward in action mapping
> >
> >
> > Set the redirect attribute on the forward to true:
> >
> > <forward name="success" path="register.success" redirect="true"/>
> >
> > Of course, if the success page displays data you will need to
> > make sure
> > that is is available in the session since it you will be
> > issuing a new
> > request. (You may want to look into the saveMessages(HttpSession
> > session) method).
> >
> > Neil Aggarwal wrote:
> >
> > > Hello:
> > >
> > > When I set up a form in struts, I am using this action
> > > mapping:
> > >
> > >     <action path="/registerForm"
> > >             type="register.RegisterAction"
> > >             name="registerForm"
> > >             scope="request"
> > >             input="register.index"
> > >             validate="true">
> > >       <forward name="success" path="register.success"/>
> > >     </action>
> > >
> > > When the form is posted successfully, the user is forwarded
> > > to a page that says their information was entered successfully.
> > >
> > > Unfortunately, if they hit reload on that page, it will re-execute
> > > the form and their data will be posted again.
> > >
> > > To get around this, I use a redirect instead of forward in many
> > > of my apps.
> > >
> > > Is there a way to do that within struts?
> > >
> > > Thanks,
> > > 	Neil
> > >
> > >
> > > --
> > > Neil Aggarwal, JAMM Consulting, (972)612-6056,
> > www.JAMMConsulting.com
> > > FREE! Valuable info on how your business can reduce
> > operating costs by
> > > 17% or more in 6 months or less!
> > http://newsletter.JAMMConsulting.com
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> --------------------------------------------------------------
> ----------------
> Notice:  This e-mail message, together with any attachments,
> contains information of Merck & Co., Inc. (One Merck Drive,
> Whitehouse Station, New Jersey, USA 08889), and/or its
> affiliates (which may be known outside the United States as
> Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
> Banyu) that may be confidential, proprietary copyrighted
> and/or legally privileged. It is intended solely for the use
> of the individual or entity named on this message.  If you
> are not the intended recipient, and have received this
> message in error, please notify us immediately by reply
> e-mail and then delete it from your system.
> --------------------------------------------------------------
> ----------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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




----------------------------------------------------------------------------
--
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
Jersey, USA 08889), and/or its affiliates (which may be known outside the
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
Banyu) that may be confidential, proprietary copyrighted and/or legally
privileged. It is intended solely for the use of the individual or entity
named on this message.  If you are not the intended recipient, and have
received this message in error, please notify us immediately by reply e-mail
and then delete it from your system.
----------------------------------------------------------------------------
--

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


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


Mime
View raw message