The reference to entity "id" must end with the ';' delimiter
Posted on: 2013-12-01, Last modified: 2015-07-31, View: 4123

页面中的超链接如果带有两个以上参数,就需要使用'&'分割,但是在JSF项目中.xhtml页面中如果这样写就会报上面的异常:

严重: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.view.facelets.FaceletException: Error Parsing /module/index.xhtml: Error Traced[line: 15] The reference to entity "id" must end with the ';' delimiter.
    at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:417)
    at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:391)
    at com.sun.faces.facelets.compiler.Compiler.compile(Compiler.java:124)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:305)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.access$100(DefaultFaceletFactory.java:93)

原因是用于连接多个参数的'&'在HTML/XML中是一个特殊字符,不能够直接使用,解决方式使用'&'代替'&',特别的那个分号不能丢掉。

<h:link outcome="index.xhtml?module=company&amp;id=1">Company</h:link>

Go
Friend Links:
Sonft