You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Erik Weber <er...@mindspring.com> on 2004/07/15 20:13:34 UTC

Re: Parameterizing form JSPs with tags


Rick Reumann wrote:

> On Mon, 12 Jul 2004 10:31:29 -0400, Erik Weber 
> <er...@mindspring.com>  wrote:
>
> (speaking of "add" form versus "update" form that are similar but not 
> exactly the same . . )  I'd reuse the same form, even if it means 
> some  JSTL <c:choose><c:when test="${userAction == 'update'}>...</..>
> I find it ends up being easier in the long run.


I need a little help understanding how to do this.

I am parameterizing the handling of a few actions in a single action 
class, and I decided to go with a single, shared form JSP, because it's 
a big form. So I need to use a switch of some type to set the "action" 
parameter of my html:form tag depending on the current usecase, and also 
to conditionally render or omit a couple of fields of the form.

For example, if the action that led to the form page is 
"/usecase/viewadd" then the user gets a blank form, and I need to set 
the form action parameter to be "/usecase/add" If the action was 
"/usecase/viewedit" instead, then the user gets a prepopulated form, and 
I need to set the form action parameter to be "/usecase/save". You get 
the idea. The part I need help with is building the JSP switch.

How does the JSP tag access the current "use case", or command 
parameter? Do you have to manually set request attributes? What object 
does "userAction" refer to in the above example?

Also, is there a Struts tag that will do the same thing? I don't have JSTL.

Thanks,
Erik



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