【问题标题】:No default handler could be found for ActionBean - Stripes 1.5找不到 ActionBean 的默认处理程序 - Stripes 1.5
【发布时间】:2016-01-05 16:55:51
【问题描述】:

我正在尝试按照条纹网站上的教程计算器。 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>

【问题讨论】:

  • 您提供的代码在我将其放入 Stripes 项目时运行良好,因此可能是一些配置问题。你的web.xmlStripesFilterActionResolver.Packages init 参数是什么?
  • 你拯救了我的一天!参数为空!谢谢!

标签: java stripes


【解决方案1】:

ActionResolver.Packages 初始化参数为空!谢谢! @acdhirr

【讨论】:

  • 干杯!脱衣快乐!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-07-21
  • 1970-01-01
  • 1970-01-01
  • 2011-08-12
  • 2016-09-02
  • 2015-04-24
  • 1970-01-01
相关资源
最近更新 更多