- This topic has 3 replies, 2 voices, and was last updated 20 years ago by Riyad Kalla.
-
AuthorPosts
-
fermataintlMemberStill in learning mode, I just created a new project and added Struts and JSTL capabilities.
Added one line to the generated MyJsp.jsp file after the one line in the body:
<fmt:message key=”button.change”/> and, of course the required reference to the tld at the top:
<% taglib uri=”http://java.sun.com/jstl/fmt” prefix=”fmt” %>
The source ApplicationResources.properties is in src/fi.jstltest. I added one definition to that file:
button.change=Change This Batman!
First thing I noticed is that I don’t see the classes folder, which was disturbing (at first). I’m used to seeing this in Websphere. Anyway, noticed that there really is a classes folder (using window explorer) and ApplicationResources.properties is getting copied into it.
When I fire up tomcat, it looks like it never loads my ApplicationResources. Sure enough, when I hit it from the browser I get:
This is my JSP page.
???button.change???I am running eclipse 3.0.1 build id 200409161125, myeclipse 3.8.3 build id 200412061200-3.8.3, on windows XP. Any help would be appreciated.
Thanks.
Dean
Riyad KallaMemberFirst thing I noticed is that I don’t see the classes folder, which was disturbing (at first)
Eclipse hides output folders by default from package view, you should be able to see it in the navigator view.
When I fire up tomcat, it looks like it never loads my ApplicationResources. Sure enough, when I hit it from the browser I get:
You need to load the resource bundle using:
<fmt:bundle basename = "fi.jstltest.ApplicationResources"> // <fmt:message /> tags must be within this body </fmt:bundle>
fermataintlMemberThanks, that worked. I don’t remember having to do that in the past when I built everything with vi and ant. What is the message-resources tag in struts-config.xml for then?
Dean
Riyad KallaMemberDean,
The message resource tag is for Struts, you are using JSTL to print out the messages. If you want to use the Struts tags:
<bean:message />then you don’t need to do the bundle stuff. You are mixing two technologies, Struts and JSTL. Which is fine and a lot of people do it, but that is why there is a discrepency. Unless you need EL or want to standardize on JSTL, Struts already has some of the best and most tested taglibs out there, so you may just want to use those.
-
AuthorPosts