1

I have a Primefaces commandLink which I have used it many times in my application. Now I want to store it's URL in a bundle.property file to make it maintainable. which xhtml attribute should I use to redirect it?

I already tried things like:

actionListener="#{bundle.Myurl}"
action="#{bundle.Myurl}" 
target="#{bundle.Myurl}"

Myurl also contains this: sales/index.xhtml

but none of them run as I want!

1 Answers1

2

You shouldn't use command links for page-to-page navigation in first place. Use a normal link.

If you have an internal URL / (implicit) navigation outcome:

<h:link value="link" outcome="#{bundle.Myurl}" />

Or if you have an external URL:

<h:outputLink value="#{bundle.Myurl}">link</h:outputLink>

Your attempts failed because the actionListener and action attributes are declared as MethodExpression attributes, meaning that any EL will be interpreted as a bean action method. The target attribute has an entirely different meaning, which is exactly the same as the generated HTML <a> element has.

See also:

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