You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Levine <ad...@hotmail.com> on 2003/07/10 23:21:12 UTC

Re: (RE-POST) RE: using getInputForward vs new ActionForward(mapping.getInput())

nothing asked, nothing answered..

  yes, the input page has always been a .jsp, the "destination" (address 
bar) page has always been a .jsp. and the action to which the form is posted 
has always been a .do/.jspa/action..     nothing changed save for the 
swapping of libraries (.jars).


From: Sandeep Takhar <sa...@yahoo.com>
Reply-To: "Struts Users Mailing List" <st...@jakarta.apache.org>
To: Struts Users Mailing List <st...@jakarta.apache.org>
Subject: Re: (RE-POST)  RE: using getInputForward vs new 
ActionForward(mapping.getInput())
Date: Thu, 10 Jul 2003 13:56:51 -0700 (PDT)

obvious guy asks:

your input has always been to a .do or equivalent (to
an action) or to a jsp?

sandeep
--- Yansheng Lin <ya...@isogis.com> wrote:
 > Read backwards:).  Interested in finding out why.
 >
 >
 >
 > -----Original Message-----
 > From: Adam Levine [mailto:adam_l_levine@hotmail.com]
 >
 > Sent: July 8, 2003 4:01 PM
 > To: struts-user@jakarta.apache.org
 > Subject: RE: using getInputForward vs new
 > ActionForward(mapping.getInput())
 >
 >
 > Or, I can just tie the errors into my session object
 > and use my own tags to
 > pull and push them as needed (still ugly, but keeps
 > the url clean).
 >
 > Perhaps there's a struts developer reading this list
 > who has some insight.
 >
 > --a
 >
 >
 > From: "Yansheng Lin" <ya...@isogis.com>
 > Reply-To: "Struts Users Mailing List"
 > <st...@jakarta.apache.org>
 > To: "'Struts Users Mailing List'"
 > <st...@jakarta.apache.org>
 > Subject: RE: using getInputForward vs new
 > ActionForward(mapping.getInput())
 > Date: Tue, 8 Jul 2003 15:30:24 -0600
 >
 > Huh.  I am surprised that it worked for you before.
 >
 > And yes, if you want the URL to change in the
 > address bar, you will need
 > some sort of redirect.  (Correct me if I am wrong
 > here).  However, once you
 > redirect the page, you lose anything that's returned
 > in the response, including
 > the
 > errors collection.
 >
 > An ugly hack is to pass the errors in the URL.  But
 > as I said, it's ugly.
 > I would be interested to know what happened, why it
 > worked before?
 >
 > -----Original Message-----
 > From: Adam Levine [mailto:adam_l_levine@hotmail.com]
 > Sent: July 8, 2003 3:18 PM
 > To: struts-user@jakarta.apache.org
 > Subject: RE: using getInputForward vs new
 > ActionForward(mapping.getInput())
 >
 >
 > Correct. isEmpty() returns false (there are items
 > present). and yes,
 > html:errors shows nothing.
 >
 > And, the getInput() does return what I expect.  It
 > returns the phsyical url
 > of the form page that I want displayed in the
 > address bar when there are
 > form problems (errors is not empty).
 >
 > I'm returning an ActionForward.  The only difference
 > is in whether or not
 > the redirect is set to true or false.  If it's set
 > to true, the address bar
 > is right and html:errors shows nothing.  If it's set
 > to false, the address
 > bar is "wrong" (shows the .jspa dynamic address
 > rather than the physical),
 > but html:errors works.
 >
 > So, what I want is the phsyical address inthe bar,
 > and the errors to
 > display.
 >
 > clearer (?) walk-through:
 > entry page:  /app/enterInfo.jsp
 > form post:  /app/validateInfo.jspa     <- Action
 >
 > on errors, it should display the page contents of
 > /app/enterInfo.jsp (which
 > it does), and show /app/enterInfo.jsp in the address
 > bar, and html:errors
 > should iterate.
 >
 > with redirect set to false, I get
 > /app/validateInfo.jspa in the address
 > bar, the page contents, and an iteration of
 > html:errors.
 >
 > with redirect set to true, I get /app/enterInfo.jsp,
 > the page contents, and
 > no html:errors.
 >
 >
 > Like I mentioned in my first post, this was working
 > the way I wanted before
 > I moved to the newer libraries.
 >
 > Any other ideas?
 >
 > thanks!
 >
 > -- adam
 >
 > From: "Yansheng Lin" <ya...@isogis.com>
 > Reply-To: "Struts Users Mailing List"
 > <st...@jakarta.apache.org>
 > To: "'Struts Users Mailing List'"
 > <st...@jakarta.apache.org>
 > Subject: RE: using getInputForward vs new
 > ActionForward(mapping.getInput())
 > Date: Tue, 8 Jul 2003 14:55:45 -0600
 >
 >
 > So you are saying that error.isEmpty() returns
 > false, but <html:errors/>
 > doesn't
 > display anything?
 >
 > This is happening 'cause you use redirect instead of
 > forward. Also You might
 > want to try System.out.println(mapping.getInput())
 > to see if you are going
 > back
 > to the right page. You might be surprised:).
 >
 > -----Original Message-----
 > From: Adam Levine [mailto:adam_l_levine@hotmail.com]
 > Sent: July 8, 2003 1:40 PM
 > To: struts-user@jakarta.apache.org
 > Subject: using getInputForward vs new
 > ActionForward(mapping.getInput())
 >
 > My goal in handling "business problems" in
 > validating a form submission from
 > an Action.execute() is 2-fold:
 >
 >
 > 1:  Display the accumulated ActionErrors (ie, using
 > [html:errors/] )
 >
 > 2: "Return" the user to the exact same URL in their
 > browser address bar.
 >
 > I was using an action-mapping forward in
 > struts-config to send them to the
 > original .jsp they used to submit from.  The errors
 > were showing up (good),
 > but the URL in the address bar was being shown as
 > /dynamic/Path.jspa (bad)
 >
 > So I changed the action-mapping, setting "redirect"
 > to "true".  Now the
 > address bar was correct (good), but the error
 > messages were gone (bad).
 >
 > Then I did a lot of web searching, and discovered
 > that I should be using the
 > getInput.
 > So, now my execute() was returning:          return
 > new
 > ActionForward(mapping.getInput());
 >
 > This worked!  The address bar was correct and the
 > errors were still present.
 >
 > Then I "upgraded" my struts library to 1.1b3.    Now
 > I'm back to the
 > original problem of the address bar being right, but
 > my errors are gone.
 >
 > I found   mapping.getInputForward(), and tried
 > returning that, even going in
 > and setting the redirect field to "true".  I'm
 > bouncing between the same 2
 > situations I had before.
 >
 > Am I missing something?  Is it no longer possible to
 > have "the best of both
 > worlds"?  For whatever it may be worth, I'm using
 > the -el sets of libraries
 > (thank you for finally getting that!).. and jboss
 > 3.07.. and xdoclet...
 >
 >
 > Thanks for any insight you can provide.
 >
 > -- adam
 >
 >
