分享

SSH框架 web.xml配置

 昵称27831725 2017-12-19
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java./xml/ns/javaee" xmlns:xsi="http://www./2001/XMLSchema-instance" xsi:schemaLocation="http://java./xml/ns/javaee http://java./xml/ns/javaee/web-app_3_0.xsd"> <!-- SSH整合后web.xml配置 --> <!-- web.xml文件中需要配置的信息有: --> <!-- 1、防止乱码的过滤器 --> <filter> <filter-name>charset</filter-name> <filter-class> <!-- 处理乱码的类 --> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>charset</param-name> <param-value>utf-8</param-value> </init-param> </filter> <!-- 2.配置struts2过滤器 --> <filter> <filter-name>Struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> <!-- 指定action所在的package --> <init-param> <param-name>actionPackages</param-name> <param-value>com.boke.ctl.struts2Action</param-value> </init-param> </filter> <filter-mapping> <filter-name>Struts2</filter-name> <url-pattern>/*</url-pattern> <!-- 疑问点!||| --> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <!-- 3.配置一个监听器将请求转发给 Spring框架 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 4.配置一个参数,告诉容器,spring配置文建的位置 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:Location</param-value> </context-param> <!-- 5.也可以配置一个自定义的Servlet,进行特殊操作 --> <servlet> <servlet-name>myServlet</servlet-name> <servlet-class>org.directwebremoting.servlet.myServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>myServlet</servlet-name> <url-pattern>/myServlet/*</url-pattern> </servlet-mapping> <!-- 6、配置jsp标签 --> <jsp-config> <taglib> <taglib-uri>/WEB-INF/struts-tags.tld</taglib-uri> <taglib-location>/WEB-INF/struts-tags.tld</taglib-location> </taglib> </jsp-config> <!-- 7、错误页面 --> <error-page> <error-code>404</error-code> <location>/error.jsp</location> </error-page> <!-- 首页,欢迎页面 --> <welcome-file-list> <welcome-file>mainB/login.jsp</welcome-file> </welcome-file-list> <!-- 9、session登出时间 --> <session-config> <session-timeout>30</session-timeout> </session-config> </web-app>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约