This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I've been getting my feet wet with struts the past few weeks and have run into a problem. I have a few bean:message tags in my index.jsp of the webapp I'm learning with, which were working until I started getting into validation. I started getting the following:
I have the message resources defined in both web.xml and struts-config.xml (after the <action-mappings> section). The tld's are in the WEB-INF directory and I have set <taglib> in web.xml too. Strange that fmt:message *DOES* work.
I'm back at square one and not sure where else to look. I'm more curious to know why bean:message is failing in case I encounter it again rather than using fmt:message as a work around.
A lot of googling pointed at struts config problems and missing/incorrect jars. Because fmt:message is working and I'm not getting Class exceptions could it be something else?
What version of Struts are you using? If it's 1.3 or above, I expect the problem is that your taglib TLDS are the wrong ones for version 1.3. In version 1.3, the TLDS are all located inside the struts-taglib-1.3.x.jar file. Your JSPs should then reference the TLDS by their namespace, rather than their physical location. Example:
As long as the struts-taglib-1.3.x.jar file is in your classpath, the above reference should work. You don't need any TLDs in WEB-INF.
I downloaded 2.0.11, which didn't come with a struts-taglib-*.jar. I did a little more looking after your reply and found from an example that it uses:
I think the error I was getting was from commingling different versions of jar files in the WEB-INF/lib directory. I've cleaned the directory and copied the distribution jars back in. I changed the bean:message tag to s:message and now I'm getting:
org.apache.jasper.JasperException: /index.jsp(20,3) No tag "message" defined in tag library imported with prefix "s"
which makes sense. Maybe I've been going too fast and didn't notice much documentation on the apache site and the distro didn't come with docs. Is there an easy way to look at the jar files to find what the uri should be and what prefixes/tags are available?