Passing multiple parameters via a <s:url/> Struts2 tag
17,528
You may disable the URL escape behavior using escapeAmp="false"
attribute. By default, this is enabled, so URL parameter &
will render &
. This will cause a problem on reading the parameter value with parameter name.
- You may need to read the parameter,
request.getParameter("amp;pageNumber_hidden")
- You have stop escaping the entities by adding attribute
escapeAmp
and set the value false as part of the<s:url>
tag (Recommended)
<s:url id="loadReportsForAPageInitial"
value="/loadReportsForAPage.action"
escapeAmp="false">
Author by
SJ.Jafari
Updated on June 14, 2022Comments
-
SJ.Jafari almost 2 years
This code should send two parameters to the struts action:
<s:url id="loadReportsForAPageInitial" value="/loadReportsForAPage.action" > <s:param name="reportsCount_hidden" value="3"></s:param> <s:param name="pageNumber_hidden" value="1"></s:param> </s:url> <sj:div href="%{loadReportsForAPageInitial}"> </sj:div>
the problem is only the first parameter's value is sent to the struts action and the second one is null! I changed the place of two parameters and again only the first one was fine.
Is it possible to pass more than one parameter via a s:url tag?
UPDATE
this is how the url tag is rendered:
<script type='text/javascript'> jQuery(document).ready(function () { var options_div_1179027906 = {}; options_div_1179027906.jqueryaction = "container"; options_div_1179027906.id = "div_1179027906"; options_div_1179027906.href = "/FAP/loadReportsForAPage.action"; options_div_1179027906.hrefparameter = "reportsCount_hidden=3&pageNumber_hidden=1"; jQuery.struts2_jquery.bind(jQuery('#div_1179027906'),options_div_1179027906); });