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.