问题描述
param
标签在我使用时提供null
值
param
tag giving null
value when i used
System.out.println("Before"+request.getParameter("imeino"));
<% session.setAttribute("imeino1", request.getParameter("imeino1"));
System.out.print("BBBBB^^@@"+session.getAttribute("imeino"));
%>
<div style="margin-left: 50px; margin-bottom: 10px;">
</div>
<div class="grid" align="center" style="margin-top: 30px">
<ws:url id="remoteurl" action='userimageGrid' escapeAmp="false">
<ws:param name="imeino" value="66666666666"></ws:param>
</ws:url>
推荐答案
使用redirect
或redirectAction
结果类型时,参数会丢失.要保留请求参数,您应该使用dispatcher
结果类型.这是默认的结果类型,如果您错过了result
标记的type
属性,将使用此结果类型
Parameters are getting lost when you use redirect
or redirectAction
result type. To retain request parameters you should use dispatcher
result type. This is default result type, and it will be used if you miss type
attribute of the result
tag, like this
<result>/ThankYou.jsp</result>
为什么param
标记赋予null
值.因为该值在添加到URL之前已由OGNL转换为整数值,并且抛出NumberFormatException
,因为不能存在这样的整数.该值超过Java中整数值的最大值.您应该在param
标记中使用字符串值,例如
Why param
tag giving null
value. Because the value is converted by OGNL to integer value before adding it to the URL and it throws NumberFormatException
because no such integer can exist. The value exceeds the maximum in Java for integer value. You should use string value in param
tag, like this
<s:url var="remoteurl" action='userimageGrid' escapeAmp="false">
<s:param name="imeino" value="'66666666666'"/>
</s:url>
<s:a href="%{#remoteurl}">Call</s:a>
这篇关于参数标记为空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!