struts2入门,HelloWorld环境搭建。
2016-09-02 17:14
507 查看
1,创建WEB工程。
2,拷贝jar包。
下载地址 http://struts.apache.org/
3,写配置文件
在src目录下,创建struts.xml文件。如下:
4,写动作类
5,写JSP
6,部署验证
http://localhost:8080/struts/success.jsp
2,拷贝jar包。
下载地址 http://struts.apache.org/
3,写配置文件
在src目录下,创建struts.xml文件。如下:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <package name="p1" extends="struts-default"> <action name="helloworld" class="com.yang.action.HelloWroldAction" method="sayHello"> <result name="success">/success.jsp</result> </action> </package> </struts>
4,写动作类
package com.yang.action; public class HelloWroldAction { public String sayHello(){ System.out.println("helloworld!"); return "success"; } }
5,写JSP
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>title</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> helloworld </body> </html>
6,部署验证
http://localhost:8080/struts/success.jsp
相关文章推荐
- Struts2---->环境搭建及HelloWorld
- jni 入门 android的C编程之旅 --->环境搭建&&helloworld
- Drools入门-----------环境搭建,Helloworld 入门篇
- struts2入门(搭建环境、配置、示例)
- 【NetCore入门】centos7.x下搭建netcore环境和helloworld的demo
- Struts2---->环境搭建及HelloWorld
- Drools入门-----------环境搭建,分析Helloworld
- struts2简单入门之环境搭建立
- Struts2简单入门和环境搭建
- struts2_01入门如何搭建环境
- Cocos2d-x入门教程(一)环境搭建与HelloWorld
- Couchbase入门——环境搭建以及HelloWorld
- struts2简单入门demo-struts2环境搭建
- Struts2学习(一) 基础环境搭建与创建HelloWorld程序
- Drools入门-----------环境搭建,分析Helloworld
- jni 入门 android的C编程之旅 --->环境搭建&&helloworld
- Struts2入门一搭建开发环境及相应案例
- scala 入门Eclipse环境搭建及第一个入门经典程序HelloWorld
- scala 入门Eclipse环境搭建及第一个入门经典程序HelloWorld
- REACT-NATIVE入门(环境搭建及HELLOWORLD)