Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

struts error

Posted on 2012-08-15
3
Medium Priority
?
1,169 Views
Last Modified: 2012-08-16
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
0
Comment
Question by:gudii9
3 Comments
 
LVL 21

Assisted Solution

by:Amitkumar P
Amitkumar P earned 1000 total points
ID: 38296912
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
 
LVL 7

Author Comment

by:gudii9
ID: 38296954
I added .do at end

like

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


but still not displaying the jsp. Please advise
DotDo.JPG
0
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 1000 total points
ID: 38299216
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question