level 1
1035128317
楼主
最近在看一位前辈代码,struts代码是这样的
<action name="com_paraAction" class="com.aw.action.Com_paraAction">
<result type="json" />
</action>
然后在com_paraAction类里的execute方法是这样写的,
public String execute() throws Exception {
HttpServletResponse response=ServletActionContext.getResponse();
HttpServletRequest request=ServletActionContext.getRequest();
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
String type=request.getParameter("param");
System.out.println(type);
this.setCom_para(new Com_paraBIZ().get_para(type));
System.out.println("com_para="+com_para.getContent());
System.out.println("completed");
return SUCCESS;
}
我不懂返回的Json数据是哪个变量的,有没有大佬可以指教下?
2017年10月13日 14点10分
1
<action name="com_paraAction" class="com.aw.action.Com_paraAction">
<result type="json" />
</action>
然后在com_paraAction类里的execute方法是这样写的,
public String execute() throws Exception {
HttpServletResponse response=ServletActionContext.getResponse();
HttpServletRequest request=ServletActionContext.getRequest();
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
String type=request.getParameter("param");
System.out.println(type);
this.setCom_para(new Com_paraBIZ().get_para(type));
System.out.println("com_para="+com_para.getContent());
System.out.println("completed");
return SUCCESS;
}
我不懂返回的Json数据是哪个变量的,有没有大佬可以指教下?