_________________________________________________________________
 > STOP MORE SPAM with the new MSN 8 and get 2 months
 > FREE*
 > http://join.msn.com/?page=features/junkmail
 >
 >
 >
---------------------------------------------------------------------
 > To unsubscribe, e-mail:
 > struts-user-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail:
 > struts-user-help@jakarta.apache.org
 >
 >
 >
---------------------------------------------------------------------
 > To unsubscribe, e-mail:
 > struts-user-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail:
 > struts-user-help@jakarta.apache.org
 >
 >
_________________________________________________________________
 > MSN 8 with e-mail virus protection service: 2 months
 > FREE*
 > http://join.msn.com/?page=features/virus
 >
 >
 >
---------------------------------------------------------------------
 > To unsubscribe, e-mail:
 > struts-user-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail:
 > struts-user-help@jakarta.apache.org
 >
 >
 >
---------------------------------------------------------------------
 > To unsubscribe, e-mail:
 > struts-user-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail:
 > struts-user-help@jakarta.apache.org
 >
 >
_________________________________________________________________
 > The new MSN 8: advanced junk mail protection and 2
 > months FREE*
 > http://join.msn.com/?page=features/junkmail
 >
 >
 >
---------------------------------------------------------------------
 > To unsubscribe, e-mail:
 > struts-user-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail:
 > struts-user-help@jakarta.apache.org
 >
 >
 >
---------------------------------------------------------------------
 > To unsubscribe, e-mail:
 > struts-user-unsubscribe@jakarta.apache.org
 > For additional commands, e-mail:
 > struts-user-help@jakarta.apache.org
 >


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


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


Re: (RE-POST) RE: using getInputForward vs new ActionForward(mapping.getInput())

Posted by Sandeep Takhar <sa...@yahoo.com>.
there is a way you won't like and I don't like either.

have the input point to a mapping that is exactly the
same and has a different parameter.  Change the action
to check for it and just render the jsp.

