zoukankan      html  css  js  c++  java
  • 执行应用程序

    右键点击项目名称,并单击“导出”> WAR文件创建一个WAR文件。然后,这WAR部署在Tomcat的webapps目录下。最后,启动Tomcat服务器,并尝试访问URL http://localhost:8080/HelloWorldStruts2/index.jsp。这会给你以下画面:

    输入值为"Struts2",并提交页面。您应该看到下一页

    请注意,您可以定义索引动作在struts.xml文件,在这种情况下,你可以调用索引页http://localhost:8080/HelloWorldStruts2/index.action。检查下面你可以定义索引的行动:

    <?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.devMode" value="true" />
       <package name="helloworld" extends="struts-default">
    
          <action name="index">
                <result >/index.jsp</result>
          </action>
    
          <action name="hello" 
                class="com.yiibai.struts2.HelloWorldAction" 
                method="execute">
                <result name="success">/HelloWorld.jsp</result>
          </action>
    
       </package>
    </struts>
    

    Struts 2 配置文件

    本章将带你通过一个Struts2应用程序所需的基本配置。在这里,我们将看到在一些重要的配置文件,将配置文件:web.xml,struts.xml中,struts-config.xml和struts.properties
    老实说你能活下来使用web.xml和struts.xml中的配置文件,并在前面的章节中,你已经看到我们的例子中使用这两个文件的工作,但让我解释一下其他文件,以及你的知识。

  • 相关阅读:
    Python 类中的"静态"成员变量
    Python 标准输出 sys.stdout 重定向
    [转] Python的import初探
    百度地图_路线规划,起点终点标记弹窗显示信息
    哈哈哈哈
    centos7.6安装mysql5.6
    redis集群搭建
    初学 Nginx (一) SSI 的作用
    IE 不兼容 console 关键字
    windows 安装多个版本的jdk后修改 环境变量不起作用
  • 原文地址:https://www.cnblogs.com/borter/p/9502127.html
Copyright © 2011-2022 走看看