@RequestMapping 用法…

本文详细解析了Spring框架中的@RequestMapping注解,包括其属性如value、method、consumes、produces、params和headers的具体用法,并提供了丰富的代码示例。

前段时间项目中用到了RESTful模式来开发程序,但是当用POST、PUT模式提交数据时,发现服务器端接受不到提交的数据(服务器端参数绑定没有加任何注解),查看了提交方式为application/json, 而且服务器端通过request.getReader() 打出的数据里确实存在浏览器提交的数据。为了找出原因,便对参数绑定(@RequestParam、 @RequestBody、 @RequestHeader 、 @PathVariable)进行了研究,同时也看了一下HttpMessageConverter的相关内容,在此一并总结。


简介:

@RequestMapping

RequestMapping是一个用来处理请求地址映射的注解,可用于类或方法上。用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径。

RequestMapping注解有六个属性,下面我们把她分成三类进行说明。

1、 value, method;

value:     指定请求的实际地址,指定的地址可以是URI Template 模式(后面将会说明);

method:  指定请求的method类型, GET、POST、PUT、DELETE等;


2、 consumes,produces;

consumes: 指定处理请求的提交内容类型(Content-Type),例如application/json, text/html;

produces:    指定返回的内容类型,仅当request请求头中的(Accept)类型中包含该指定类型才返回;


3、 params,headers;

params: 指定request中必须包含某些参数值是,才让该方法处理。

headers: 指定request中必须包含某些指定的header值,才能让该方法处理请求。


示例:

1、value  / method 示例

默认RequestMapping("....str...")即为value的值;

 

[java]  view plain copy
  1. @Controller  
  2. @RequestMapping("/appointments" 
  3. public class AppointmentsController  
  4.   
  5.     private final AppointmentBook appointmentBook;  
  6.       
  7.     @Autowired  
  8.     public AppointmentsController(AppointmentBook appointmentBook)  
  9.         this.appointmentBook appointmentBook;  
  10.      
  11.   
  12.     @RequestMapping(method RequestMethod.GET)  
  13.     public Map get()  
  14.         return appointmentBook.getAppointmentsForToday();  
  15.      
  16.   
  17.     @RequestMapping(value="/{day}"method RequestMethod.GET)  
  18.     public Map getForDay(@PathVariable @DateTimeFormat(iso=ISO.DATE) Date day, Model model)  
  19.         return appointmentBook.getAppointmentsForDay(day);  
  20.      
  21.   
  22.     @RequestMapping(value="/new"method RequestMethod.GET)  
  23.     public AppointmentForm getNewForm()  
  24.         return new AppointmentForm();  
  25.      
  26.   
  27.     @RequestMapping(method RequestMethod.POST)  
  28.     public String add(@Valid AppointmentForm appointment, BindingResult result)  
  29.         if (result.hasErrors())  
  30.             return "appointments/new" 
  31.          
  32.         appointmentBook.addAppointment(appointment);  
  33.         return "redirect:/appointments" 
  34.      
  35.  

 

 

 

 

 

value的uri值为以下三类:

A) 可以指定为普通的具体值;

B)  可以指定为含有某变量的一类值(URI Template Patterns with Path Variables);

C) 可以指定为含正则表达式的一类值( URI Template Patterns with Regular Expressions);


example B)

 

[java]  view plain copy
  1. @RequestMapping(value="/owners/{ownerId}"method=RequestMethod.GET)  
  2. public String findOwner(@PathVariable String ownerId, Model model)  
  3.   Owner owner ownerService.findOwner(ownerId);    
  4.   model.addAttribute("owner"owner);    
  5.   return "displayOwner"  
  6.  

example C)

 

 

 

 

 

 

