- This topic has 11 replies, 3 voices, and was last updated 20 years, 2 months ago by Riyad Kalla.
-
AuthorPosts
-
aannam01MemberI just started uisng the MyEclipse with the Struts.It is mt recognizing the Struts-html and other tlds.
Here is my web.xml
<?xml version="1.0" encoding="UTF-8"?> <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> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <taglib> <taglib-uri>struts-html</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> </web-app>
Here is My JSP page
<%@ page language="java"%> <%@ taglib uri="struts-html" prefix="html" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html locale="true"> <body> <html:form action="becomeaffiliate.do" method="post"> <table border="0"> <tr> <td>Login:</td> <td><html:text property="companyname" /></td> </tr> <tr> <td>Password:</td> <td><html:text property="physicaladdress" /></td> </tr> <tr> <td colspan="2" align="center"><html:submit /></td> </tr> </table> </html:form> </body> </html:html>
This is my project webroot structure
webroot
META-INF
WEB-INF
lib
struts-html.tld
web.xml
struts-config.xml
pages
becomeaffiliate.jspAnd this is the error I am getting
org.apache.jasper.JasperException: File “/pages/struts-html” not found
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:105)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:180)I really appreciate any help.Please let me know if you need any more information.
Thank you
Riyad KallaMemberI cannot reproduce this, from the screenshot do you see anything I missed? I copy-pasted your web.xml file and jsp file:
Riyad KallaMemberNote, I also placed becomeaffiliate.jsp in two folders, one under webroot and one under web-inf, because I couldn’t tell from your post where it was. Both worked.
PaulParticipantI don’t have a reference to the TLD’s in my web.xml file. In my JSPs though, the reference to those TLD’s looks like this – note my uri is different than yours. Those TLD files are also placed inside the web-inf directory (hard to tell from the formatting of your post if that’s the case for you)
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>
Did you start this struts project by creating a web project, then applying ‘add struts capabilities’ to it? That was all I had to do. HTH.
aannam01MemberThanks for the reply.
I have my Pages folder under WebRoot.
I am creating the Project by going to New ->Project->J2EE Project->WebProject and then adding the struts capabilities .
Before modifying anything in the web.xml i cretaed simple JSP and tried to access it , still i get the error .
After i changed the references in the web.xml to struts-html anf tried that way, still get the error .
Do i need to set any paths , before cretaing a project.
I really apprecitae any help.
aannam01MemberI just started using MyEclipse , so not able to figure out how to view two files at a time.Please let me know, so that i will post the screenshot of my project if required.
aannam01MemberIf give the absolute URI for tag libraries this is the error i am getting
org.apache.jasper.JasperException: This absolute uri (http://jakarta.apache.org/struts/tags-bean) cannot be resolved in either web.xml or the jar files deployed with this application
Riyad KallaMemberaannam,
Right click on your project root node, and go to “Properties” then got to Java Build Path and then “Libraries”, amke sure all the struts libraries (especially struts.jar) are added here to your build path. If they are not, click on “Add JAR” and add them from your project.Also you can show two files side by side by clicking on the tab of oen, and dragging it over until its next to the existing file.
aannam01MemberI have all the jar files included.But still getting the error.Is there a sample project available for struts, so that i Import and start from there.
Riyad KallaMemberI have posted my project for you here, please try it:
http://www.u.arizona.edu/~rsk/myeclipse/TestWeb4.zip
aannam01MemberThanks it is working now ,but by copying your SRC and WebRoot directories.I am stilll not able to figure out what was wrong.Thanks again
Riyad KallaMemberIts hard to say, maybe a flaky dot file? (.project, .classpath, .mymetadata, etc.) it could be a lot of things, i’m glad it worked though.
-
AuthorPosts