0
調度員的servlet沒有請求處理方法與名稱的SayHello
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
etc...
<mvc:annotation-driven/>
<context:component-scan base-package="com.fastek.crm3" />
<mvc:resources mapping="/resources/**" location="/resources/"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="sayHello.html">exampleController</prop>
</props>
</property>
</bean>
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
<bean id="exampleController" class="com.fastek.crm3.controller.ExampleController"></bean>
STD10002.jsp-
<body class="bcolor" style="background-color: #EEEEEE;">
<form:form modelAttribute="stdUser">
<h3 class="myclass">
<table>
<td align="left">Application Users
<img src="${pageContext.servletContext.contextPath}/resources/images/Buttons/gray icon/help.png" width="15px" height="15px" id="Help" title="Click here to get help." alt="Help" style="cursor:pointer" onclick="showHelp('CRM100020');">
<form:checkbox path="listView" onclick="showHideReport()" id="ListView"></form:checkbox>
</td>
</table>
</h3>
</form:form>
控制器類 -
public class ExampleController extends MultiActionController{
public ModelMap sayHello(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception {
StdUsers stdUser = new StdUsers();
System.out.println("/////called from one-----------");
StdCheckAccessV chk = new StdCheckAccessV();
chk.setDFlag(1);
stdUser.setChkAccessV(chk);
ModelAndView mav = new ModelAndView("CMN/STD100002");
model.addAttribute("stdUser",mav);
return model;
}}
index.jsp-
<body>
<a href="example/sayHello.html">Say Hello One</a><br>
<body>
StdUSer.java-
public class StdUsers{
praivate boolean listView;
getter and setter.....
}
在點擊鏈接中的index.jsp即時得到-404警告 - 沒有要求在課堂[com.fastek.crm3處理的方法,名爲 'sayHello的'。 controller.ExampleController] 我是Spring和jstl的新手。
感謝@Will,它的工作。 – Viks
@Will'ModelMap'擴展了'LinkedHashMap',因此它實現了'Map',爲什麼它不起作用? –
Anthony
你可能認爲它應該,但是因爲代碼確實有類匹配,所以它沒有考慮到繼承。它專門查找「ModelAndView」,「Map」,「String」或「void」的類。除此之外,即使它擴展'Map'或'ModelAndView'也不行。 –