You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kra, Aime yao (TEK System)" <ak...@allstate.com> on 2009/03/10 19:46:25 UTC

HOWTO implement multiple submit buttons with type = image.

Hello

I am implementing a form with two buttons CANCEL and REGISTER.

I have followed the sample provided in the cookbook http://struts.apache.org/2.x/docs/multiple-submit-buttons.html
This works fine if type="submit" 

---------------------------------------------------------------------------------------
<s:submit type="submit" src="../images/button/cancel_bkgd.jpg"
 name="buttonName" value="Cancel" /> <s:submit type="submit"
 src="../images/button/register_bkgd.jpg" name="buttonName"
 value="Register" /> <br>
---------------------------------------------------------------------------------------

For type="image" I receive the following error
[3/10/09 9:05:49:726 EDT] 00000036 ParametersInt E com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'buttonName.x' on 'class com.ars.claims.view.action.CreateProviderOwner: Error setting expression 'buttonName.x' with value '[Ljava.lang.String;@7cf47cf4'


In struts 1, we can use an ImagebuttonBean type to provide the getter/setter in the action class. (See http://www.java-samples.com/showtutorial.php?tutorialid=518)

I can't see ImagebuttonBean in struts 2.
Can someone know how to implement these two image type submit buttons and 
What should be the code in the Execute() method of the Action class to know the pressed button ?

Any Help will be appreciated.


Thanks

Aimé Kra



RE: HOWTO implement multiple submit buttons with type = image.

Posted by Martin Gainty <mg...@hotmail.com>.
(other than political) are there reasons why you would'nt want to stick with type='submit' 
and let the <Action> back end handle processing of RequestParameters/FormFields/SessionValues
?
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Subject: HOWTO implement multiple submit buttons with type = image.
> Date: Tue, 10 Mar 2009 13:46:25 -0500
> From: akr47@allstate.com
> To: user@struts.apache.org
> 
> Hello
> 
> I am implementing a form with two buttons CANCEL and REGISTER.
> 
> I have followed the sample provided in the cookbook http://struts.apache.org/2.x/docs/multiple-submit-buttons.html
> This works fine if type="submit" 
> 
> ---------------------------------------------------------------------------------------
> <s:submit type="submit" src="../images/button/cancel_bkgd.jpg"
>  name="buttonName" value="Cancel" /> <s:submit type="submit"
>  src="../images/button/register_bkgd.jpg" name="buttonName"
>  value="Register" /> <br>
> ---------------------------------------------------------------------------------------
> 
> For type="image" I receive the following error
> [3/10/09 9:05:49:726 EDT] 00000036 ParametersInt E com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'buttonName.x' on 'class com.ars.claims.view.action.CreateProviderOwner: Error setting expression 'buttonName.x' with value '[Ljava.lang.String;@7cf47cf4'
> 
> 
> In struts 1, we can use an ImagebuttonBean type to provide the getter/setter in the action class. (See http://www.java-samples.com/showtutorial.php?tutorialid=518)
> 
> I can't see ImagebuttonBean in struts 2.
> Can someone know how to implement these two image type submit buttons and 
> What should be the code in the Execute() method of the Action class to know the pressed button ?
> 
> Any Help will be appreciated.
> 
> 
> Thanks
> 
> Aimé Kra
> 
> 

_________________________________________________________________
Windows Live™: Life without walls.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009

Re: HOWTO implement multiple submit buttons with type = image.

Posted by Jim Kiley <jh...@summa-tech.com>.
With image type submits, an "x" and "y" value are usually submitted (so that
if the button is an imagemap, the server knows where the user clicked).
 Struts is complaining that you don't have any fields that accept an "x" or
a "y" field on your action class.
jk

On Tue, Mar 10, 2009 at 2:46 PM, Kra, Aime yao (TEK System) <
akr47@allstate.com> wrote:

> Hello
>
> I am implementing a form with two buttons CANCEL and REGISTER.
>
> I have followed the sample provided in the cookbook
> http://struts.apache.org/2.x/docs/multiple-submit-buttons.html
> This works fine if type="submit"
>
>
> ---------------------------------------------------------------------------------------
> <s:submit type="submit" src="../images/button/cancel_bkgd.jpg"
>  name="buttonName" value="Cancel" /> <s:submit type="submit"
>  src="../images/button/register_bkgd.jpg" name="buttonName"
>  value="Register" /> <br>
>
> ---------------------------------------------------------------------------------------
>
> For type="image" I receive the following error
> [3/10/09 9:05:49:726 EDT] 00000036 ParametersInt E
> com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters
> ParametersInterceptor - [setParameters]: Unexpected Exception caught setting
> 'buttonName.x' on 'class com.ars.claims.view.action.CreateProviderOwner:
> Error setting expression 'buttonName.x' with value
> '[Ljava.lang.String;@7cf47cf4'
>
>
> In struts 1, we can use an ImagebuttonBean type to provide the
> getter/setter in the action class. (See
> http://www.java-samples.com/showtutorial.php?tutorialid=518)
>
> I can't see ImagebuttonBean in struts 2.
> Can someone know how to implement these two image type submit buttons and
> What should be the code in the Execute() method of the Action class to know
> the pressed button ?
>
> Any Help will be appreciated.
>
>
> Thanks
>
> Aimé Kra
>
>
>


-- 
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com