• Post Reply Bookmark Topic Watch Topic
  • New Topic

dynamic ui:include difficulties  RSS feed

 
fericit Bostan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm attempting to dynamically include a page based upon a variable value. I'm running my application in GlassFish v3.0.1 and I'm using JSF2 with RichFaces 4. I've read the following articles pertaining to this:

http://in.relation.to/11633.lace

http://devharbor.blogspot.com/2009/08/add-jsf-controls-dynamically-with.html

and I believe that I have my code correct to work, but I can't seem to get the <c:forEach> tag to work.



I've got the namespace included for the jstl library:



but that gave me the following error when loading the page:

This page contains the following errors:
error on line 16 at column 26: Namespace prefix c on forEach is not defined
Below is a rendering of the page up to the first error.


So I included the jstl namespace in my layout.xhtml template, but that only resulted in the following error message being displayed on my web page.

Warning: This page calls for XML namespace http://java.sun.com/jstl/core declared with prefix c but no taglibrary exists for that namespace.


GlassFish 3.0.1 is a JEE6 compliant container, and the jstl libraries should be available by default. So I really don't understand why I'm having these issues.

So what am I missing? Why can't I get this to work?

Thanks for the help..
 
pranjal mishra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check the tld file for jstl/core. there could be a possibility that forEach tag is not defined in there or may you are using older version of tag library
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using JSTL in JSF is a bad idea anyway. And there's a "ui:repeat" tag in facelets, so you shouldn't need forEach.
 
Adam Pryce
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Using JSTL in JSF is a bad idea anyway. And there's a "ui:repeat" tag in facelets, so you shouldn't need forEach.

I need to say that avoiding the JSTL tags completely is silly. They have their place, though they can be confusing. For instance in Richfaces making dynamic tags requires them. The key being that they leave no trace in the component tree. See these discussions for some more info:
http://in.relation.to/11633.lace
http://devharbor.blogspot.com/2009/08/add-jsf-controls-dynamically-with.html
 
Jim Locum
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a very similar situation using Richfaces 3.3.3 and Mojarra 2.0.2, I was having difficulty getting the ui:include rendering the correct source file specified within a ResourceBundle.

This setup always returned the value associated with the default locale in the resoucebundle base file due to ui:include el expression getting parsed before the view locale resolves I premise.

There is probably a way to set the locale in code somewhere so the ui:include would resolve properly, but I have yet to find it.

However, I was fortunate that the "expression for locale" was already being retrieved from a bean and I was able to add a bit to the bean to make it work correctly.

I subclassed HashMap in an inner class of my bean and overrode the get(Object key) method like:

The getMessageSourceValue(String key) method in my bean and the el method to call:

The getMessageSource() method just returns the import org.springframework.context.MessageSource object.

Then the finishing touches for my xhtml page:


Of course, this might be overkill and I hope somebody can simplify it all for me

Cheers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!