• Structs复习 开始 第一个helloworld项目


    大体已经学完ssh了  感觉一起做一个项目有点难 计划先用一下独立的Structs 然后再把数据库操作换成hibernate  然后在用Spring 整合 计划用10天左右吧 

    但今天开始用Structs的时候 竟然发现好多东西都忘了 无从下手 所以计划用两天以内的时间快速复习一下Structs' 近两天内写一个基于Structs的项目 然后 根据这个项目开始后面的更改

    首先搭建环境 第一个hellowold项目 由于是第二次学了 会很快 有一些讲的省略的地方还希望多包含

    首先 新建 web项目

    然后导入jar包

    web.xml配置

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
        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_2_5.xsd">
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      
      <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>

    Struct.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
    
    <struts>
        <!-- 
        <constant name="struts.enable.DynamicMethodInvocation" value="false" />
        <constant name="struts.devMode" value="false" />
    
        <include file="example.xml"/>
    
    
    
        <package name="default" namespace="/" extends="struts-default">
            <default-action-ref name="index" />
            <action name="index">
                <result type="redirectAction">
                    <param name="actionName">HelloWorld</param>
                    <param name="namespace">/example</param>
                </result>
            </action>
        </package>
         -->
         
         
         <constant name="struts.devMode" value="true" />
         <package name="default" namespace="/" extends="struts-default">
            
            <action name="hello">
                <result>
                    /Hello.jsp
                </result>
            </action>
        </package>
        <!-- Add packages here -->
    
    </struts>

    浏览器输入:http://localhost:6666//Struts2_0100_Introduction/hello

  • 相关阅读:
    新autoJS写淘宝福年种福果
    autoJS写淘宝福年种福果
    简七学理财知识
    python一键搭ftp服务器
    域名伪装
    [SWPU2019]Web1
    [网鼎杯 2020 朱雀组]phpweb
    Doc
    Docker简单使用教程
    MySQL数据库基本操作
  • 原文地址:https://www.cnblogs.com/frankzone/p/9463783.html
Copyright © 2020-2023  润新知