The reference to entity "preinfo" must end with the ';'delimiter.

来源:互联网 发布:交大软件工程硕士 在职 编辑:程序博客网 时间:2024/05/28 20:19
struts2redirect-action 传递 参数 
 

  使用struts2框架,在提交一个请求后,将获取的数据对象再要生成一个序列号,为了防止刷新生成冗余序列号,就在请求处理完成后,直接重定向到显示该信息的action中:

<action name="enterpreinfo"class="preinfoBusinessAction" method="enterPreinfoSub">
  <result name="success"type="redirectAction">
    showpreinfo?preinfo.order_number=${preinfo.order_number}&amp;preinfo.company_name=${preinfo.company_name}
 </result>
 <result name="error"type="redirect">
 <paramname="location">/error.jsp</param>
 </result>
</action>
因为使用了redirectAction,所以要注意不能将showpreinf?preinfo.order_number=${preinfo.order_number}写成showpreinf.action?preinfo.order_number=${preinfo.order_number}

在这个配置文件里,多个参数的连接符使用了"&amp;",但XML的语法规范,应该使用"&amp;"代替"&",原理和HTML中的转义相同,开始没有注意,在struts分析配置文件时,总是报出这样的错误:

The reference to entity "preinfo" must end with the ';'delimiter.

?

进行上面说明的替换后,就正常了。

0 0