1

I created a template with commandLink:

<div class="pull-right" style="padding: 5px">
    <h:commandLink action="#{urlVoltar}" styleClass="btn btn-sm btn-danger"><span class="fa fa-reply"></span></h:commandLink>
</div>

And use it in main page:

<ui:include src="/sistema/commonBotoesExportar.xhtml">
    <ui:param name="urlVoltar" value="\indexNovo.xhtml" />
</ui:include>

So when I click on button, I got this exception:

javax.faces.el.EvaluationException: javax.el.ELException: //C:/project/WebContent/sistema/commonBotoesExportar.xhtml @13,154 action="#{urlVoltar}": Identity 'urlVoltar' does not reference a MethodExpression instance, returned type: java.lang.String
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
...

What I need to do to solve this issue. Thx

Fábio Almeida
  • 276
  • 3
  • 11

1 Answers1

4

It does in first place not make any sense to use <h:commandLink> for page-to-page navigation. It would only destroy the SEO and UX of the webpage.

Just use <h:link>.

<h:link outcome="#{urlVoltar}" ...>

See also:


If you would really like to use a <h:commandXxx> component in this construct, then head to this duplicate question: Dynamic ui include and commandButton.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555