You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pat Quinn <pa...@hotmail.com> on 2002/12/09 12:35:08 UTC

Multiple Submit Buttons + Internationalisation

Multiple Submit Buttons + Internationalisation

I have a jsp with three submit buttons (update, delete etc..) each with a 
value as loaded from the resource bundle:

<input type="submit" name="Submit" value="<bean:message key='label.update'/>


In my action class i do the following to identify which button has submitted 
the form:

if ("Update".equalsIgnoreCase(pRequest.getParameter("Submit"))) {
	//Process my update
}

This works fine when viewed from a browser with an English locale, if the 
locale is anything different it fails.
Its obvious why this doesn't work as i've hardcode the action class to one 
locale (English).

Can someone please suggest a different approach?

Cheers





_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus


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


Re: Multiple Submit Buttons + Internationalisation

Posted by "V. Cekvenich" <vi...@users.sourceforge.net>.
+1

Gemes Tibor wrote:
> 2002. december 9. 13:48 dátummal John D Hume ezt írtad:
> 
>>You could probably compare pRequest.getParameter("Submit") against the
>>internationalized string, though it might be better to go a way that won't
>>make you dependent on those labels.  You could flip it around and decide
>>based on the Name of the submit button.  Something like:
> 
> 
> LookupDispatchAction?
> 
> http://husted.com/struts/tips/003.html
> 
> Hth,
> 
> Tib




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


RE: Multiple Submit Buttons + Internationalisation

Posted by Justin Ashworth <ju...@ashworth.org>.
Thank you - that clears it all up.  Thanks for the correction too. :)

> -----Original Message-----
> From: Gemes Tibor [mailto:gemes@regens.hu] 
> Sent: Monday, December 09, 2002 9:08 AM
> To: Struts Users Mailing List
> Subject: Re: Multiple Submit Buttons + Internationalisation
> 
> 
> 2002. december 9. 14:53 dátummal Justin Ashworth ezt írtad:
> > On a related topic...does the HTTP standard specify that 
> for a set of 
> > submit buttons with the same name, only the one that's 
> pressed will be 
> > sent with the request?
> 
> It is html not http. 
> 
> Check the successsful controls in html: 
> http://www.w3.org/TR/html401/interact/forms.ht> ml#h-17.13.2
> 
> Hth,
> 
> Tib
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-> unsubscribe@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: Multiple Submit Buttons + Internationalisation

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 9. 14:53 dátummal Justin Ashworth ezt írtad:
> On a related topic...does the HTTP standard specify that for a set of
> submit buttons with the same name, only the one that's pressed will be
> sent with the request?  

It is html not http. 

Check the successsful controls in html:
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2

Hth,

Tib


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


RE: Multiple Submit Buttons + Internationalisation

Posted by Justin Ashworth <ju...@ashworth.org>.
On a related topic...does the HTTP standard specify that for a set of
submit buttons with the same name, only the one that's pressed will be
sent with the request?  I seem to remember in earlier days that this
wasn't always guaranteed, and therefore I generally make a rule to avoid
it.  Is my memory fuzzy and this always worked, or is this submit button
functionality relying on the HTTP implementation of certain browsers,
but not necessarily all of them.

Thanks,

Justin

> -----Original Message-----
> From: Gemes Tibor [mailto:gemes@regens.hu] 
> Sent: Monday, December 09, 2002 7:53 AM
> To: Struts Users Mailing List
> Subject: Re: Multiple Submit Buttons + Internationalisation
> 
> 
> 2002. december 9. 13:48 dátummal John D Hume ezt írtad:
> > You could probably compare pRequest.getParameter("Submit") 
> against the 
> > internationalized string, though it might be better to go a 
> way that 
> > won't make you dependent on those labels.  You could flip it around 
> > and decide based on the Name of the submit button.  Something like:
> 
> LookupDispatchAction?
> 
http://husted.com/struts/tips/003.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: Multiple Submit Buttons + Internationalisation

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 9. 13:48 dátummal John D Hume ezt írtad:
> You could probably compare pRequest.getParameter("Submit") against the
> internationalized string, though it might be better to go a way that won't
> make you dependent on those labels.  You could flip it around and decide
> based on the Name of the submit button.  Something like:

LookupDispatchAction?

http://husted.com/struts/tips/003.html

Hth,

Tib

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


Re: Multiple Submit Buttons + Internationalisation

Posted by John D Hume <du...@hotmail.com>.
You could probably compare pRequest.getParameter("Submit") against the
internationalized string, though it might be better to go a way that won't
make you dependent on those labels.  You could flip it around and decide
based on the Name of the submit button.  Something like:

if ( pRequest.getParameter("update_submit") != null ) {
    // do an update
} else if ( pRequest.getParameter("delete_submit") != null ) {
    // do a delete
}

-john.

----- Original Message -----
From: "Pat Quinn" <pa...@hotmail.com>
To: <st...@jakarta.apache.org>
Sent: Monday, December 09, 2002 6:35 AM
Subject: Multiple Submit Buttons + Internationalisation


> Multiple Submit Buttons + Internationalisation
>
> I have a jsp with three submit buttons (update, delete etc..) each with a
> value as loaded from the resource bundle:
>
> <input type="submit" name="Submit" value="<bean:message
key='label.update'/>
>
>
> In my action class i do the following to identify which button has
submitted
> the form:
>
> if ("Update".equalsIgnoreCase(pRequest.getParameter("Submit"))) {
> //Process my update
> }
>
> This works fine when viewed from a browser with an English locale, if the
> locale is anything different it fails.
> Its obvious why this doesn't work as i've hardcode the action class to one
> locale (English).
>
> Can someone please suggest a different approach?
>
> Cheers
>
>
>
>
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
>
>
> --
> 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>