I don’t know why but suddenly i want to take a look of this framework. So, i search some jsf tutorial and download jsf distribution framework (jsf 1.2) . I create a simple hello world project using my eclipse ide after following instruction from the tutorial i found. try running it using jetty 5 and the result is it didn’t work..
i found java.lang.NoClassDefFoundError: javax/el/ELResolver error.
Search in google, found out that jetty doesn’t work with jsf. So okay i said, try use tomcat.. but again the result is the same error. Again googling search for answer.. then i found that we have to use glassfish. So i download, install and start up glassfish.
We have to package our project to a war file to deploy, so i create a simple build.xml file to war the package.
<project name="JSFSimple" default="dist" basedir=".">
<target name="dist" >
<jar jarfile="jsfsimple.war" basedir="web">
</jar>
</target>
</project>
After the war file deployed, i try to open the page i have created, index.jsp
Again…error in the page. org.apache.jasper.JasperException: java.lang.RuntimeException: Cannot find FacesContext
“What is this?”, i say.. so hard just want to see a hello world message in your page..
So, again i ask google. After a long and almost gave up process, i found a silly mistake. This is my web.xml code
<?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>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
I finally noticed that my url pattern is *.jsf, so i type http://localhost:8080/jsfsimple/index.jsf and it finally show.. a nice hello world message.
what’s the different between applet with servlet?
Comment by benbego — October 28, 2007 @ 3:45 pm
sorry for the very-very late answer.
the difference is in applet you got a state-full application while in servlet you got state-less application.
applet is where you create a usual desktop application but you embed it on a web page.
while servlet is where you create an object in your web server and that object will responsible to response your request.
i’m sorry this is quite a basic question. you maybe want to try both first and experience to find out the differences are..
but one thing is for sure, we’re not using applet anymore right now.. if you want to create a responsive application in web world use ajax.
Comment by gunnasatria — November 19, 2007 @ 1:12 pm
jsf 1.2 will run on any servlet2.5/jsp2.1 compliant server, that includes tomcat 6 and jetty6
Comment by cagataycivici — November 24, 2007 @ 12:31 pm
@cagataycivici
oo i see.. well i did test it using tomcat 5.
thanks for your info
Comment by gunnasatria — December 13, 2007 @ 12:51 pm