熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

根據ID填充文本框的實例代碼

2013-11-15 12:10:23  來源: JSP教程 

  前台

復制代碼 代碼如下:
<script type="text/javascript">
     function func_load_remark(sr_id){
     if(sr_id!=){
        $getJSON("loadSrRemarkdo?date="+new Date() {srid:sr_id} function(srmain){
        $("#bparemark")val(srmainbpa_remark);
        $("#itdremark")val(srmainitd_remark);
        $("#bugremark")val(srmainbu_remark);
        $("#itoremark")val(srmainito_remark);
        });
     }else{
        $("#bparemark")val("");
        $("#itdremark")val("");
        $("#bugremark")val("");
        $("#itoremark")val("");
     }
     }
     function check(){
     if($("#srid")val()==""){
     alert("請選擇SR_ID!");
     $("#srid")focus();
     return false;
     }
     return true;
     }
     </script>

  
後台

復制代碼 代碼如下:

  
package comaegon_cnoocoaadminaction;
import javaioPrintWriter;
import javaxservlet
import javaxservlet
import netsfjsonJSONSerializer;
import netsfjsonutilJSONUtils;
import orgapachestrutsactionActionForm;
import orgapachestrutsactionActionForward;
import orgapachestrutsactionActionMapping;
import comaegon_cnoocframeworkbaseactionBaseAction;
import comaegon_cnoocoaadminserviceUserService;
import comaegon_cnoocoaibatistoTuOafSrMainTO;
public class LoadSrRemarkAction extends BaseAction{
 private UserService userService;
 public ActionForward executeAction(ActionMapping mapping ActionForm form
   HttpServletRequest request HttpServletResponse response)
   throws Exception {
  String srid=requestgetParameter("srid");
  TuOafSrMainTO srMain=userServicegetRemarkBySrId(srid);
    responsesetContentType("application/json;charset=gbk");
         responsesetCharacterEncoding("gbk");
         PrintWriter pw = responsegetWriter();
         pwwrite(JSONUtilsvalueToString(JSONSerializertoJSON(srMain)));
         pwflush();
  return null;
 }
 public void setUserService(UserService userService) {
  thisuserService = userService;
 }
}


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20439.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.