struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From holod <serega.shey...@gmail.com>
Subject result type="redirectAction" with parameter which is int[]
Date Mon, 02 Mar 2009 15:26:40 GMT

Good day. I have a question"
Please, see fragment from struts.xml:

<action name="SavePersonInSession"
class="ibs.pperson.web.action.WorkWithSession" method="store">
           		<result name="success" type="redirectAction">
	        		Search
			        /
			        ${id}
		        </result>
        </action>

id is an int[]. SavePersonInSession accepts id well (I see it in log), but
Search can't receive it.

I'll explain:
1. User sends two id to SavePersonInSession. They are accepted as int[] id.
For example these id were 4 and 9.
2. I'm redirecting user to other action. I'm using ${id} to pass parameter
to Search
3. int id[] in Search is null. I've inspected queryString which I can get
this way:
queryString = ServletActionContext.getRequest().getQueryString(); 
And I got the answer, queryString = "4, 9". 

So ${id} presents my int[] array as String with the help of ognl stuff. That
is why Search can't parse id as int[] array.

I've tried to make a stupid trick:

if(id!=null && id.length>0){
			StringBuffer sb = new StringBuffer();
			for(int i=0; i<id.length;i++){
				sb.append(id[i]).append("&").append("id=");
			}
			idAsParameter = sb.delete(sb.length()-4, sb.length()).toString();
		}
and

<action name="SavePersonInSession"
class="ibs.pperson.web.action.WorkWithSession" method="store">
           		<result name="success" type="redirectAction">
	        		Search
			        /
			        ${idAsParameter}
		        </result>
        </action>
But struts makes url-encoding of my prepared query String :(((
I get
id=4%26id%3D9
instead of 
id=4&id=9

Please, tell me, is there any possibility to keep type of redirected
parameter?

-- 
View this message in context: http://www.nabble.com/result-type%3D%22redirectAction%22-with-parameter-which-is-int---tp22290214p22290214.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message