This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Struts 2 Tutorial �Hello World� Please Help!

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings All;

Merrill, thanks for answering the last post. My hole is just getting deeper. I am very green to Struts, and I started this with the Jakarta Struts for Dummies Book I brought two years ago, and quickly realized that Struts 1.1 is very much out dated. I tried to use the Dummies Book with the Struts 2�Forget it! So I turned to the Struts 2, where I have read nearly everything regarding the �Getting Started,� and the �Hello World,� tutorial. After finishing the steps to the Hello World tutorial, and I getting the

http://localhost:8080/tutorial/HelloWorld.action
==============================================================
HTTP Status 404 - /tutorial/HelloWorld.action

Message /tutorial/HelloWorld.action

Description The requested resource (/tutorial/HellwWorld.action) is not available.


Apache Tomcat/6.0.16


Under the Tomcat webapp folder:

tutorial <--Folder
tutorial\HelloWorld.jsp
tutorial\META-INF
tutorial\WEB-INF
tutorial\WEB-INF\classes
tutorial\WEB-INF\classes\struts.xml
tutorial\WEB-INF\lib
tutorial\WEB-INF\lib\commons-logging-1.0.4.jar
tutorial\WEB-INF\lib\freemarker-2.3.8.jar
tutorial\WEB-INF\lib\ognl-2.6.11.jar
tutorial\WEB-INF\lib\struts2-core-2.0.11.1.jar
tutorial\WEB-INF\lib\xwork-2.0.4.jar
tutorial\WEB-INF\src
tutorial\WEB-INF\src\java
tutorial\WEB-INF\src\java\HelloWorld.java
tutorial\WEB-INF\src\java\struts.xml
tutorial\WEB-INF\src
tutorial\WEB-INF\web.xml




File: web.xml

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>My Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>


File: HelloWorld.java

package tutorial;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport {

public static final String MESSAGE = "Struts is up and running...";

public String execute() throws Exception {
setMessage(MESSAGE);
return SUCCESS;
}

private String message;

public void setMessage(String message){
this.message = message;
}

public String getMessage() {
return message;
}
}


File: struts.xml

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="tutorial" extends="struts-default">
<action name="HelloWorld" class="tutorial.HelloWorld">
<result>/HelloWorld.jsp</result>
</action>
<!-- Add your actions here -->
</package>
</struts>


File: HelloWorld.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h2><s roperty value="message" /></h2>
</body>
</html>



Now, I don�t have an index.html in the tutorial folder which I think is strange. But I also don�t understand what should build the Java file, outside of using eclipse. Again, I am very green in this, but I can pickup things very quickly. Unfortunately, I have been working on this since yesterday. And, yes I read a lot of other sites tutorial but most start out good, and in up talking about Struts 1.X.

I am currently reading Starting Struts 2 online. Please help if you can.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic