wood burning stoves*
The moose likes Struts and the fly likes A Struts Internationalization Example Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "A Struts Internationalization Example Problem" Watch "A Struts Internationalization Example Problem" New topic
Author

A Struts Internationalization Example Problem

Yi Zhou
Greenhorn

Joined: Sep 25, 2003
Posts: 12
I am trying a struts Internationalization example in "struts tutorials" writen by stphan.
1 I have made the resouce file : "ApplicationResources.properties" in which is just one line code : index.title=Struts Tutorial
and placed it into class directory.
2 My JSP file content as follows
<%@ page language="java" %>
<%@ taglib uri="struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html:html locale="true">
<head><html:base/><title>
<bean:message key = "index.title"/>
</title></head>
<body><h2>BookView</h2></body>
</html:html>
3 My struts-config.xml is empty
web.xml include:
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResource</param-value>
</init-param>
When I start up tomcat3.1 and typed "http://localhost:8080/strutsShop/bookview.jsp" in IE address column
The page shows:
Location: /strutsShop/bookview.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to open taglibrary struts-bean.tld : Parse Error in the tag library descriptor: com.sun.xml.parser/V-034 servlet-name servlet-name (#PCDATA)
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:672)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:116)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1073)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1034)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:534)
Can't open the tld!!!??
Why?
can anybody tell me ?
Thanks
Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
Your web.xml needs the following code inside of it:

You'll need to define the taglib inside the web.xml for all of the tld's that you will use in your app. So html, logic, tiles etc.
Yi Zhou
Greenhorn

Joined: Sep 25, 2003
Posts: 12
unfortunately, I found the code you give had been included in the web.xml.
anyway, thanks your replying.
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
Also check to make sure that the struts-bean.tld is actually in your WEB-INF directory
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
I just saw the error on your code; the directive
<%@ taglib uri="struts-bean.tld" prefix="bean" %>
should actually be <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
I hope this helps.
Anselm Paulinus.
Yi Zhou
Greenhorn

Joined: Sep 25, 2003
Posts: 12
I added but same.
now I think it is a Parse Error !
the struts can't parse my .tld files.
satish pune
Ranch Hand

Joined: Sep 04, 2003
Posts: 44
I am not sure if this helps but check that struts.jar file is not placed within TOMCAT_HOME\lib folder
Placing this jar file here does cause problems
-satish
Yi Zhou
Greenhorn

Joined: Sep 25, 2003
Posts: 12
placed of course.
Anselm Paulinus
Ranch Hand

Joined: Sep 05, 2003
Posts: 389
placed of course.
What does that mean?
Yi Zhou
Greenhorn

Joined: Sep 25, 2003
Posts: 12
struts.jar file has been placed within TOMCAT_HOME\lib folder
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A Struts Internationalization Example Problem
 
Similar Threads
bean:message - existing key value not found
Error using Struts Messages
Problems with Struts
help on taglib and properties file in struts?
Struts error