• struts2_20140720


          有这样的感觉:前面学的东西弄会了,过了一段时间又感觉陌生了,还要重新开始。这次想个好办法,把写的程序用博客记录下来,把自己的学历历程用博客的形式呈现出来,一来可以方便复习,而来可以以后开发程序可以快速上手,而且代码有快速参考价值。

         struts 2第一节:

         第一步:新建web project,默认index.jsp.

         第二步:在src目录下,新建(或者从struts包中拷贝)struts.xml文件。导入类库。struts.xml代码:

                       

    <?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>
      
      <package name="myPackage" extends="struts-default">
          <action name="first">
             <result>
                 /first.jsp
             </result>
          </action>
      </package>
      
    </struts>    

      第三步:web.xml文件更改:

      

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
      <display-name>struts2_20140720</display-name>
      <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>

        第二步和第三步在myeclipse中可以自动完成。选定工程名称-->右键--->myeclipse--->project-facets--->install apache struts 2

         第三步:index.jsp中添加链接标签

        

    <a href="first.action">struts.2</a>

    第四步:新建first.jsp

    部署,ok!

         

  • 相关阅读:
    openpyxl模块介绍 ——读取excel表格
    openpyxl模块介绍 ——创建excel表格 ——并写入数据
    csv文件——读和遍历csv文件
    openpyxl模块介绍 ——原有excel表格中创建sheet ——并写入数据
    遍历目录
    c# 反转,新手看
    缩写
    对象、类和结构
    c# Outlook 收发邮件
    C#中接口的作用
  • 原文地址:https://www.cnblogs.com/yaopan007/p/3857373.html
Copyright © 2020-2023  润新知