|
楼主 |
发表于 2014-11-8 17:47:22
|
显示全部楼层
找了个例子写了下,但是调用不到.j文件:
js中调用代码如下:
- $.ajax({
- async:false,
- type:"post",
- dataType:"json",
- url:"/leaderMonitoring/purchaseQuery/process/outLine/outLine.j",
- data:{
- theYear:document.getElementById("yearSelect").value,
- businessID :justep.Context.getRequestParameter("bsessionid")
- },
- error:function(error,status,text){
- alert(text);
- },
- success:function(result){
- justep.xbl("mainData").loadJson(result.response);
- }
- });
复制代码
.j代码
- public void execute(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
- String theYearStr = request.getParameter("theYear");
- int theYear = Integer.parseInt(theYearStr);
- System.out.print(theYearStr);
- String businessID = request.getParameter("businessID");
- Action action = new Action();
- action.setProcess("/leaderMonitoring/purchaseQuery/process/outLine/outLineProcess");
- action.setActivity("mainActivity");
- action.setName("purchaseOutline");
- action.setParameter("theYear", theYear);
- ActionResult ar = ActionEngine.invokeAction(action, ActionUtils.JSON_CONTENT_TYPE, businessID, null, null);
- if(ar.isSuccess()){
- response.setCharacterEncoding("UTF-8");
- response.setContentType(ActionUtils.JSON_CONTENT_TYPE);
- response.getWriter().write(ar.getContent().toString());
- response.resetBuffer();
- }else{
- throw new RuntimeException(ar.getMessage());
- }
- }
复制代码 |
|