File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No tag "ajax" defined in tag library imported with prefix "f"

 
David Erkstam
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm really pulling my hair out over this. I'm new to JSF and I'm afraid I'm pretty new to Java all together though not programming in general. I've gone thourgh the documentation and the earlier examples work fine but when I'm using some tags like "f:ajax" and some other as well I'm getting errors that they're not defined. I've read that they didn't exist before version 2.0 and I've made sure I'm not using any earlier with this function:



ajax.jsp:



web.xml:



my-faces-config.xml:



AjaxBean.java:



And (drum roll) the error:



During my many tests I got some slightly different results from wrting the ajax.jsp as a xhtml-file and putting the tag-import lines in that format where you type them as attributes to the html-tag. Then however it said something about #{...} not valid in template.

I'm using jBoss 7, JSF 2.1.7 and I'm just exporting the project as a WAR-file without Maven or any such thing. That shouldn't cause it to use an older version of JSF? Just to be safe I even removed a jar-file named JSF-something version 1 from folder in jBoss.

It's also the same with these additions to the web.xml, which I'm slightly surprised, don't seem to be needed:



I'm accessing the page with this URL btw: /test/ajax.jsf

Please help, it would really make the weekend so much better if I didn't have this to come back to on monday :p
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17627
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, David!

It certainly does look like a classpath issue. I cannot tell what the actual problem is, but I can tell you a few things about how the WAR should be set up. Since the implementation classes for JSF are built into JBoss 7, you only need a JSF-api.jar in your WAR. You should not have to meddle in any way with JBoss's classes. The tag libary dereferencing is done exclusively on the View definition itself, so the faces-config doesn't matter, and web.xml would only come into play if you had used the JBoss override of JSF classes.

One thing that does smell funny is that the message you're getting looks like a JSP compile error, and that's not what you should be seeing in JSF, and most especially in JSF2. JSF Views are not JSPs. They are, in fact, page template XML files in JSF View Definition Language. JSPs are compiled into Java code (servlets). JSF views are not. They are digested into component trees used by the FacesServlet.

It's possible that if you rename your ".jsp" file to ".xhtml" and add Facelets configuration as suggested for JBoss that that might resolve your problem.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic