zoukankan      html  css  js  c++  java
  • 项目添加Struts2支持,并修改默认后缀

    方式一:

    使用MyEclipse提供的项目构建组件,选择AddStruts capabilities,选择Struts2.1版本,然后把拦截类型改为 /*

    方式二:

    使用MyEclipse添加Struts2的库,然后修改web.xml,添加struts2提供的过滤器StrutsPrepareAndExecuteFilter

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" 
    	xmlns="http://java.sun.com/xml/ns/j2ee" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    	http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <filter>
      <filter-name>struts2</filter-name>
      <filter-class>
      	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      </filter-class>
      </filter>
      <filter-mapping>
      	<filter-name>struts2</filter-name>
      	<url-pattern>/*</url-pattern>
      </filter-mapping>
    </web-app>
    

      

    在src下创建struts.xml,添加constant节点,配置struts.action.extension属性为需要修改的后缀,如 html

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <constant name="struts.action.extension" value="html"/>
    <package name="default" extends="struts-default" namespace="/">
    </package>
    </struts>
    

      

  • 相关阅读:
    python的json模块介绍
    采用boosting思想开发一个解决二分类样本不平衡的多估计器模型
    kappa系数
    android服务
    Android Studio 无法预览布局问题:com/android/util/PropertiesMap
    pitch yaw roll是什么
    keil5破解
    Eclipse/jre/jdk/jvm
    传感器
    Java静态代码块
  • 原文地址:https://www.cnblogs.com/zhanghaoh/p/2828582.html
Copyright © 2011-2022 走看看