views:

146

answers:

0

Hello Im doing the convention plugin for struts2.2.1, examples with netbeans6.9 and it seems like something is wrong. I even copy/paste everything and nothing. rightnow I get :

"The error message is ${message} " when it should be

"The error message is Hello World"

i could not post the structure, but I put the jsp under the WEB-INF following the tutorial but nothing

web.xml

<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>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>hello-world.jsp</welcome-file>
</welcome-file-list>

myaction:

package com.example.actions;
import com.opensymphony.xwork2.ActionSupport;

public class HelloWorld extends ActionSupport {
  private String message;

  public String getMessage() {
   return message;
  }

  public String execute() {
   if (System.currentTimeMillis() % 2 == 0) {
       message = "It's 0";
       return "zero";
   }

    message = "It's 1";
    return SUCCESS;
  }

}

hello-world.jsp

<html>
<body> 
The Error message is ${message}
</body>
</html>

I don´t think I need a strut.xml file. I´m really getting frustrated here would really appreciate any help or can´t you do annotations with struts2.2.1 ?