zoukankan      html  css  js  c++  java
  • Struts之准备工作

    *Struts之需要准备的jar包:

    *Struts之xml配置文件:

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
     3   <display-name></display-name>
     4   <welcome-file-list>
     5     <welcome-file>index.jsp</welcome-file>
     6   </welcome-file-list>
     7     <listener>
     8         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     9     </listener>
    10   <filter>
    11     <filter-name>struts2</filter-name>
    12     <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    13   </filter>
    14   <filter-mapping>
    15     <filter-name>struts2</filter-name>
    16     <url-pattern>/st2/*</url-pattern>
    17   </filter-mapping>
    18 </web-app>

    *Struts之工程包的创建及命名规则:

    entity:此包含有各个模块的实体类,实体变量以及各个实体变量的get、set方法,用于在Dao中进行调用从jsp或者html界面中获取值

    dao:可以为每个模块创建一个包,每个包中含有*Dao和*ImplDao,在*ImplDao中写方法的接口,在*Dao中进行对应的*ImplDao的implements,并进行具体的实现

    action:此包中含有项目工程各个模块的功能action,调用对应*Dao中的方法来实现具体方法

    *Struts之Struts.xml的配置及命名规则:

    1    <package name="server" namespace="/" extends="struts-default">  
    2               <action name="server_*" class="cn.ac.ict.action.softwaremarket.ServerAction" method="{1}">
    3                 <result name="list" >/pages/softwaremarket/dserver_manage.jsp</result>
    4                 <result name="preUpdate">/pages/softwaremarket/editserver.jsp</result>           
    5              </action>
    6      </package> 

    在一个package中是一个模块的方法,有一个action,以及多个result,action命名一般为模块名_*。

     

    评论
  • 相关阅读:
    服务器上的vhost
    php解压缩文件方法汇总
    STM32新起航-TMP1
    实现
    如何协调项目与领导?
    《致加西亚的一封信》读后感
    致加西亚的信
    本周设计部分及作业
    对·作业提交项目作业模块需求的编写(赵刚,段超凡)
    (第三周)团队模式中对交响乐团模式的理解
  • 原文地址:https://www.cnblogs.com/voidy/p/3933683.html
Copyright © 2011-2022 走看看