逻辑:前台jsp中的form,调用action中的add方法,action中通过定义和页面元素相同的私有变量(生成get、set方法可以拿到前台变量),然后调用dao中的hibernate保存
1、struts.xml
采用通配符配置
<action name="test_*" class="com.action.TestAction" method="{1}">
<result name="add_sucess">/test/addTestSucess.jsp</result>
<result name="search_sucess">/test/searchTest.jsp</result>
</action>
2、前台页面 addTest.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body style="background:#F5F5F5">
<div>
<ol class="breadcrumb">
<li class="active">测试</a></li>
<li class="active">添加</li>
</ol>
<div id="content">
<form action="test_add.action" method="post" id="test">
<table class="table table-bordered" border="0" width="100%" align="center">
<tr>
<td style="width: 270px; height: 18px;">
a:
</td>
<td style="width: 500px; height: