Die meistgefragten Interviewfragen und Antworten sowie Online-Tests
Lernplattform fur Interviewvorbereitung, Online-Tests, Tutorials und Live-Ubungen

Baue deine Fahigkeiten mit fokussierten Lernpfaden, Probetests und interviewreifem Inhalt aus.

WithoutBook vereint themenbezogene Interviewfragen, Online-Ubungstests, Tutorials und Vergleichsleitfaden in einem responsiven Lernbereich.

Interview vorbereiten

Probeprufungen

Als Startseite festlegen

Diese Seite als Lesezeichen speichern

E-Mail-Adresse abonnieren

JSF Interviewfragen und Antworten

Verwandte Vergleiche

Verwandte Vergleiche

JSF vs JSPJSF 1.2 vs JSF 2.0JSF 2.0 vs JSF 2.1
Struts vs JSF

Frage 11. How to pass a parameter to the JSF application using the URL string?

if you have the following URL: http://your_server/your_app/product.jsf?id=777, you access the passing parameter id with the following lines of java code:

FacesContext fc = FacesContext.getCurrentInstance();
String id = (String) fc.getExternalContext().getRequestParameterMap().get("id");
From the page, you can access the same parameter using the predefined variable with name param. For example,

<h:outputText value="#{param['id']}" />
Note: You have to call the jsf page directly and using the servlet mapping.

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 12. How to add context path to URL for outputLink?

Current JSF implementation does not add the context path for outputLink if the defined path starts with '/'. To correct this problem use #{facesContext.externalContext.requestContextPath} prefix at the beginning of the outputLink value attribute. For For Example:

<h:outputLink value=”#{facesContext.externalContext.requestContextPath}/myPage.faces”> 



Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 13. How to get current page URL from backing bean?

You can get a reference to the HTTP request object via FacesContext like this:

FacesContext fc = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest();

and then use the normal request methods to obtain path information. Alternatively,

context.getViewRoot().getViewId();
will return you the name of the current JSP (JSF view IDs are basically just JSP path names).

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 14. How to access web.xml init parameters from java code?

You can get it using externalContext getInitParameter method. For example, if you have:

<context-param>
<param-name>connectionString</param-name>
<param-value>jdbc:oracle:thin:scott/tiger@cartman:1521:O901DB</param-value>
</context-param>
You can access this connection string with:

FacesContext fc = FacesContext.getCurrentInstance();
String connection = fc.getExternalContext().getInitParameter("connectionString");

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 15. How to access web.xml init parameters from jsp page?

You can get it using initParam pre-defined JSF EL valiable.

For example, if you have:

<context-param>
<param-name>productId</param-name>
<param-value>2004Q4</param-value>
</context-param>
You can access this parameter with #{initParam['productId']} . For example:

Product Id: <h:outputText value="#{initParam['productId']}"/>

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Am hilfreichsten laut Nutzern:

Copyright © 2026, WithoutBook.