You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by M�ris Orbid�ns <M....@datapro.lv> on 2001/12/17 15:45:40 UTC

how to detect which form is being posted ?



>It's common to have code in your action class that
>detects whether it was started from it's form being
>posted or elsewhere. (lots of posts about how to test
>for this). 


How to do it ?

>If coming from elsewhere you just ignore
>whatever values are in the formbean.
>Does this help?

thanx a lot


Maris


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


Re: how to detect which form is being posted ?

Posted by Keith Bacon <ke...@yahoo.com>.
Here it is - this is my way - a design pattern copied
from non-strus programs.

==========================
in your jsp
<html:hidden property="formName"
value="Form-EditUser"/>
===========================
in your action class
	EditUserForm thisForm = (EditUserForm) form;
	String formName = thisForm.getFormName();

	if (formName == null ||
!formName.equals("Form-EditUser")) {
		// Came from forward from another form
                // Display default form.
        } else { 
             // came from our form validate it.
        }
=====================
Keith.
--- M�ris Orbid�ns <M....@datapro.lv> wrote:
> 
> 
> 
> >It's common to have code in your action class that
> >detects whether it was started from it's form being
> >posted or elsewhere. (lots of posts about how to
> test
> >for this). 
> 
> 
> How to do it ?
> 
> >If coming from elsewhere you just ignore
> >whatever values are in the formbean.
> >Does this help?
> 
> thanx a lot
> 
> 
> Maris
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

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