Lost JSF beginner: Linux, Geronimo and tag library
I use Geronimo with J2EE 5 and Tomcat 6 and I'm trying to create one simple page using JSF. I put the tag library files myfaces_core.tld
and myfaces_html.tld
in WEB-INF
and it works, but just on Windows. Under Linux I got IOException
with an unknown reason when I was deploying the WAR. To remove the two tag library files made the deploy possible. But then I got an error when I was opening the page in browser. It was missing the file WEB-INF/myfaces_html.tld
, which is specified in the header of JSP file. In examples for MyFaces there is used not MyFaces TLD, but common Sun Java TLD. I have overwritten the URI WEB-INF/myfaces_html.tld
to http://java.sun.com/jsf/html
ant now I'm getting the error The absolute uri: http://java.sun.com/jsf/html cannot be resol开发者_高级运维ved in either web.xml or the jar files deployed with this application.
I'm lost now. Must I or must I not put the tag library description files into my WAR to use JSF components? These files are already contained in MyFaces JARs in Geronimo Container, aren't? The container must have the same behavior regardless to platform or it needn't? What shall I do to create my simple application really platform independent?
You should not be extracting JAR files of 3rd party tag libraries and placing its loose TLD files in the /WEB-INF
folder. The TLD files should be kept in the JAR files where they originate and the JAR files should be untouched and just be dropped in the runtime classpath. Whatever book/tutorial/forum is suggesting otherwise should be blacklisted.
Cleanup your project structure to get rid of those loose TLD files and undo every change related to this, for sure also in the web.xml
, if any.
Your /WEB-INF/lib
folder should contain just two files in order to get JSF to run on Tomcat 6: one file representing the abstract API and other representing the concrete implementation. As you've apparently chosen to use MyFaces, it'll be those two JAR files (probably with a version number at end of filename, that depends):
- myfaces-api.jar
- myfaces-impl.jar
Drop them in /WEB-INF/lib
folder which is part of the webapp's default runtime classpath. That's all. Next step would be declaring and mapping the FacesServlet
in your webapp's web.xml
.
Ensure that you're reading the proper book/tutorial.
精彩评论