Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please help in struts -web-inf/web.xml not found

 
Achalveer Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help i am getting this stupid error in struts
org.apache.jasper.JasperException: File "/WEB-INF/struts-bean.tld" not found

and also from tomcat server i am also getting error WEB-INF/web.xml file not found.
note: all struts jar files is in right places and web.xml file is also in web-inf .....please tell me what is error.

full log of errors is:
org.apache.jasper.JasperException: File "/WEB-INF/struts-bean.tld" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:159)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


plesse help if you can........................
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not telling us if struts-bean.tld is actually in WEB-INF. Please clarify this.
(you may not have noticed, but there's a forum dedicated to Struts)
 
Achalveer Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,
struts-bean.tld is in WEB-INF Folder
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please check if the web.xml is written correctly. Just try to open the xml files in explorer. They should open fine.

Secondly, there may be mapping error:
For eg in web.xml, the mappings of the tlds with exact locations is done.The eact locations may be mismatching with those specified here.
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
</taglib>

and the JSP has the following:
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

Here(in web.xml) the path may be wrong which might be a reason that both these files (web.xml and the tld) are having problem.
Also say if the other tlds are being found by the server or not.

Regards,
Roshani
 
Achalveer Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for support.
but i have checked everything is right.

i am posting code for jsp and web.xml
web.xml file

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app >

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>

</welcome-file-list>
<taglib>
<taglib-uri>WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>

jsp file


<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@page import="com.yourcompany.struts.SearchForm" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ABC Inc.. Human Resource Portal</title>

</head>

<body>
search employee either by name or ssn. <br>
<html:errors/>
<html:form action="/search" method="post" >
<table>
<tr>
<td align="right">
<bean:message key="label.search.name"/></td>
<td><html:text name="searchForm" property ="name"/></td>
</tr>
<tr>
<td></td>
<td>-----OR------</td>
</tr>
<tr>
<td align="right"><bean:message key="label.search.ssNum"/>:</td>
<td><html:text name="searchForm" property="ssNum"/>(xxx-xx-xxxx)</td>
</tr>
<tr>
<td></td>
<td><html:submit/></td>
</tr>
</table>
</html:form>

<logic resent name="searchForm" property="result">

<bean:size id="size" name="searchForm" property="result"/>
<logic:equal name="size" value="0">
<center><font color=red>NO EMPLOYEE FOUND</font></center>
</logic:equal>
<logic:greaterThan name="size" value="0">
<table border="0">
<tr>
<th>Name</th>
<th>Social security number</th>
</tr>
<logic:iterate id="result" name="serachForm" property="result" >
<tr>
<td><bean:write name="result" property="name"/></td>
<td><bean:write name="result" property="ssNum" /></td>
</tr>
</logic:iterate>
</table>
</logic:greaterThan>
</logic resent>
</body>


</html>
please guide me
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I tried my application with your web.xml mappings and in the index too. It works for me.
I downloaded the code you are running and i see that the chapter2 code that you are running doesnt have tlds in the WEB-INF or WEB-INF/tlds/ directory for that matter. It gives me an error that you are getting. Obvoiusly the tlds were not present thus the error.
You might extract a blank struts.war application and write the application code and check.
I see no other reason for the error save the tld not actually being present here. Maybe someone else might throw some light here.

Regards,
Roshani
 
Achalveer Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but all the tlds files are present in my WEB-INF folder.
 
Nakata kokuyo
Ranch Hand
Posts: 467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<taglib-uri>WEB-INF/struts-bean.tld</taglib-uri>
you miss "/" in front of WEB-INf i guess
 
Achalveer Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have checked by making "/" in front of web-inf but still same error...please help me...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic