📄 useraction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.yourcompany.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.json.JSONException;
import org.json.JSONObject;
/**
* MyEclipse Struts
* Creation date: 01-10-2008
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class UserAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String result="";
//JSONArray _array = new JSONArray();
JSONObject _user = new JSONObject();
try {
_user.append("gender","男");
_user.append("age","18");
_user.append("name","张三1");
response.setCharacterEncoding("utf-8");
response.getOutputStream().print(_user.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//_array.put(_user);
//JSONObject _users = new JSONObject();
//out.print(_users.put(_array));
//result = new JSONObject().put("user",_user).toString();
return mapping.findForward("tree");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -