Estou usando o mentawai, em um projeto no Eclipse Europa (3.3).
Estou tendo um problema na hora em que termino de fazer o meu HelloWorld. Será que alguém sabe o que é??
Vou mandar os fontes e uns screens…
ApplicationManager.java:
// no package (root package)
import org.mentawai.core.*;
public class ApplicationManager extends org.mentawai.core.ApplicationManager {
public void loadActions() {
// Ruby style: less verbose and less clear
action("/HelloWorld", HelloMentawai.class)
.on(SUCCESS, fwd("/hello.jsp"))
.on(ERROR, fwd("/username.jsp"));
// Java style: more verbose and more clear
ActionConfig ac = new ActionConfig("/HelloWorld", HelloMentawai.class);
ac.addConsequence(SUCCESS, new Forward("/hello.jsp"));
ac.addConsequence(ERROR, new Forward("/username.jsp"));
addActionConfig(ac); // add this action to the application manager
}
}
HelloMentawai.java
package principal;
import java.util.*;
import org.mentawai.core.*;
public class HelloMentawai extends BaseAction {
public String execute() throws Exception {
String username = input.getStringValue("username");
if (username == null || username.trim().equals("")) {
return ERROR;
}
output.setValue("username", username.toUpperCase());
return SUCCESS;
}
}
Web.xml:
<!-- The Mentawai controller -->
<web-app>
<servlet>
<servlet-name>Controller</servlet-name>
<servlet-class>org.mentawai.core.Controller</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- You must choose an extension to indicate a mentawai action -->
<servlet-mapping>
<servlet-name>Controller</servlet-name>
<url-pattern>*.mtw</url-pattern>
</servlet-mapping>
</web-app>