- First of all, I want to create a new folder underneath my public_html folder. There must be a way of doing this, but I can’t find it.
- Secondly, I want to refactor some JSP files and move them into a different directory. Again, I can’t find a way of moving JSP files within the web application. Surely this can be done?
I’ve been using Oracle JDeveloper for the past few days for JSF development and I must say, that I quite like it. The visual editors are pretty good and do make you much more productive.
I do have a couple of issues though that I can’t seem to solve, and as the title says, they are pretty simple tasks.
Since I started learning JSF, most of my development has been done in either NetBeans 5.5 or Eclipse 3.2. Whilse both of these are good IDE’s, they don’t provide any great visual support for JSF development.
Now that I understand the basics of JSF, I’m going to try using the features of the IDE more to become more productive – there’s no point learning a technology if it takes forever to write applications in it!! I still maintain that its useful to learn a technology using the bare basics (e.g. editing the faces config XML file manually), but when you’ve done that a few times it starts to get a bit repetative and boring and thats where a good IDE becomes useful.
I’ve decided to try using Oracle JDeveloper 10g. I initially wanted to use Sun’s Java Studio Creator, but had problems getting this to run under Java 5 on a Mac.
Initial impressions about JDeveloper seem to be good. It has a visual page flow editor together with a visual drag and drop page designer. I’ve managed to develop a few JSF applications (running internally on OC4J) and then deploy them externally to GlassFish without any major problems.
Are there any other visual JSF editors that other developers use? I’m quite happy with JDeveloper at the moment, but I’d be interested to hear what other developers use.
In his blog, Keith poses a question “Are you using JSF or intending to?”. So here goes, these are my reasons for learning JSF.
So, will I ever deploy an application with JSF? I don’t know, I’m still in the early stages of learning. I know there is plenty of information on the internet regarding peoples opinions of various technologies including JSF, but how much of it is FUD and how much is reasoned criticism?
As usual, when learning a new technology, the first application to write is a "Hello World" style application. To continue this tradition, I've written a very simple Hello World JSF application. After setting up the Faces servlet as described in my previous post, I've written a simple JSP page called hello.jsp which has the following contents:
This simple JSP page specifies that the 2 JSF taglibs "core" and "html" are to be used and specifies their appropriate prefixes. The HTML is pretty standard up until the <f:view> tag. This tag tells the container we are going to start using JSF components. Inside this tag, the outputText component is used to print out the text "Hello World" to the browser.
This trivial application is started by pointing the browser to http://localhost:8080/LearningJSF/hello.jsf
In a previous post, I specified my JSF URL mapping as *.jsf . If however, you try to access the JSP page that contains the JSF code directly (e.g. browse to hello.jsp instead of hello.jsf), then JSF will throw an IllegalStateException. It took me a few minutes to work out what the exception means, but in this case the description is rather obvious.
I've just found a series of articles published on IBM Developer Works called "JSF for non believers" written by Richard Hightower. They seem to be a good tutorial into JSF.
There are 4 articles in the series namely:
Declaring the Faces servlet is the first necessary step in developing a JSF application. The following XML snippet (from WEB-INF/web.xml) allows the servlet to be declared and specifies that all requests ending in *.jsf are passed to the Faces servlet which routes them to the corresponding JSP page.
I've noticed that when you create a JSF project in NetBeans, a different servlet mapping is used. NetBeans creates a servlet mapping with a url-pattern of /faces/* as shown below:
I don't know if there is a standard convention to use here or if one is better than the other?
JSF applications need a JSF implementation to run. There seem to be a few of these about, most noticeably the Sun JSF Implementation and the Apache MyFaces JSF implementation.
The Sun implementation supports JSF 1.2 which is the latest version of JSF and part of the Java EE 5 specification. The Apache MyFacesimplementation supports JSF 1.1.
I'm interested in Java EE 5, so I'm going to start learning with the Sun implementation using the GlassFish application server using NetBeans 5.5 as my IDE.
I know NetBeans has a lot of wizards and helpers to allow experienced developers to write applications quicker, but since I'm learning I'm going to try and minimize the use of these wizards. I'm a firm believer of learning a topic first before I start to use IDE generated code. When I'm more proficient in JSF, I imagine the tools provided by IDEs will be invaluable.
This blog aims to help categorize my experiences whilst learning Java Server Faces (JSF).
My aim is to blog about the experiences I have whilst learning JSF, both good and bad. I'd be interested to hear from others who are either learning JSF, or who have learned JSF. If you have any sources of information which may be helpful (books, tutorials, web sites etc.), than I'd be interested in hearing about them.
I hope this blog will be both useful to me and to any others learning JSF.