JSF Interview questions
Another set of JSF Interview questions at Skill-Guru . Tests your knowledge of JSF concepts.
Our earlier JSF Interview questions had received a very good response. Hop you will like this one too.
|
||||||||||
|
||||||||||
Another set of JSF Interview questions at Skill-Guru . Tests your knowledge of JSF concepts.
Our earlier JSF Interview questions had received a very good response. Hop you will like this one too.
There has been a problem in using table width in IE7.
The pre tags in IE 7 do wrap the text but the table width will remain wider and scrollbar appears, as if the text is taking full space. This problem doesn’t come in Firefox and Chrome. Can anyone help me out defining proper style for IE 7 for pre tags. for eg of you look at this code
Solution : Use table-layout: fixed;
If you apply the table-layout:fixed style for the inner table, where the data is in different columns, all columns get same area irrespective of their defined width. But if applied it to the outer table, and it works fine.
This problem happened with an JSF , Hibernate and rich faces application which was running on tomcat 6.0.14 version and Jdk1.6.0 . When upgraded to Tomcat 6.0.26 and JDK 1.6.0-19, it started behaving strangely.
The jsf messages were displayed as html and looked as the servver was not parsing them.
for eg {userbean.errorMessage} started showing on pages.
After much analysis it was found that this problem is because of tomcat upgrade. Why is this problem ?
From the documentation
For the #{} expressions to be recognized in Tomcat 6, your web application must adhere to the Servlet 2.5 specification. Make sure, that version and xsi:schemaLocation attributes of element in your WEB-INF/web.xml file have the correct values. You can look into conf/web.xml or into the examples application for an example.
In the versions 6.0.24 and earlier the deferred expressions were processed regardless of the specification version specified in web.xml. That was changed/fixed in 6.0.26.
Below is solution
Changed
<?xml version=’1.0′ encoding=’UTF-8′?>
<!DOCTYPE web-app PUBLIC
“-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”
“http://java.sun.com/dtd/web-app_2_3.dtd”>
<web-app>
……………..
to
<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns=”http://java.sun.com/xml/ns/javaee”
xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
id=”WebApp_ID”
version=”2.5″>
…………………
remove these if they exist in your web.xml
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/jsf_core.tld</taglib-uri>
<taglib-location>/WEB-INF/jsf_core.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/html_basic.tld</taglib-uri>
<taglib-location>/WEB-INF/html_basic.tld</taglib-location>
</taglib>
If this was helpful , please add comment below
If you encounter this exception
Caused by: java.lang.SecurityException: class “com.sun.faces.util.FacesLogger”’s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:775
While I had been working in j2ee enterprise application, the SEO friendly url’s was never an objective. It was never required that each page should have a unique bookmarkable url.
But things change completely in world wide web world. SEO is hot . All the pages should have a unique user friendly url.
In Skill-Guru although we had unique url for the test pages, they were never user friendly. Our url’s were like
http://www.skill-guru.com/skill/login/getAllTestsByCategory.faces?cagtegoryId=1&cagtegoryName=Certification
http://www.skill-guru.com/skill/login/fetchRelatedTestsPosts.faces?tag=scjp
So we took the project of re architecting the application to have a clean , user friendly , bookmarkable url. We looked at couple of options like url rewriting in .htaccess file on the server.
Then we discovered pretty faces. Pretty faces utility has been written by Lincoln Baxter. This makes life so much easier for application developer . It also left the control with the developer to manage the url within the application instead of managing on server.
I am not going into details of pretty faces as Lincoln has done an excellent job on documentation. Now the url’s in our application are user freindly.
http://www.skill-guru.com/cat/sat-practice-test
http://www.skill-guru.com/test/79/passage-based-reading-test-1
Thanks to pretty faces we now have pretty URL’s.
In our last post , Getting started with JSF , we had covered JSF1.2. JSF has come a long way from that. JSF 2 has come with very new features, some of them taken from different frameworks / components. Now JSF developers don’t have to look out. JSF2 helps JSF developers to keep their application simple.
There are many articles explaining new features of jsf 2. But here in this blog, I brief you some of the features:
1. The introduction of View scopes, flash scope and custom scope - View scopes,Flash scopes and custom scopes are ‘bigger than request scope but smaller than session scope’. Many times developers are forced to keep objects in session scope just because they want the objects available till end of their front view operation or make them work in the redirection or till end of their front end operation. For example you might have experienced implementing edit/delete/ add operations to datatable, many times its necessary to make the bean session scope to make it working right way. This can be avoided by view scope variables. The custom scope helps objects to be available till end of user operation (user has to decide the scope of bean). This is like flow scope.Flow scopes were offered by frameworks like spring webflow etc .. But for an application already done in JSF, it is easier to shift to JSF2 than webflow.
Read more…
Web based application beyond a size become complex to manage. Page definitions, managing application flow , state management , orchestration of all this become a difficult task. That is why we have frameworks to ease out this task for us.
One of the choices which come to mind is Spring webflow. Spring webflow is for management of page flow , navigation and state management. It is not an full fledged MVC framework like JSF 2.0 or Apache Struts.
You might get confused by the definition of Spring webflow on its home page
Spring Web Flow is the project in the Spring Portfolio that focuses on providing the infrastructure for building and running rich web applications. As a Spring project, Web Flow builds on the Spring Web MVC framework to provide: Read more…
Programmers when creating url and page name sometimes create mixed case URL for eg
http://www.skill-guru.com/skill/login/testDetails/12/testName/SCJP-6-Mock-Practice-Test
Now this may be a good programming practice but it is not a good practice from user perspective. Mixed case URLs are an absolute no-no, as Unix and Linux servers are case sensitive. Having mixed case URLs drastically increases the possibility of typos . It is always difficult for users to remember the url (if they can).
So try to keep all your url’s in lower case.