我正在尝试按照条纹网站上的教程计算器。 https://stripesframework.atlassian.net/wiki/display/STRIPES/Quick+Start+Guide
但始终显示以下消息: HTTP状态500 - 找不到类型为ActionBean的默认处理程序:calculate.CalculatorActionBean
我的ActionBean:
@UrlBinding("/calculate/Calculator.action")
public class CalculatorActionBean implements ActionBean {
private ActionBeanContext context;
private double numberOne;
private double numberTwo;
private double result;
public ActionBeanContext getContext() { return context; }
public void setContext(ActionBeanContext context) { this.context = context; }
public double getNumberOne() { return numberOne; }
public void setNumberOne(double numberOne) { this.numberOne = numberOne; }
public double getNumberTwo() { return numberTwo; }
public void setNumberTwo(double numberTwo) { this.numberTwo = numberTwo; }
public double getResult() { return result; }
public void setResult(double result) { this.result = result; }
@DefaultHandler
public Resolution addition() {
result = getNumberOne() + getNumberTwo();
return new ForwardResolution("/WEB-INF/jsp/layout-usage.jsp");
}
}
我的Jsp:
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"
isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%--<c:set var="contextPath" value="${pageContext.request.contextPath}" scope="page" />--%>
<stripes:form beanclass="calculate.CalculatorActionBean" focus="">
<table>
<tr>
<td>Number 1:</td>
<td><stripes:text name="numberOne"/></td>
</tr>
<tr>
<td>Number 2:</td>
<td><stripes:text name="numberTwo"/></td>
</tr>
<tr>
<td colspan="2">
<stripes:submit name="addition" value="Add"/>
</td>
</tr>
<tr>
<td>Result:</td>
<td>${actionBean.result}</td>
</tr>
</table>
</stripes:form>
答案 0 :(得分:0)
ActionResolver.Packages init参数为空!谢谢! @acdhirr