sandeep
--- Adam Levine <ad...@hotmail.com> wrote:
> nothing asked, nothing answered..
> 
>   yes, the input page has always been a .jsp, the
> "destination" (address 
> bar) page has always been a .jsp. and the action to
> which the form is posted 
> has always been a .do/.jspa/action..     nothing
> changed save for the 
> swapping of libraries (.jars).
> 
> 
> From: Sandeep Takhar <sa...@yahoo.com>
> Reply-To: "Struts Users Mailing List"
> <st...@jakarta.apache.org>
> To: Struts Users Mailing List
> <st...@jakarta.apache.org>
> Subject: Re: (RE-POST)  RE: using getInputForward vs
> new 
> ActionForward(mapping.getInput())
> Date: Thu, 10 Jul 2003 13:56:51 -0700 (PDT)
> 
> obvious guy asks:
> 
> your input has always been to a .do or equivalent
> (to
> an action) or to a jsp?
> 
> sandeep
> --- Yansheng Lin <ya...@isogis.com> wrote:
>  > Read backwards:).  Interested in finding out why.
>  >
>  >
>  >
>  > -----Original Message-----
>  > From: Adam Levine
> [mailto:adam_l_levine@hotmail.com]
>  >
>  > Sent: July 8, 2003 4:01 PM
>  > To: struts-user@jakarta.apache.org
>  > Subject: RE: using getInputForward vs new
>  > ActionForward(mapping.getInput())
>  >
>  >
>  > Or, I can just tie the errors into my session
> object
>  > and use my own tags to
>  > pull and push them as needed (still ugly, but
> keeps
>  > the url clean).
>  >
>  > Perhaps there's a struts developer reading this
> list
>  > who has some insight.
>  >
>  > --a
>  >
>  >
>  > From: "Yansheng Lin" <ya...@isogis.com>
>  > Reply-To: "Struts Users Mailing List"
>  > <st...@jakarta.apache.org>
>  > To: "'Struts Users Mailing List'"
>  > <st...@jakarta.apache.org>
>  > Subject: RE: using getInputForward vs new
>  > ActionForward(mapping.getInput())
>  > Date: Tue, 8 Jul 2003 15:30:24 -0600
>  >
>  > Huh.  I am surprised that it worked for you
> before.
>  >
>  > And yes, if you want the URL to change in the
>  > address bar, you will need
>  > some sort of redirect.  (Correct me if I am wrong
>  > here).  However, once you
>  > redirect the page, you lose anything that's
> returned
>  > in the response, including
>  > the
>  > errors collection.
>  >
>  > An ugly hack is to pass the errors in the URL. 
> But
>  > as I said, it's ugly.
>  > I would be interested to know what happened, why
> it
>  > worked before?
>  >
>  > -----Original Message-----
>  > From: Adam Levine
> [mailto:adam_l_levine@hotmail.com]
>  > Sent: July 8, 2003 3:18 PM
>  > To: struts-user@jakarta.apache.org
>  > Subject: RE: using getInputForward vs new
>  > ActionForward(mapping.getInput())
>  >
>  >
>  > Correct. isEmpty() returns false (there are items
>  > present). and yes,
>  > html:errors shows nothing.
>  >
>  > And, the getInput() does return what I expect. 
> It
>  > returns the phsyical url
>  > of the form page that I want displayed in the
>  > address bar when there are
>  > form problems (errors is not empty).
>  >
>  > I'm returning an ActionForward.  The only
> difference
>  > is in whether or not
>  > the redirect is set to true or false.  If it's
> set
>  > to true, the address bar
>  > is right and html:errors shows nothing.  If it's
> set
>  > to false, the address
>  > bar is "wrong" (shows the .jspa dynamic address
>  > rather than the physical),
>  > but html:errors works.
>  >
>  > So, what I want is the phsyical address inthe
> bar,
>  > and the errors to
>  > display.
>  >
>  > clearer (?) walk-through:
>  > entry page:  /app/enterInfo.jsp
>  > form post:  /app/validateInfo.jspa     <- Action
>  >
>  > on errors, it should display the page contents of
>  > /app/enterInfo.jsp (which
>  > it does), and show /app/enterInfo.jsp in the
> address
>  > bar, and html:errors
>  > should iterate.
>  >
>  > with redirect set to false, I get
>  > /app/validateInfo.jspa in the address
>  > bar, the page contents, and an iteration of
>  > html:errors.
>  >
>  > with redirect set to true, I get
> /app/enterInfo.jsp,
>  > the page contents, and
>  > no html:errors.
>  >
>  >
>  > Like I mentioned in my first post, this was
> working
>  > the way I wanted before
>  > I moved to the newer libraries.
>  >
>  > Any other ideas?
>  >
>  > thanks!
>  >
>  > -- adam
>  >
>  > From: "Yansheng Lin" <ya...@isogis.com>
>  > Reply-To: "Struts Users Mailing List"
>  > <st...@jakarta.apache.org>
>  > To: "'Struts Users Mailing List'"
>  > <st...@jakarta.apache.org>
>  > Subject: RE: using getInputForward vs new
>  > ActionForward(mapping.getInput())
>  > Date: Tue, 8 Jul 2003 14:55:45 -0600
>  >
>  >
>  > So you are saying that error.isEmpty() returns
>  > false, but <html:errors/>
>  > doesn't
>  > display anything?
>  >
>  > This is happening 'cause you use redirect instead
> of
>  > forward. Also You might
>  > want to try
> System.out.println(mapping.getInput())
>  > to see if you are going
>  > back
>  > to the right page. You might be surprised:).
>  >
>  > -----Original Message-----
>  > From: Adam Levine
> [mailto:adam_l_levine@hotmail.com]
>  > Sent: July 8, 2003 1:40 PM
>  > To: struts-user@jakarta.apache.org
>  > Subject: using getInputForward vs new
>  > ActionForward(mapping.getInput())
>  >
>  > My goal in handling "business problems" in
>  > validating a form submission from
>  > an Action.execute() is 2-fold:
>  >
>  >
>  > 1:  Display the accumulated ActionErrors (ie,
> using
>  > [html:errors/] )
>  >
>  > 2: "Return" the user to the exact same URL in
> their
>  > browser address bar.
>  >
>  > I was using an action-mapping forward in
>  > struts-config to send them to the
>  > original .jsp they used to submit from.  The
> errors
>  > were showing up (good),
>  > but the URL in the address bar was being shown as
>  > /dynamic/Path.jspa (bad)
>  >
>  > So I changed the action-mapping, setting
> "redirect"
>  > to "true".  Now the
>  > address bar was correct (good), but the error
>  > messages were gone (bad).
>  >
>  > Then I did a lot of web searching, and discovered
>  > that I should be using the
>  > getInput.
>  > So, now my execute() was returning:         
> return
>  > new
>  > ActionForward(mapping.getInput());
>  >
>  > This worked!  The address bar was correct and the
>  > errors were still present.
>  >
>  > Then I "upgraded" my struts library to 1.1b3.   
> Now
>  > I'm back to the
>  > original problem of the address bar being right,
> but
>  > my errors are gone.
>  >
>  > I found   mapping.getInputForward(), and tried
>  > returning that, even going in
>  > and setting the redirect field to "true".  I'm
>  > bouncing between the same 2
>  > situations I had before.
>  >
>  > Am I missing something?  Is it no longer possible
> to
>  > have "the best of both
>  > worlds"?  For whatever it may be worth, I'm using
>  > the -el sets of libraries
>  > (thank you for finally getting that!).. and jboss
>  > 3.07.. and xdoclet...
>  >
>  >
>  > Thanks for any insight you can provide.
>  >
>  > -- adam
>  >
>  >
>
_________________________________________________________________
>  > STOP MORE SPAM with the new MSN 8 and get 2
> months
>  > FREE*
>  > http://join.msn.com/?page=features/junkmail
>  >
>  >
>  >
>
---------------------------------------------------------------------
>  > To unsubscribe, e-mail:
>  > struts-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail:
>  > struts-user-help@jakarta.apache.org
>  >
>  >
>  >
>
---------------------------------------------------------------------
>  > To unsubscribe, e-mail:
>  > struts-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail:
>  > struts-user-help@jakarta.apache.org
>  >
>  >
>
_________________________________________________________________
>  > MSN 8 with e-mail virus protection service: 2
> months
>  > FREE*
>  > http://join.msn.com/?page=features/virus
>  >
>  >
>  >
>
---------------------------------------------------------------------
>  > To unsubscribe, e-mail:
>  > struts-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail:
>  > struts-user-help@jakarta.apache.org
>  >
>  >
>  >
>
---------------------------------------------------------------------
>  > To unsubscribe, e-mail:
>  > struts-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail:
>  > struts-user-help@jakarta.apache.org
>  >
>  >
>
_________________________________________________________________
>  > The new MSN 8: advanced junk mail protection and
> 2
>  > months FREE*
>  > http://join.msn.com/?page=features/junkmail
>  >
>  >
>  >
>
---------------------------------------------------------------------
>  > To unsubscribe, e-mail:
>  > struts-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail:
>  > struts-user-help@jakarta.apache.org
>  >
>  >
>  >
>
---------------------------------------------------------------------
>  > To unsubscribe, e-mail:
>  > struts-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail:
>  > struts-user-help@jakarta.apache.org
>  >
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
>
_________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months
> FREE*  
> http://join.msn.com/?page=features/virus
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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