日期:2014-05-18 浏览次数:20926 次
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
@Controller("testAction")
@Scope("prototype")
public class TestAction extends BaseAction {
private static Log log = LogFactory.getLog(TestAction.class);
private Map<String, String> map;
public String init() {
return "init";
}
public String test() {
System.out.println(map);
return null;
}
public void setMap(Map<String, String> map) {
this.map = map;
}
}
<action name="test-*" class="testAction" method="{1}">
<result name="init">/WEB-INF/page/test.jsp</result>
</action>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp" %>
<html>
<head>
<title>测试页面</title>
</head>
<body>
<div class="container-fluid">
<s:form action="test-test.jhtml" method="post" namespace="/" id="form_id">
<input type="text" name="map['a90']" value='A' />
<input type="text" name="map['a91']" value='A' />
<input type="text" name="map['a92']" value='A' />
<button type="submit" class="btn btn-success">提交</button>
</s:form>
</div>
</body>
</html>