JavaWeb不定条件クエリー
7136 ワード
Web , , , SQL , SQL , SQL , , , , CSDN xulu_258 ( , JSP
MainPerson.jsp
Servlet :
, queryperson();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pname=request.getParameter("qpname");
String pnumber=request.getParameter("qpumber");
String xl=request.getParameter("qxl");
String jszc=request.getParameter("qjszc");
String bsal=request.getParameter("bsal");
String esal=request.getParameter("esal");
String val[]={pname,pnumber,xl,jszc,bsal,esal};
PersonServices service=new PersonServices();
try {
List
:
, StringBuilder new , :"select * from person( ) where 1=1", where 1=1 and, if where and. if sql.append("and name=?"), 。
, , List , List , , List , List 。
public List
, ResultSetMetaData List
, ,