1:关于spring mvc请求和方法的映射:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/" /> <property name="suffix" value=".jsp" /> </bean> <bean id="defaultHandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" /> <bean id="djHandlerExceptionResolver" class="com.downjoy.app.smtpfbackend.common.exception.SmtpfHandlerExceptionResolver" /> <bean id="requestInterceptor" class="com.downjoy.app.smtpfbackend.common.web.RequestInterceptor"></bean> <bean id="simpleUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="interceptors"> <list> <ref bean="requestInterceptor" /> </list> </property> <property name="mappings"> <props> <prop key="/game/*.html">gameController</prop> <prop key="/user/*.html">userManagerController</prop> </property> </bean> <bean id="gameController" class="com.downjoy.app.smtpfbackend.ui.html.GameController"> <property name="methodNameResolver"> <bean class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver"> <property name="mappings"> <props> <prop key="/game/list_game.html">listGames</prop> <prop key="/game/update_game.html">updateGame</prop> </props> </property> </bean> </property> <property name="gameService" ref="gameService" /> </bean>
在Cotrroler层中
public class GameController extends MultiActionController {
private GameService gameService; public void setGameService(GameService gameService) { this.gameService=gameService; } public ModelAndView listGames(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<String, Object> model=new HashMap<String, Object>(); ................................. return new ModelAndView("jsp/game/list","model",model) }
相信了解spring mvc的都知道,配置方法和url的映射关系。
dwz中 怎么样实习 对话框添加后刷新 某个页面呢??
首页在common文件下建立 两个jsp页面:
200.jsp 和 300.jsp
200.jsp页面 <%@ page contentType="text/html; charset=UTF-8"%> <%@ page import="java.util.Map"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%> { "statusCode":"200", "message":"操作成功", "navTabId":"${model.navTabId}", "callbackType":"${model.callbackType}", "forwardUrl":"${model.forwardUrl}" }
300.jsp页面 <%@ page contentType="text/html; charset=UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%> { "statusCode":"300", "message":“${model.message}”, "navTabId":"", "callbackType":"${model.callbackType}", "forwardUrl":"" }
其中 是把返回的数据封装成json格式,框架文档对其中4个 有详细的描述,
200成功页面 300错误页面
message是对话框中提示的信息内容
navTabId 是dwz中index.html 中每个面板 在ref属性中的值
。。。。。。