You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anna Simbirtsev <as...@gmail.com> on 2007/08/28 22:17:00 UTC
2 jsp files using the same form
Hello
I have 2 screens that use the same form. The form class has a validate
function. To distinguish which screen(jsp file) is using the form I do the
following in jsp files:
<% session.setAttribute("page", "add") %>
<% session.setAttribute("page", "add_2") %>
Then in the form class I grab that value and figure out what values to
validate.
Is it a good way to do it?
Re: 2 jsp files using the same form
Posted by Anna Simbirtsev <as...@gmail.com>.
This is how the submit button is defined:
<var:varimage srcKey="update.button.image" altKey="update.button.image.alt"
border="0"/>
varimage is defined as a tag in app.tld file:
<tag>
<name>varimage</name>
<tagclass>/struts/taglib/varTag</tagclass>
<attribute>
<name>accesskey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>alt</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>altKey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
In its definition, I can set the value.
But how do I retrieve the value in the form class?
public ActionErrors validate(ActionMapping mapping,HttpServletRequest
request)
{
Those are the only parameters I receive in the validate function.
Thank you
On 8/28/07, Oleg Mikheev <mi...@bigfoot.com> wrote:
>
> Anna Simbirtsev wrote:
> > Hello
> > I have 2 screens that use the same form. The form class has a validate
> > function. To distinguish which screen(jsp file) is using the form I do
> the
> > following in jsp files:
> >
> > <% session.setAttribute("page", "add") %>
> > <% session.setAttribute("page", "add_2") %>
> >
> > Then in the form class I grab that value and figure out what values to
> > validate.
> > Is it a good way to do it?
>
>
> You should distinguish between two forms by passing different
> values of submit buttons (in my opinion)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Anna Simbirtsev
(416) 729-7331
Re: 2 jsp files using the same form
Posted by Oleg Mikheev <mi...@bigfoot.com>.
Anna Simbirtsev wrote:
> Hello
> I have 2 screens that use the same form. The form class has a validate
> function. To distinguish which screen(jsp file) is using the form I do the
> following in jsp files:
>
> <% session.setAttribute("page", "add") %>
> <% session.setAttribute("page", "add_2") %>
>
> Then in the form class I grab that value and figure out what values to
> validate.
> Is it a good way to do it?
You should distinguish between two forms by passing different
values of submit buttons (in my opinion)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org