[code="java"]
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
主界面
<br> <%@ include file="tree.js"%><br> <%@ include file="datagrid.js"%></p> <pre><code>$(document).ready(function(){ $("#selectButton").click(function(){ clickButton(); }); }); function clickButton() { var url = 'select.do'; var params = { beginTime:$('#beginTime').attr('value'), endTime:$('#endTime').attr('value')//对应的是控件的Id,之前错写成了Name,一个小小的错误也是毁灭性的打击 }; jQuery.post(url,params,callbackFun,'json'); } function callbackFun(data)//我看网上也可以写与Result,应该是任意的,是一个Json值 { alert("SUCCESS"); } </code></pre> <p>
开始时间
结束时间
<div region="south" title="South Title" split="true" style="height:100px;padding:10px;background:#efefef;">
<div class="easyui-layout" fit="true" style="background:#ccc;">
<div region="center">sub center</div>
<div region="east" split="true" style="width:200px;">sub center</div>
</div>
</div>
<div region="west" iconCls="icon-reload" title="部门树形结构" split="true" style="width:230px;">
<ul id="depttree"></ul>
</div>
<div region="center" title="Main Title" style="overflow:hidden;">
<div class="easyui-tabs" fit="true" border="false" >
<div title="Tab1">
<table id="datagrid" region="center"></table>
</div>
<div title="Tab2" closable="true" style="padding:20px;">This is Tab2 width close button.</div>
<div title="Tab3" iconCls="icon-reload" closable="true" style="overflow:hidden;padding:5px;">
</div>
</div>
</div>
[/code]
[code="java"]package com.zheshou.action;
import javax.annotation.Resource;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.apache.struts2.interceptor.validation.SkipValidation;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.web.portlet.bind.annotation.ResourceMapping;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.validator.annotations.*;
import com.sun.jndi.url.corbaname.corbanameURLContextFactory;
import com.zheshou.model.Employee;
import com.zheshou.model.User;
import com.zheshou.service.EmployeeService;
@ParentPackage(value="json-default")
@Namespace(value="/")
public class SelectAction extends ActionSupport {//2.ActionSupport必须有这个才行.但是可以不用Execute了
private String beginTime;
private String endTime;
private com.zheshou.model.User user;
public com.zheshou.model.User getUser() {
return user;
}
public void setUser(com.zheshou.model.User user) {
this.user = user;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
@Action(value="select"
,results={@Result(
type="json"
,name="selectuser"
,params={"includeProperties","user.*"}//root
)}
)
public String execute(){
System.out.println(beginTime);
System.out.println(endTime);
user.setId(1);
user.setUsername("张三");
return "selectuser";
}
}
[/code]
核心代码,如上,不知道为什么,回归函数,就是触发不了,其它的,都正常