You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2009/04/07 18:52:07 UTC

my first struts 2 HelloWord.action still not working

please help me.
 
after i did all the necessary configuration, i did the following
 
http://localhost:8080/jiong2/HelloWorld.action
 
but, receive the following:
HTTP Status 404 - /jiong2/HelloWorld.action


type Status report
message /jiong2/HelloWorld.action
description The requested resource (/jiong2/HelloWorld.action) is not available.
 
 
my configuration is the following:
 
file name:  /var/apache-tomcat-6.0.16/conf/server.xml
   ...
   <Context path="/jiong2" docBase="jiong2" debug="5" reloadable="true" crossContext="true">
   ...
 
file name:  /var/apache-tomcat-6.0.16/webapps/jiong2/HelloWorld.jsp
                  
<%@ taglib prefix="s" uri="/struts-tags" %>
<html> <head> <title>Hello World!</title></head> <body>
        <h2><s:property value="message" /></h2>  </body></html>
 
file name:  /var/apache-tomcat-6.0.16/webapps/jiong2/WEB_INF/web.xml
 
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5">
   <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_name: /var/apache-tomcat-6.0.16/webapps/jiong2/WEB-INF/classes/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="neuco" extends="struts-default">
        <action name="HelloWorld" class="neuco.HelloWorld">
            <result>/HelloWorld.jsp</result>
        </action>
            </package></struts>
 
file_name:  /var/apache-tomcat-6.0.16/webapps/jiong2/WEB-INF/classes/neuco/HelloWorld.class
 
     package neuco;
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;
    }
}
              
 
 


Apache Tomcat/6.0.16


      

Re: my first struts 2 HelloWord.action still not working

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Do you have any errors in the log (errors during startup)? Does the
tomcat manager show the application as running?

Nils-H

On Tue, Apr 7, 2009 at 6:52 PM, john lee <sh...@yahoo.com> wrote:
> please help me.
>
> after i did all the necessary configuration, i did the following
>
> http://localhost:8080/jiong2/HelloWorld.action
>
> but, receive the following:
> HTTP Status 404 - /jiong2/HelloWorld.action
>
>
> type Status report
> message /jiong2/HelloWorld.action
> description The requested resource (/jiong2/HelloWorld.action) is not available.
>
>
> my configuration is the following:
>
> file name:  /var/apache-tomcat-6.0.16/conf/server.xml
>    ...
>    <Context path="/jiong2" docBase="jiong2" debug="5" reloadable="true" crossContext="true">
>    ...
>
> file name:  /var/apache-tomcat-6.0.16/webapps/jiong2/HelloWorld.jsp
>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <html> <head> <title>Hello World!</title></head> <body>
>         <h2><s:property value="message" /></h2>  </body></html>
>
> file name:  /var/apache-tomcat-6.0.16/webapps/jiong2/WEB_INF/web.xml
>
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>    version="2.5">
>    <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_name: /var/apache-tomcat-6.0.16/webapps/jiong2/WEB-INF/classes/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="neuco" extends="struts-default">
>         <action name="HelloWorld" class="neuco.HelloWorld">
>             <result>/HelloWorld.jsp</result>
>         </action>
>             </package></struts>
>
> file_name:  /var/apache-tomcat-6.0.16/webapps/jiong2/WEB-INF/classes/neuco/HelloWorld.class
>
>      package neuco;
> 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;
>     }
> }
>
>
>
>
>
> Apache Tomcat/6.0.16
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org