struts error

I was running folowing struts sampel application. It is simple application without the data. I am getting error as in the attachment which shows my project structure as well.
I used url as

http://localhost:8080/StrutsNoData/welcome
which is not leading me to Welcome.jsp page under jsps/struts folder
Please advise on how to resolve this issue.


Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
  <display-name>Struts Test from coreservlets.com</display-name>
 
  <!-- Standard Action Servlet Configuration (with debugging) -->
  <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>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>


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


  <!-- The Usual Welcome File List -->
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

</web-app>


strutsconfig.xml code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>

<data-sources></data-sources>

<form-beans></form-beans>

<global-exceptions></global-exceptions>

<global-forwards></global-forwards>

<action-mappings>
<action path="/welcome" forward="/jsps/struts/Welcome.jsp" />
</action-mappings>

</struts-config>


Welcome.jsp



<HTML>
<HEAD>

<TITLE>Tag - Methods</TITLE>
</HEAD>
<h1>Welcome to Struts</h1>
</HTML>

StrutsNoData.JPG
LVL 7
gudii9Asked:
Who is Participating?
 
chaitu chaituConnect With a Mentor Commented:
check the console ;may be other errors are there in the console.did u put all the jars in WEB-INF/lib folder.i tried your code its working for me.

•struts.jar
•common-logging.jar
•common-beanutils.jar
•common-collections.jar
•common-digester.jar
0
 
Amitkumar PConnect With a Mentor Sr. ConsultantCommented:
Try the following

http://localhost:8080/StrutsNoData/welcome.do


Suggesting so because you have following servlet-mapping (*.do) configured for ActionServlet in your web.xml

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
0
 
gudii9Author Commented:
I added .do at end

like

http://localhost:8080/StrutsNoData/welcome.do


but still not displaying the jsp. Please advise
DotDo.JPG
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.