struts2中redirectAction方式 重定向带参数/中文参数乱码

(1)重定向带参数

第一种:amp;代替;

<result name="success" type="redirectAction">
       <param name="actionName">cncpeVulnerabilityUpload.action?a=${a}&amp;b=${b}</param>
</result>

第二种:

<result name="success" type="redirectAction">
        <param name="actionName">cncpeVulnerabilityUpload.action</param><!--action名称-->
        <param name="vulnId">${#request.vulnId}</param><!--参数-->
        <param name="vulnType">${#request.vulnType}</param>
        <param name="encode">true</param>
</result>

(2)乱码问题:

配置文件添加<param name="encode">true</param>

请求

之前 :request.put("description", URLEncoder.encode(description, "UTF-8"));

之后:URLDecoder.decode(vulnDescript, "UTF-8")

 <result name="success" type="redirectAction">
<param name="actionName">cncpeVulnerabilityUpload.action</param><!--action名称-->
<param name="vulnId">${#request.vulnId}</param><!--参数-->
<param name="vulnType">${#request.vulnType}</param>
<param name="encode">true</param>
</result>

你可能感兴趣的:(struts2中redirectAction方式 重定向带参数/中文参数乱码)