You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marcus Biel <Ma...@bmw.de> on 2002/12/03 09:37:03 UTC

different forwards from form

I got a form for editing a data records.
When I hit "cancel" I want to display an other page then when I hit
submit.

How to do this ?


thx,

marcus

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


Re: different forwards from form

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 3. 09:37 dátummal Marcus Biel ezt írtad:
> I got a form for editing a data records.
> When I hit "cancel" I want to display an other page then when I hit
> submit.
>
> How to do this ?

Read the docs! Take a look at the struts-example.war, or read the struts-tips 
at husted.com: 

http://www.husted.com/struts/tips/014.html

Hth,

Tib

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


Re: different forwards from form

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 3. 10:01 dátummal Marcus Biel ezt írtad:
> No, my problem is different!

No. Your problem is the same.

> Now if I add a cancel button, it works,
> but also forwards to this same page,
> instead of to the regular start page.

If you add a cancel button, you can handle the cancel event by checking 
isCancelled(request) so you can decide where forward to. 
Simplified:

if (isCancelled(request)) 
	return mapping.findForward("cancel");

And define a forward named 'cancel'. If you do so you will be forwarded to 
this page. 

Tib

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


Re: different forwards from form

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 3. 10:22 dátummal Marcus Biel ezt írtad:
> I thought (isCancelled(request))
>
> would be a user defined method.
> Are you sure I can simple use this method,
> and he will know the user hit the cancel button ?

If the cancel button was generated with <html:cancel>cancel</html:cancel>

Hth,

Tib

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


Re: different forwards from form

Posted by Marcus Biel <Ma...@bmw.de>.
I thought (isCancelled(request))

would be a user defined method.
Are you sure I can simple use this method,
and he will know the user hit the cancel button ?

marcus

gemes@regens.hu schrieb:
> 
> 2002. december 3. 10:01 dátummal Marcus Biel ezt írtad:
> > No, my problem is different!
> 
> No. Your problem is the same.
> 
> > Now if I add a cancel button, it works,
> > but also forwards to this same page,
> > instead of to the regular start page.
> 
> If you add a cancel button, you can handle the cancel event by checking
> isCancelled(request) so you can decide where forward to.
> Simplified:
> 
> if (isCancelled(request))
>         return mapping.findForward("cancel");
> 
> And define a forward named 'cancel'. If you do so you will be forwarded to
> this page.
> 
> Tib
> 
> --
> 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: different forwards from form

Posted by Marcus Biel <Ma...@bmw.de>.
No, my problem is different!

A simple reset would be easy -
but I want to hit reset when I am editing -
when editing and I hit submit, it calls an action,
that updates the record,
then it forwards to a new jsp, that's says:
"Your record has been edited successfully."

Now if I add a cancel button, it works,
but also forwards to this same page,
instead of to the regular start page.

marcus

gemes@regens.hu schrieb:
> 
> 2002. december 3. 09:37 dátummal Marcus Biel ezt írtad:
> > I got a form for editing a data records.
> > When I hit "cancel" I want to display an other page then when I hit
> > submit.
> >
> > How to do this ?
> 
> Read the docs! Take a look at the struts-example.war, or read the struts-tips
> at husted.com:
> 
> http://www.husted.com/struts/tips/014.html
> 
> Hth,
> 
> Tib
> 
> --
> 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: different forwards from form

Posted by Andrew Hill <an...@gridnode.com>.
One way is to do a forward from within the action. Ie: both buttons still
submit to same action to start with, but if its detected that it was a
cancel then the action immediately returns an ActionForward that forwards
the request on to the action/jsp/etc... that you want to go to if they hit
cancel.

-----Original Message-----
From: Marcus Biel [mailto:Marcus.Biel@bmw.de]
Sent: Tuesday, December 03, 2002 16:37
To: struts-user@jakarta.apache.org
Subject: different forwards from form


I got a form for editing a data records.
When I hit "cancel" I want to display an other page then when I hit
submit.

How to do this ?


thx,

marcus

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