SSH高手进 配置问题
[i][/i]版本:Struts 2.3.14 Spring3.0.0 Hibernate3.3.2
依赖的jar包:
web.xml 配置
expression="execution(public * com.sinpertime.service..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txServicePointcut" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="getUser"/>
<tx:method name="save" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
</beans>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!-- constant name="devMode" value="true" / -->
<package name="default" namespace="/" extends="struts-default">
<action name="user" class="com.sinpertime.action.UserAction">
<result>/registerSuccess.jsp</result>
</action>
</package>
</struts>
package com.sinpertime.action;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.opensymphony.xwork2.ActionSupport;
import com.sinpertime.service.IUserService;
@Component("user")
@Scope("prototype")
public class UserAction extends ActionSupport{
@Override
public String execute() throws Exception {
System.out.println("action ........");
return "success";
}
}
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'registerSuccess.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
Success
</body>
</html>