[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: Struts 2.5 ParameterAware and HttpParametersAware
From:       Lukasz Lenart <lukaszlenart () apache ! org>
Date:       2017-09-19 6:30:56
Message-ID: CAMopvkPYA=ZSDczQbSrP1a8-ydvVj5rYjC+wmA8yeD+9zhTdwg () mail ! gmail ! com
[Download RAW message or body]

Why do you do this in action? This a perfect case for an Interceptor.


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2017-09-16 11:53 GMT+02:00 Alireza Fattahi <afattahi@yahoo.com.invalid>:
> we are using struts 2.3.xx after upgrade to struts 2.5.12 we found that the \
> ParameterAware is deprecated and we must use HttpParametersAware. 
> There is an action class which extends ParameterAware and change some parameters \
>                 before action (It remove input masks for example removes , from \
>                 123,456,789) :
> --------------------public class Sample extends ActionSupport implements
> ModelDriven<SampleVO>,ParameterAware {
> 
> 
> @Override
> public void setParameters(Map<String, String[]> parameters) {
> for (String[] values : parameters.values()) {
> for (int i = 0; i < values.length; i++) {
> values[i] = Mask.removeMask(values[i]);
> }
> }
> }
> 
> }
> ---------------------------
> 
> We tried to do this with new HttpParametersAware and some thing like:
> -------------------
> for (Entry<String, Parameter> entry : parameters.entrySet()) {
> String key = entry.getKey();
> Parameter newParam =  new Parameter.Request( key, \
> entry.getValue().getValue().replaceAll(",", "")); 
> }
> ----------------
> 
> But I face the error
> HttpParameters are immutable, you cannot put value directly! Can we change \
> parameters like we used to do it in struts 2.3.x. how ?! 
> 
> ~Regards,
> ~~Alireza Fattahi

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic