我正在尝试遵循Stripes网站上的教程Calculator。
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>
最佳答案
ActionResolver.Packages init参数为空!谢谢! @acdhirr
关于java - 找不到针对ActionBean的默认处理程序-Stripes 1.5,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34617083/