You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mael Le Guével <ma...@yahoo.fr> on 2014/05/30 10:38:40 UTC
Multiple parameter names
Hi,
Given the following action:
public class MyAction extends ActionSupport {
private String myParam;
public String getMyParam() {
return myParam;
}
public void setMyParam(String myParam) {
this.myParam = myParam;
}
}
I am able to pass a "myParam" parameter to this action.
For instance:
http://url-to-my-app/myAction.action?myParam=aValue
(Yes I know, everyone knows that :))
What I would like to do is having multiple parameter names that would
map to "myParam". For instance the following URL would also set the
value of "myParam" to "aValue":
http://url-to-my-app/myAction.action?anotherName=aValue
As it can be the source of multiple problems, I guess that struts does
not allow to do this?
So, what would be the best way to achieve it? Extending the parameters
interceptor?
Thanks.
Mael.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Multiple parameter names
Posted by Mael Le Guével <le...@gmail.com>.
Thanks Marc, I think it's the simplest solution.
2014-05-30 18:36 GMT+02:00 Marc Michele <de...@tiv-consulting.de>:
> This is simple:
>
> public class MyAction extends ActionSupport {
> private String myParam;
>
> public String getMyParam() {
> return myParam;
> }
>
> public void setMyParam(String myParam) {
> this.myParam = myParam;
> }
>
> public void setAnotherName(String myParam) {
> this.myParam = myParam;
> }
> }
>
> The only problem is to set it at the same time, in same request, so you
> have to make a decision with parameter is the winner.
>
> Greets
> Marc
>
>
> Am 30.05.2014 10:38, schrieb Mael Le Guével:
>> Hi,
>> Given the following action:
>>
>> public class MyAction extends ActionSupport {
>> private String myParam;
>>
>> public String getMyParam() {
>> return myParam;
>> }
>>
>> public void setMyParam(String myParam) {
>> this.myParam = myParam;
>> }
>> }
>>
>> I am able to pass a "myParam" parameter to this action.
>> For instance:
>> http://url-to-my-app/myAction.action?myParam=aValue
>> (Yes I know, everyone knows that :))
>>
>> What I would like to do is having multiple parameter names that would
>> map to "myParam". For instance the following URL would also set the
>> value of "myParam" to "aValue":
>> http://url-to-my-app/myAction.action?anotherName=aValue
>>
>> As it can be the source of multiple problems, I guess that struts does
>> not allow to do this?
>> So, what would be the best way to achieve it? Extending the parameters
>> interceptor?
>>
>> Thanks.
>>
>> Mael.
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Multiple parameter names
Posted by Marc Michele <de...@tiv-consulting.de>.
This is simple:
public class MyAction extends ActionSupport {
private String myParam;
public String getMyParam() {
return myParam;
}
public void setMyParam(String myParam) {
this.myParam = myParam;
}
public void setAnotherName(String myParam) {
this.myParam = myParam;
}
}
The only problem is to set it at the same time, in same request, so you
have to make a decision with parameter is the winner.
Greets
Marc
Am 30.05.2014 10:38, schrieb Mael Le Guével:
> Hi,
> Given the following action:
>
> public class MyAction extends ActionSupport {
> private String myParam;
>
> public String getMyParam() {
> return myParam;
> }
>
> public void setMyParam(String myParam) {
> this.myParam = myParam;
> }
> }
>
> I am able to pass a "myParam" parameter to this action.
> For instance:
> http://url-to-my-app/myAction.action?myParam=aValue
> (Yes I know, everyone knows that :))
>
> What I would like to do is having multiple parameter names that would
> map to "myParam". For instance the following URL would also set the
> value of "myParam" to "aValue":
> http://url-to-my-app/myAction.action?anotherName=aValue
>
> As it can be the source of multiple problems, I guess that struts does
> not allow to do this?
> So, what would be the best way to achieve it? Extending the parameters
> interceptor?
>
> Thanks.
>
> Mael.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Multiple parameter names
Posted by Chris Pratt <th...@gmail.com>.
You could have your Action implement ParameterAware then handle the
parameter map yourself.
(*Chris*)
On Fri, May 30, 2014 at 2:15 AM, Yaragalla Muralidhar <
yaragallamurali@gmail.com> wrote:
> I think that is not possible.
>
> *Thanks and Regards,*
> Muralidhar Yaragalla.
>
> *http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
>
>
> On Fri, May 30, 2014 at 2:08 PM, Mael Le Guével <ma...@yahoo.fr>
> wrote:
>
> > Hi,
> > Given the following action:
> >
> > public class MyAction extends ActionSupport {
> > private String myParam;
> >
> > public String getMyParam() {
> > return myParam;
> > }
> >
> > public void setMyParam(String myParam) {
> > this.myParam = myParam;
> > }
> > }
> >
> > I am able to pass a "myParam" parameter to this action.
> > For instance:
> > http://url-to-my-app/myAction.action?myParam=aValue
> > (Yes I know, everyone knows that :))
> >
> > What I would like to do is having multiple parameter names that would
> > map to "myParam". For instance the following URL would also set the
> > value of "myParam" to "aValue":
> > http://url-to-my-app/myAction.action?anotherName=aValue
> >
> > As it can be the source of multiple problems, I guess that struts does
> > not allow to do this?
> > So, what would be the best way to achieve it? Extending the parameters
> > interceptor?
> >
> > Thanks.
> >
> > Mael.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
Re: Multiple parameter names
Posted by Yaragalla Muralidhar <ya...@gmail.com>.
I think that is not possible.
*Thanks and Regards,*
Muralidhar Yaragalla.
*http://yaragalla.blogspot.in/ <http://yaragalla.blogspot.in/>*
On Fri, May 30, 2014 at 2:08 PM, Mael Le Guével <ma...@yahoo.fr>
wrote:
> Hi,
> Given the following action:
>
> public class MyAction extends ActionSupport {
> private String myParam;
>
> public String getMyParam() {
> return myParam;
> }
>
> public void setMyParam(String myParam) {
> this.myParam = myParam;
> }
> }
>
> I am able to pass a "myParam" parameter to this action.
> For instance:
> http://url-to-my-app/myAction.action?myParam=aValue
> (Yes I know, everyone knows that :))
>
> What I would like to do is having multiple parameter names that would
> map to "myParam". For instance the following URL would also set the
> value of "myParam" to "aValue":
> http://url-to-my-app/myAction.action?anotherName=aValue
>
> As it can be the source of multiple problems, I guess that struts does
> not allow to do this?
> So, what would be the best way to achieve it? Extending the parameters
> interceptor?
>
> Thanks.
>
> Mael.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>