做一个Velocity 模板时发生以下错误,请看错误:
严重: Could not find action or result
No result defined for action raff.action.HelloWorld and result velocity - action - file:/C:/tomcat5.5/webapps/Raff/WEB-INF/classes/struts.xml:7:83
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:350)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)struts.xml代码:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name ="raff.action" extends ="struts-default" >
<action name ="VMHelloWorld" class ="raff.action.HelloWorld" method="aliasAction">
<result type="velocity">/HelloWorld.vm</result >
</action >
</package >
</struts>java代码:package raff.action;
import java.text.DateFormat;
import java.util.Date;
public class HelloWorld{
private String message;
public void setMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public String aliasAction(){
message="Hello World,Now is"+DateFormat.getDateInstance().format(new Date());
System.out.println(message);
return "velocity";
}
}HelloWorld.vm:<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<H2>Message rendered in Velocity: $message</H2>
</body>
</html>加了这些jar包:commons-collections-3.2.jar
velocity-1.4.jar
velocity-tools-view-1.2.jar
avalon-logkit-2.1.jar