打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
SSH框架 web.xml配置
<?xml version="1.0" encoding="UTF-8"?><web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/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>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Struts 2与AJAX(第三部分)
web.xml配置文件
Struts2.0配置文件(web.xml)
JSTL与Struts的结合(十一)
java面试-ssh-1
web.xml 中的listener、 filter、servlet 加载顺序及其详解
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服