Spring mvc注释,无法找到jsp页面

时间:2015-06-02 20:16:32

标签: java spring jsp spring-mvc

mvc-dispatcher-servlet.xml:

<context:component-scan base-package="com.springapp.mvc" />  
<mvc:annotation-driven /> 
<bean name="viewResolver"class="org.springframework.web.servlet.view.InternalResourceViewResolver">    
<property name="prefix" value="/WEB-INF/pages/"/>  
<property name="suffix" value=".jsp"/> 
    </bean>

添加此文件后,jetty抛出错误:* .jsp未找到。如果我在这里删除注释驱动,一切正常。它非常基本的服务。

控制器代码:

@RequestMapping(value = "/v1/deliveryETA", method = RequestMethod.GET)
public String getDeliveryETA(Model model) {
    model.addAttribute("deliveryETA",new DeliveryETA());
    return "getDeliveryETA";
}

和getDeliveryETA.jsp:

<%@ taglib prefix="th" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<body>
<form:form method="post" action="/v1/deliveryETA" commandName="deliveryETA">
    <table>
        <tr>
            <td>Origin Address: <font color="red"><form:errors path="originAddress" /></font></td>
        </tr>
        <tr>
            <td><form:input type="text" path="originAddress" /></td>
        </tr>
        <tr>
            <td>Destination Address: <font color="red"><form:errors path="destinationAddress" /></font></td>
        </tr>
        <tr>
            <td><form:input type="text" path="destinationAddress" /></td>
        </tr>
        <tr>
            <td><input type="submit" value="Submit" /></td>
        </tr>
    </table>
</form:form>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

我认为View Resolver属性值应该像这样定义:

describe PublicanCreatorsCreate do
  describe '.init_docu_work' do