JSF 2 - How can I get a context-param value from web.xml usi

Use JQuery at the front end

JSF 2 - How can I get a context-param value from web.xml usi

Postby haretu » Tue Mar 19, 2013 4:10 pm

Code: Select all
<web-app>
    <context-param>
        <param-name>myconstantkey</param-name>
        <param-value>some string value</param-value>
    </context-param>
</web-app>


Getting these values from inside a backing bean is easy enough:

Code: Select all
FacesContext ctx = FacesContext.getCurrentInstance();
String myConstantValue =
    ctx.getExternalContext().getInitParameter("myconstantkey");


in jsf front page
Code: Select all
<h:outputText value="#{initParam['myconstantkey']}" />
haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to Java Server Faces(JSF)

Who is online

Users browsing this forum: No registered users and 1 guest

cron