0

I am making the url(for viewing specific customer) in my CustomerList.jsp as below where customer_message is an request attribute which is an array. when I inspect customer_message in CustomerList i see it array containing two Float values

var custURL="<s:url namespace="/customer action="view-customer" method="viewCustomer"/>?customer_message=<s:property value="#request['customer_message']"/>";

But when I get the request in view-customer action and I do request.getParameter("customer_message"), I see it containing only one value.

Am I doing some mistake in passing customer_message as array?

1 Answer 1

0

In Struts2 use <s:param> tag inside <s:url> tag to add parameters.

<s:url namespace="/customer" action="view-customer" method="viewCustomer">
  <s:param name="customer_message" value="#request['customer_message']"/>
</s:url>

From the <s:url> tag documentation:

You can use the <param> tag inside the body to provide additional request parameters. If the value of a param is an Array or an Iterable all the values will be added to the URL.

1
  • Thanks Aleks but how will i iterate over the array at receiving side is it like this <s:iterator var="message" value="#parameters['customer_message']" > <s:property value="#message"/> </s:iterator> Commented Feb 21, 2013 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.