Category: Java Server Faces

19 JSF Important Interview Questions

19 JSF Important Interview Questions: JSF(Java server faces) is component driven programming language which can be implemented with different faces like icefaces, acefaces, primefaces, richfaces etc. This can also be used with spring core and hibernate for ORM. Below are the few most important and repeated interview questions for JSF developers.   1. What are …

672 total views, no views today


[solved] uioutput cannot be resolved to a type JSF

[solved] uioutput cannot be resolved to a type JSF: Error meaning is you did not import the UIOutput in your bean/controller. So you have to import the below UIOutput package, “import javax.faces.component.UIOutput;” to resolve the uioutput cannot be resolved to a type error/exception. If you are getting this exception in eclipse like in the below/similar …

658 total views, no views today


Icefaces user session expired popup

Icefaces user session expired popup: Icefaces user session expired popup issue has been resolved after adding the below entries in the deployment descriptors (web.xml), The below one will redirect you to the ERRORPAGE.jsp onclick of any button after session timeout, <context-param> <param-name>org.icefaces.sessionExpiredRedirectURI</param-name> <param-value>/ERRORPAGE.jsp</param-value> </context-param> But ensure you have added this entry too, <error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/ERRORPAGE.jsp</location> …

685 total views, no views today


How to truncate td value in icefaces (jsf)

You can truncate the td value in jsf icefaces like this, You have to add “word-break:break-all” to your table style property. It will look like this, <ice:dataTable style=”word-break:break-all”> <ice:colomn style=”white-space:normal;”> </ice:column> </ice:dataTable> Ensure you have given the columnWidths property also to your datatable. Recommended Books: 609 total views, 1 views today

609 total views, 1 views today


Session Handling in Jsf Example

JsfSession.java: package com.ngdeveloper.com; import javax.faces.FacesException; import javax.faces.application.Application; import javax.faces.application.ViewHandler; import javax.faces.component.UIViewRoot; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; import javax.servlet.http.HttpSession; public class JsfSession implements PhaseListener { @Override public void afterPhase(PhaseEvent event) { //Do anything } @Override public void beforePhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); ExternalContext ext = context.getExternalContext(); HttpSession session = …

1,303 total views, 2 views today


Iceface datatable column width adjustment

Solution for iceface datatable column width adjustment: You may face the issue while setting the iceface datatable column width adjustments. This can be achieved by the below way,   Use style=”table-layout:fixed;” in the ice:column and ensure you have set the columnwidths already for all the columns. eg: <ice:column style=”table-layout:fixed;” columnwidths=”350px,490px”>   779 total views, no views …

779 total views, no views today


jQuery Show/Hide Example in Jsf

jQuery Show/Hide Example in Jsf: Program: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"> </script> <script> $(document).ready(function() { $("#content").hide(); $("#show_button").click(function() { $("#content").show(); }); $("#hide_button").click(function() { $("#content").hide(); }); }); </script> </h:head> <h:body> <h:commandButton value="show" id="show_button" /> <h:commandButton value="hide" id="hide_button" /> <div id="content">Welcome to Javadomain.in</div> </h:body> </html> Output:   Recommended Books: 751 total views, no views today

751 total views, no views today


Java Server Faces, Jquery
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Dynamically add/remove jsf components example

Program:   dynamic.xhtml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <h:head> </h:head> <h:body> <h:form> <h:dataTable value="#{dynBean.dynList}" var="myListElement"> <h:column> <h:panelGrid> <h:outputText value="www.ngdeveloper.com"></h:outputText> </h:panelGrid> </h:column> </h:dataTable> <h:commandButton value="Add" action="#{dynBean.addToMyList}" /> <h:commandButton value="Remove" action="#{dynBean.removeFromMyList}" /> </h:form> </h:body> </html> DynamicBean.java: import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.faces.bean.CustomScoped; import javax.faces.bean.ManagedBean; import …

1,681 total views, no views today


Ice Panel Popup Examples

In JSF, those who are using Ice components if they need popup they can go with Ice panel Popups. Ice Panel Popup : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ace="http://www.icefaces.org/icefaces/components" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> </h:head> <h:body> <h:form> <h:commandButton value="Click to open Ice Panl Popup" actionListener="#{icePopupBean.openPopup}" /> …

1,064 total views, 1 views today


[solved] diff propagated to root but no id set html null

diff propagated to root but no id set html null: Error: diff propagated to root but no id set html null Solution: Use <redirect/> in the faces-config file. Try to put h:panelGroup inside body (this error may occur if we use the ice components directly inside the body) – so it can be avoided if …

1,095 total views, 1 views today