Note that there are some explanatory texts on larger screens.

plurals
  1. POh:outputText inside of href doesn't work in JSF 2.0
    text
    copied!<p>I'm migrating code from JSF 1.2 to JSF 2.0(deployed on JBoss 6.1). However, I am experiencing problem with using <code>h:outputText</code> inside of <code>href</code> attribute of <code>link</code> tag:</p> <pre><code>&lt;link rel='canonical' href='&lt;h:outputText value="#{resultPage.currentLink}" escape="false"/&gt;' /&gt; </code></pre> <p>I cannot just use </p> <pre><code>&lt;link rel='canonical' href="#{resultPage.currentLink}" /&gt; </code></pre> <p>because I need html escape attribute.</p> <p>I'm receiving the following exception:</p> <pre><code>javax.servlet.ServletException: Error Parsing /shoe/shoe2.xhtml: Error Traced[line: 23] The value of attribute "href" associated with an element type "link" must not contain the '&lt;' character. javax.faces.webapp.FacesServlet.service(FacesServlet.java:321) com.youandshoe.web.controller.EncoderFilter.doFilter(EncoderFilter.java:28) com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126) com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118) root cause javax.faces.view.facelets.FaceletException: Error Parsing /shoe/shoe2.xhtml: Error Traced[line: 23] The value of attribute "href" associated with an element type "link" must not contain the '&lt;' character. com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:390) com.sun.faces.facelets.compiler.SAXCompiler.doMetadataCompile(SAXCompiler.java:373) com.sun.faces.facelets.compiler.Compiler.metadataCompile(Compiler.java:128) com.sun.faces.facelets.impl.DefaultFaceletFactory.createMetadataFacelet(DefaultFaceletFactory.java:316) com.sun.faces.facelets.impl.DefaultFaceletFactory.access$200(DefaultFaceletFactory.java:89) com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:165) com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:164) com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:90) com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:86) com.sun.faces.util.ExpiringConcurrentCache$1.call(ExpiringConcurrentCache.java:95) java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) java.util.concurrent.FutureTask.run(Unknown Source) com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:110) com.sun.faces.facelets.impl.DefaultFaceletCache.getMetadataFacelet(DefaultFaceletCache.java:131) com.sun.faces.facelets.impl.DefaultFaceletCache.getMetadataFacelet(DefaultFaceletCache.java:58) com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:249) com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:198) com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:102) com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:223) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114) org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:97) javax.faces.webapp.FacesServlet.service(FacesServlet.java:308) com.youandshoe.web.controller.EncoderFilter.doFilter(EncoderFilter.java:28) com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:126) com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118) </code></pre> <p>However, the same code works fine in JSF 1.2, JBoss 5.1.</p> <p>Any ideas? Thanx!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload