• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Problem in running Struts tutorial example by Isabelle  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Struts. I followed the Jakarta Struts - A beginner's tutorial by Isabelle but have a problem in running the first example.
I should see a directory listing with files by entering http://localhost:8080/registeruser/
The error message:
HTTP Status 404 - /registeruser/
type Status report
message /registeruser/
description The requested resource (/registeruser/) is not available.
My Tomcat Apache Tomcat/4.1.18 is working fine. I could use it to run other examples.
I am not using Eclipse but I have created:
the index.jsp in webapps\registeruser
web.xml in webapps\registeruser\WEB-INF.
The struts.jar is copied to \webapps\registeruser\WEB-INF\lib.
I would appreciate if someone could help me to solve this problem in order to continue with the tutorial.
Thank you in advance.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
it looks like you didn't map the StrutsController Servlet to /registeruser/.
Normaly you can do it two ways:
- Map this Servlet to a certain path e.g. /do/* now every request to this URL is handled by the servlet
- or map an ending to the servlet /*.do
But anyway one of these configurations has to be done.
Then it should work
If it is still not working, please post your web.xml and struts-config.xml
Olli
 
C Wong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Olli, according to the tutorial (at section: Learning by example: your first Struts application), there is no mention of struts-config.xml yet. However, the web.xml has a reference to it. That could be the cause of problem that Tomcat could not create a web application called "registeruser". I still have a same problem after creating the struts-config.xml.
---- web.xml -------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<!-- Resources bundle base class -->
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>

<!-- Context-relative path to the XML resource containing Struts configuration information -->
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<!-- The debugging detail level for this servlet, which controls how much information is logged. -->
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Application Tag Library Descriptor -->
<taglib>
<taglib-uri>/WEB-INF/app.tld</taglib-uri>
<taglib-location>/WEB-INF/app.tld</taglib-location>
</taglib>
<!-- Struts Tag Library Descriptors -->
<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>

------ struts-config.xml --------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<form-beans>
<!-- Logon form bean -->
<form-bean name="loginForm"
type="LoginForm"/>
</form-beans>

<global-forwards>
<forward name="mainmenu" path="/mainmenu.jsp" />
</global-forwards>

<action-mappings>
<!-- Process a user logon -->
<action path="/login"
type="LoginAction"
name="loginForm"
scope="session"
input="/index.jsp">
</action>

</action-mappings>
</struts-config>
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!