jquery根据ID填充文本框的代码示例

阅读更多
根据ID填充文本框的小例子。
需要引入外部jquery框架。

1,前台:

后台代码:
package com.aegon_cnooc.oa.admin.action;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONSerializer;
import net.sf.json.util.JSONUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.aegon_cnooc.framework.base.action.BaseAction;
import com.aegon_cnooc.oa.admin.service.UserService;
import com.aegon_cnooc.oa.ibatis.to.TuOafSrMainTO;
public class LoadSrRemarkAction extends BaseAction{
 private UserService userService;
 public ActionForward executeAction(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws Exception {
  String srid=request.getParameter("srid");
  TuOafSrMainTO srMain=userService.getRemarkBySrId(srid);
    response.setContentType("application/json;charset=gbk"); 
         response.setCharacterEncoding("gbk"); 
         PrintWriter pw = response.getWriter(); 
         pw.write(JSONUtils.valueToString(JSONSerializer.toJSON(srMain))); 
         pw.flush();
  return null;
 }
 public void setUserService(UserService userService) {
  this.userService = userService;
 }
}

你可能感兴趣的:(填充,文本框)