Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

A Struts Internationalization Example Problem

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unfortunately, I found the code you give had been included in the web.xml.
anyway, thanks your replying.
 
Ranch Hand
Posts: 390
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also check to make sure that the struts-bean.tld is actually in your WEB-INF directory
 
Anselm Paulinus
Ranch Hand
Posts: 390
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added but same.
now I think it is a Parse Error !
the struts can't parse my .tld files.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
placed of course.
 
Anselm Paulinus
Ranch Hand
Posts: 390
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
placed of course.
What does that mean?
 
Yi Zhou
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
struts.jar file has been placed within TOMCAT_HOME\lib folder
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic