---
title: "Struts2之helloword实例"
author: "wanglihu"
date: "2012-02-15T11:10:00Z"
tags: ["Struts2", "hellworld"]
categories: ["开源软件"]
slug: "struts2-helloword"
draft: false
lastmod: "2012-02-14T15:21:34Z"
id: 1405585
url: "https://wanglihu.iteye.com/blog/1405585"
---

1.helloworld.jsp \[code="jsp"]&lt;%@ page language="java" import="java.util.\*" pageEncoding="ISO-8859-1"%&gt; helloworld页面 helloworld,struts2! \[/code] 2.web.xml \[code="xml"] struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* \[/code] 3.lib下的jar包 commons-fileupload-1.2.1.jar commons-logging.jar freemarker-2.3.15.jar ognl-2.7.3.jar struts2-core-2.1.8.1.jar xwork-core-2.1.6.jar 4.Action类 \[code="java"]package com.hitsoft.action; public class HelloWorld{ public String execute() throws Exception { return "success"; } }\[/code] 5.struts.xml \[code="xml"] /hellworld.jsp \[/code] 6.访问地址：http://localhost:8080/struts2/helloworld.action