[java]  view plain copy
  1. @RequestMapping("/spring-web/{symbolicName:[a-z-]+}-{version:d.d.d}.{extension:.[a-z]}" 
  2.   public void handle(@PathVariable String version, @PathVariable String extension)      
  3.     // ...  
  4.    
  5.  


 

 

 

 

 

2 consumes、produces 示例

cousumes的样例:

 

[java]  view plain copy
  1. @Controller  
  2. @RequestMapping(value "/pets"method RequestMethod.POST, consumes="application/json" 
  3. public void addPet(@RequestBody Pet pet, Model model)      
  4.     // implementation omitted  
  5.  
方法仅处理request Content-Type为“application/json”类型的请求。

 

 

 

 

 


produces的样例:

[java]  view plain copy
  1. @Controller  
  2. @RequestMapping(value "/pets/{petId}"method RequestMethod.GET, produces="application/json" 
  3. @ResponseBody  
  4. public Pet getPet(@PathVariable String petId, Model model)      
  5.     // implementation omitted  
  6.  

方法仅处理request请求中Accept头中包含了"application/json"的请求,同时暗示了返回的内容类型为application/json;

 


3 params、headers 示例

params的样例:

[java]  view plain copy
  1. @Controller  
  2. @RequestMapping("/owners/{ownerId}" 
  3. public class RelativePathUriTemplateController  
  4.   
  5.   @RequestMapping(value "/pets/{petId}"method RequestMethod.GET, params="myParam=myValue" 
  6.   public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model)      
  7.     // implementation omitted  
  8.    
  9.  

 仅处理请求中包含了名为“myParam”,值为“myValue”的请求;

 


headers的样例:

[java]  view plain copy
  1. @Controller  
  2. @RequestMapping("/owners/{ownerId}" 
  3. public class RelativePathUriTemplateController  
  4.   
  5. @RequestMapping(value "/pets"method RequestMethod.GET, headers="Referer=http://www.ifeng.com/" 
  6.   public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model)      
  7.     // implementation omitted  
  8.    
  9.  

 仅处理request的header中包含了指定“Refer”请求头和对应值为“http://www.ifeng.com/”的请求;

 



上面仅仅介绍了,RequestMapping指定的方法处理哪些请求,下面一篇将讲解怎样处理request提交的数据(数据绑定)和返回的数据。


<meta http-equiv="expires" content="0"> <meta http-equiv="pragma" content="no-cache"> <%@ include file="booktop.jsp" %> <%@ include file="connect.jsp" %> <% String materialno; String plant; String stloc; String slotid; String compare; String yield; String pshipid; String pg_die_c; String i_customerid; String grade; String destination; float pyield; int showyield; String status; String show_status = ""; int n; n = 0; materialno=request.getParameter("materialno").toUpperCase(); plant=request.getParameter("plant").toUpperCase(); stloc=request.getParameter("stloc").toUpperCase(); slotid=request.getParameter("slotid").toUpperCase(); compare=request.getParameter("compare").toUpperCase(); yield=request.getParameter("yield"); i_customerid=request.getParameter("i_customerid").toUpperCase(); grade=request.getParameter("grade").toUpperCase(); destination=request.getParameter("destination").toUpperCase(); status=request.getParameter("status").toUpperCase(); if (status.equals("F")){ status = ""; show_status = "FREE"; } //-add by summer gao on 2005-9-20-- String temp1 = ""; String temp2 = ""; int temp_flag = 0; String d_year = ""; String d_month = ""; String d_day = ""; String temp3=new String(); String temp4=new String(); String rec_date = ""; String str = "0"; int over_flag; int length1; int today; int receive_date; int left; java.util.Date cur_today = new java.util.Date(); SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMdd"); String dateString = formatter.format(cur_today); //out.println(dateString); String subdate = dateString.substring(4,8); //out.println(subdate); %> <script language="javascript" src="tablesort.js"></script> <script language="javascript" src="openwin.js"></script> <script language="javascript" src="calendar_today.js"></script> <script> function clear_date(b){ eval("window.document.querylotid.invduedate"+b).value = "";} </script> <script> function check_date(num){ for(var i=1; i<num+1; i++ ){ if (eval("window.document.querylotid.invduedate"+i).value == "") {if (eval("window.document.querylotid.reason"+i).value != "") {alert( "Reason " +i+ " should be consistent with the blank Due Date."); return(false); } } else {if (eval("window.document.querylotid.reason"+i).value == "") {alert( "Reason " +i+ " should be consistent with the non-blank Due Date."); return(false); } } } } </script> <script> function sumvalue(v){ var wafer = new Number(0); var die = new Number(0); var len = document.querylotid.slotid.length; if(len > 1){ if (v.value != '-') { for(var i=0; i<len; i++ ){ if (document.querylotid.slotid[i].value == v.value) document.querylotid.slotid[i].checked = v.checked; } } for(var i=0;i<len;i++) { if (document.querylotid.slotid[i].checked) { document.querylotid.lotproduct[i].checked = true; wafer = wafer + new Number(document.querylotid.slotid1[i].value); die = die + new Number(document.querylotid.slotid2[i].value); }else{ document.querylotid.lotproduct[i].checked = false; } } } else{ if (document.querylotid.slotid.checked) { document.querylotid.lotproduct.checked = true; wafer = wafer + new Number(document.querylotid.slotid1.value); die = die + new Number(document.querylotid.slotid2.value); }else{ document.querylotid.lotproduct.checked = false; } } document.querylotid.sumwafer.value = wafer; document.querylotid.sumdie.value = die; } </script> <script> function doIt(v) { var len2= document.querylotid.slotid.length; if (len2>1) { for(var i=0;i<document.querylotid.slotid.length;i++) { document.querylotid.slotid[i].checked=eval(v); document.querylotid.lotproduct[i].checked=eval(v); } document.querylotid.c4.checked=false; document.querylotid.c3.checked=false; var wafer = new Number(0); var die = new Number(0); for(var i=0;i<document.querylotid.slotid1.length;i++) { if (document.querylotid.slotid[i].checked) { wafer = wafer + new Number(document.querylotid.slotid1[i].value); die = die + new Number(document.querylotid.slotid2[i].value); } } document.querylotid.sumwafer.value = wafer; document.querylotid.sumdie.value = die; }else{ document.querylotid.slotid.checked=eval(v); document.querylotid.lotproduct.checked=eval(v); document.querylotid.c4.checked=false; document.querylotid.c3.checked=false; var wafer = new Number(0); var die = new Number(0); if (document.querylotid.slotid.checked) { wafer = new Number(document.querylotid.slotid1.value); die = new Number(document.querylotid.slotid2.value); } document.querylotid.sumwafer.value = wafer; document.querylotid.sumdie.value = die; } } </script> <style> THEAD TD {BACKGROUND: #B9BECB; HEIGHT: 20px; PADDING-Right: 2px;CURSOR:s-resize;} THEAD .arrow {COLOR: black; FONT-FAMILY: webdings; FONT-SIZE: 12px; HEIGHT: 13px; MARGIN-BOTTOM: 2px; MARGIN-TOP: -3px; OVERFLOW: hidden; PADDING-BOTTOM: 2px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px; WIDTH: 10px} .header { background-color: #B9BECB;} </style> <tr><td bgcolor="#E0E4ED"><br> <% JCO.Client client = null; try { IFunctionTemplate ftemplate = repository.getFunctionTemplate("Z_LB_PIV_SEARCH_LOTS"); JCO.Function function = new JCO.Function(ftemplate); client = JCO.getClient(SID); JCO.ParameterList input = function.getImportParameterList(); input.setValue(materialno, "MATERIALNO"); input.setValue(plant, "PLANT"); input.setValue(stloc, "STLOC"); input.setValue(slotid, "SLOTID"); input.setValue(yield, "I_YIELD"); input.setValue(compare, "I_COMPARE"); input.setValue(i_customerid, "I_CUSTOMERID"); input.setValue(grade, "I_GRADE"); input.setValue(destination, "I_DESTINATION"); input.setValue(status, "I_STATUS"); //---Add by Summer Gao in 2004-03-11 for role check---------- input.setValue(session.getAttribute("role"), "I_ROLE"); //---End add by Summer /* input.setValue("Y", "INTEGRATE"); input.setValue("Y", "NO_EMPTY"); */ client.execute(function); JCO.Table e_lotinfo = function.getTableParameterList().getTable("RLOTINFO"); if (e_lotinfo.getNumRows() > 0) { %> <form name="querylotid" method="post" action="inventory_do_update.jsp" onSubmit="return check_date(<%=e_lotinfo.getNumRows()%>)"> <button type="button" name="c4" value="true" onclick="doIt(true)" style="font-family:verdana;background:#ffeeee">Select All</button>    <button type="button" name="c3" value="false" onclick="doIt(false)" style="font-family:verdana;background:#ffeeee">Unselect All</button>    <b>Sum Wafer Qty</b>   <input type=text name="sumwafer" size="8" style="font-family:verdana;font-weight:bold;background:#eeeeff;border-style:none"> <b>Sum Die Qty</b>   <input type=text name="sumdie" size="13" style="font-family:verdana;font-weight:bold;background:#eeeeff;border-style:none"> <%//Angela Zhang 20050221 begin%>    <a href="inventory_do_query_excel.jsp?materialno=<%=request.getParameter("materialno").toUpperCase()%>&plant=<%=request.getParameter("plant").toUpperCase()%>&stloc=<%=request.getParameter("stloc").toUpperCase()%>&slotid=<%=request.getParameter("slotid").toUpperCase()%>&compare=<%=request.getParameter("compare").toUpperCase()%>&yield=<%=request.getParameter("yield")%>&i_customerid=<%=request.getParameter("i_customerid").toUpperCase()%>&destination=<%=request.getParameter("destination").toUpperCase()%>&grade=<%=request.getParameter("grade").toUpperCase()%>&status=<%=request.getParameter("status").toUpperCase()%>&role=<%=session.getAttribute("role")%>" target="_blank">Download </a> <%//Angela Zhang 20050221 end%> <table bgcolor="white" id="oTable" onclick="sortColumn(event)" width="2600" align="center" bordercolorlight="#2D4285" bordercolordark="#ffffff" border="1" cellspacing="0" cellpadding="0"> <thead> <tr> <td><b>Select</b></td><td><b>Status</b></td> <td width=4><b>Book Mark</b></td> <td><b>ProductID</b></td> <td><b>LotID</b></td> <td width=4><b>Lot Type</b></td> <td ><b>Due Date</b>(yyyy-mm-dd)</td> <td ><b>Reason</b></td> <td ><b>Remark</b></td> <td><b>ReceiveDate</b></td> <td><b>TotalQty</b></td> <td><b>Grade</b></td> <td><b>Unit</b></td> <td><b>ShipCode</b></td> <td><b>Yield(%)</b></td> <td><b>G_Die_C</b></td> <td><b>Unrestr.QTY</b></td> <td><b>BatchID</b></td> <td><b>Wafer ID</b></td> <td><b>Destination</b></td><td><b>Wafer Start Date</b></td> <td><b>Customer Lot ID</b></td><td><b>CustomerID</b></td> <td><b>SMICCustomerLotID</b></td><td><b>Term Code</b></td><td><b>Ownership</b></td> <td><b>Plant</b></td><td><b>Storage</b></td><td><b>Reserve No</b></td> <td><b>ReceivePerson</b></td> <td width="60"><b>Customer Criteria</b></td> </tr> </TR> </thead> <% do { n = n + 1; if ((show_status.equals("FREE") && (e_lotinfo.getString("STATUS").equals(""))) || show_status.equals("")) { if (e_lotinfo.getString("SHIPID").equals("")) { pshipid="-"; }else{ pshipid=e_lotinfo.getString("SHIPID"); } if (e_lotinfo.getString("G_DIE_C").equals("")) { pg_die_c="0"; }else{ pg_die_c=e_lotinfo.getString("G_DIE_C"); } //--add by summer gao on 2005-9-20-- over_flag = 0; length1 = 0; temp_flag = 0; d_year = ""; d_month = ""; d_day = ""; temp3 = ""; temp4 = ""; today = 0; receive_date = 0; left = 0; rec_date = e_lotinfo.getString("RECEIVEDATE"); if (rec_date.equals("")) { temp_flag = 4; }else{ length1 = rec_date.length(); if (length1 == 8) { d_year = rec_date.substring(0,4); d_month = rec_date.substring(5,6); temp4=new String(str.concat(d_month.substring(0,1))); d_month = temp4; d_day = rec_date.substring(7,8); temp3=new String(str.concat(d_day.substring(0,1))); d_day = temp3; temp3=new String(d_year.concat(d_month)); temp4=new String(temp3.concat(d_day)); rec_date = temp4; }else{ if (length1 == 10) { d_year = rec_date.substring(0,4); d_month = rec_date.substring(5,7); d_day = rec_date.substring(8,10); temp3=new String(d_year.concat(d_month)); temp4=new String(temp3.concat(d_day)); rec_date = temp4; }else{ if (length1 == 9) { d_year = rec_date.substring(0,4); d_month = rec_date.substring(5,7); if (d_month.substring(1,2).equals("-")) { temp4=new String(str.concat(d_month.substring(0,1))); d_month = temp4; d_day = rec_date.substring(7,9); temp3=new String(d_year.concat(d_month)); temp4=new String(temp3.concat(d_day)); rec_date = temp4; }else{ d_day = rec_date.substring(7,9); temp3=new String(str.concat(d_day.substring(1,2))); d_day = temp3; temp3=new String(d_year.concat(d_month)); temp4=new String(temp3.concat(d_day)); rec_date = temp4; } } } } today = Integer.parseInt(dateString); receive_date= Integer.parseInt(rec_date); left = today - receive_date; if (left > 10000){ over_flag = 8; } } //-- %> <%if ((e_lotinfo.getString("USEQTY").equals("0"))&&( !e_lotinfo.getString("STATUS").equals("S"))) { %> <tr bgcolor=beige> <%}else if ( e_lotinfo.getString("NOT_MATCH").equals("Y")) {%> <tr bgcolor="#E893AF"> <%}else if ( e_lotinfo.getString("STATUS").equals("R")) {%> <tr bgcolor="#eeeeff"> <%}else if ( e_lotinfo.getString("STATUS").equals("S")) {%> <tr bgcolor="#ffeeee"> <%}else if ( e_lotinfo.getString("STATUS").equals("")) { %> <tr> <%}else if ( e_lotinfo.getString("STATUS").equals("B")) {%> <tr bgcolor="orange"> <%//}else if (over_flag == 8) { // out.println("DDDD"); %> <%}%> <td align=center> <!--Add by summer gao in 20040616 for new ship function--> <%if (e_lotinfo.getString("SHIPID").equals("")) { %> <input type="checkbox" name="slotid" onclick=sumvalue(this) value="<%=pshipid%>"> <%}else{ %> <input type="checkbox" name="slotid" onclick=sumvalue(this) value="<%=pshipid+"+"+e_lotinfo.getString("RECEIVEPERSON")%>"> <%}%> <input type="checkbox" name="lotproduct" value="<%=e_lotinfo.getString("PRODUCTID")+"+"+e_lotinfo.getString("PLANT")+"+"+e_lotinfo.getString("SMICLOTID")%>" style="display:none;"> <input type="hidden" name="slotid1" value="<%=e_lotinfo.getString("USEQTY")%>"> <input type="hidden" name="slotid2" value="<%=pg_die_c%>"> </td> <%if (e_lotinfo.getString("STATUS").equals("B")) { %> <td>Error</td> <%}else if ((e_lotinfo.getString("USEQTY").equals("0"))&&(!e_lotinfo.getString("STATUS").equals("S"))) {%> <td>X</td> <%}else if (e_lotinfo.getString("STATUS").equals("")) {%> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("STATUS")%></td> <%}%> <%if (e_lotinfo.getString("MARK").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("MARK")%></td> <%}%> <td><%=e_lotinfo.getString("PRODUCTID")%></td> <input type="hidden" name=<%="ProdID"+n%> value="<%=e_lotinfo.getString("PRODUCTID")%>"> <td><%=e_lotinfo.getString("SMICLOTID")%></td> <input type="hidden" name=<%="LotID"+n%> value="<%=e_lotinfo.getString("SMICLOTID")%>"> <%//Fly Long add Lot Type 20050905 if (e_lotinfo.getString("LOTTYPE").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("LOTTYPE")%></td> <%}%> <td nowrap width=135> <%if (e_lotinfo.getString("INVDUEDATE").equals("")) { %> <input type="text" size="9" name=<%="invduedate"+n%> value="" onFocus="this.blur();openWindow('querylotid.invduedate'+<%=n%>,'s');"> <input type="button" name=<%="cleardate"+n%> onclick=clear_date(<%=n%>) value="Reset" size="3"> <%}else{%> <input type="text" size="9" name=<%="invduedate"+n%> value=<%=e_lotinfo.getString("INVDUEDATE")%> onFocus="this.blur();openWindow('querylotid.invduedate'+<%=n%>,'s');"> <input type="button" name=<%="cleardate"+n%> onclick=clear_date(<%=n%>) value="Reset" size="3"> <%}%> </td> <td width=130> <%if (e_lotinfo.getString("REASON").equals("")) { %> <select name=<%="reason"+n%> style="font-size:9pt"> <option value=""> </option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="OTHER">Other</option> </select> <%}else if (e_lotinfo.getString("REASON").equals("CUSTOMER PULL IN")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("CUSTOMER PUSH OUT")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("ENG ISSUE")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="ENG ISSUE">Eng Issue</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("OTHER")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="OTHER">Other</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="WAIT SCRAP">Wait scrap</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("NO PO") || e_lotinfo.getString("REASON").equals("BACKUP WAFER")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("CUSTOMER RETURN")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="CUSTOMER RETURN">Customer return</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("WAIT SCRAP")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="WAIT SCRAP">Wait scrap</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("PULL AHEAD PO")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}else if (e_lotinfo.getString("REASON").equals("YIELD IMPROVEMENT")) {%> <select name=<%="reason"+n%> style="font-size:9pt"> <option value="YIELD IMPROVEMENT">Yield improvement</option> <option value="WAIT SCRAP">Wait scrap</option> <option value="CUSTOMER PULL IN">Customer pull in</option> <option value="CUSTOMER PUSH OUT">Customer push out</option> <option value="ENG ISSUE">Eng Issue</option> <!-Angela 20061113--> <!--<option value="NO PO">No PO</option>--> <option value="BACKUP WAFER">Backup wafer</option> <option value="PULL AHEAD PO">Pull ahead PO</option> <option value="CUSTOMER RETURN">Customer return</option> <option value="OTHER">Other</option> <option value=""> </option> </select> <%}%> </td> <td width=100><input type="text" size="30" name=<%="reason_remark"+n%> value="<%=e_lotinfo.getString("REASON_REMARK")%>"> <%//--add by lily tian for BJ FG WH if (e_lotinfo.getString("RECEIVEDATE").equals("")) { %> <td> </td> <%}else{ //--add by summer gao if (over_flag == 8) { %> <td><font color="#FF0000"><b><%=e_lotinfo.getString("RECEIVEDATE")%></b></font></td> <%}else{%> <td><%=e_lotinfo.getString("RECEIVEDATE")%></td> <%} } %> <td><%=e_lotinfo.getString("TOTALSTOCKQTY")%></td> <%if (e_lotinfo.getString("ZGRADE").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("ZGRADE")%></td> <%}%> <td><%=e_lotinfo.getString("MEINS")%></td> <td><%=e_lotinfo.getString("SHIPPROCESS")%></td> <%if (e_lotinfo.getString("YIELD").equals("")) { %> <td> </td> <%}else{%> <td> <% //=e_lotinfo.getString("YIELD") pyield = Float.parseFloat(e_lotinfo.getString("YIELD")); showyield = (new Float(pyield*100)).intValue(); out.print (showyield); %> </td> <%}%> <td> <%if (e_lotinfo.getString("PRODUCTID").indexOf("-") == -1) {%> <a href="update_gdc.jsp?productid=<%=e_lotinfo.getString("PRODUCTID")%>&plant=<%=e_lotinfo.getString("PLANT")%>&slotid=<%=e_lotinfo.getString("SMICLOTID")%>"> <%=pg_die_c%> </a> <%}else{%> <%=pg_die_c%> <%}%> </td> <td><%=e_lotinfo.getString("USEQTY")%></td> <td><%=pshipid%></td> <%if (e_lotinfo.getString("WAFERID").equals("")) { %> <td> </td> <%}else{%> <td> <%if (e_lotinfo.getString("PRODUCTID").indexOf("-") == -1) {%> <a href="javascript:openwin('wafer_detail.jsp?productid=<%=e_lotinfo.getString("PRODUCTID")%>&plant=<%=e_lotinfo.getString("PLANT")%>&slotid=<%=e_lotinfo.getString("SMICLOTID")%>','','250','800')"> <%=e_lotinfo.getString("WAFERID")%> </a> <%}else{%> <%=e_lotinfo.getString("WAFERID")%> <%}%> </td> <%}%> <%if (e_lotinfo.getString("DESTINATION").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("DESTINATION")%></td> <%}%> <%if (e_lotinfo.getString("STARTDATE").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("STARTDATE")%></td> <%}%> <%if (e_lotinfo.getString("CUSTOMERLOTID").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("CUSTOMERLOTID")%></td> <%}%> <%if (e_lotinfo.getString("SMICCUSTID").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("SMICCUSTID")%></td> <%}%> <%if (e_lotinfo.getString("SMICCUSTLOTID").equals("")) { %> <td> </td> <%}else{%> <td align=center><%=e_lotinfo.getString("SMICCUSTLOTID")%></td> <%}%> <%if (e_lotinfo.getString("SMICTERMCODE").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("SMICTERMCODE")%></td> <%}%> <%if (e_lotinfo.getString("OWNERSHIP").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("OWNERSHIP")%></td> <%}%> <td><%=e_lotinfo.getString("PLANT")%></td> <td><%=e_lotinfo.getString("SLOC")%></td> <%if (e_lotinfo.getString("RESERVENO").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("RESERVENO")%></td> <%}%> <%//--add by summer gao for ship function if (e_lotinfo.getString("RECEIVEPERSON").equals("")) { %> <td> </td> <%}else{%> <td><%=e_lotinfo.getString("RECEIVEPERSON")%></td> <%}%> <%if (e_lotinfo.getString("CUSTOMERCRITERIA").equals("")) { %> <td> </td> <%}else{%> <td align=center><%=e_lotinfo.getString("CUSTOMERCRITERIA")%></td> <%}%> </tr> <% } } while(e_lotinfo.nextRow()); %> </table> <%if (!("VIEW_SH01".equals(session.getAttribute("role"))||"VIEW_BJ01".equals(session.getAttribute("role"))||"VIEW_TJ01".equals(session.getAttribute("role")) ||"VIEW_WH01".equals(session.getAttribute("role")) || "SA_SH01".equals(session.getAttribute("role"))||"SA_BJ01".equals(session.getAttribute("role"))||"SA_TJ01".equals(session.getAttribute("role"))||"SA_WH01".equals(session.getAttribute("role")))) {%> //update by maple <tr> <td colspan="2" align="left">                      <input type="submit" name="Submit" value="Submit" style="font-family:verdana;background:#B9BECB">            <input type="reset" name="Submit2" value="Reset" style="font-family:verdana;background:#B9BECB"> <input type="hidden" name="rown" value="<%=n%>"> </td> </tr> <%}%> </form> <% } else { out.println("<img src=pic/wrong.gif> <b> Sorry, system have no fixed Lots data.</b>"); }%> <%} catch (Exception ex) { System.out.println("Caught an exception: \n" + ex); } finally { JCO.releaseClient(client); JCO.removeClientPool(SID); } System.out.println("row n=" + n); %> </td></tr> <%@ include file="bookbottom.jsp" %> 代码转为controller Service ServiceImpl 去掉前端处理
最新发布
08-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值