当前位置:编程学习 > JSP >>

那位大神帮帮我! 求注释!!!JSP代码。。。

3. 搜索模块 String bookname = ""; String author = ""; String bookcon = ""; String isbn = ""; String searchkey = ""; String change = ""; int sellprice = 0; int sortid = 0; int curpage = 1; int perPageRows = 10; int pagecount = 0; int rowcount = 0; try{ change = request.getParameter("change"); searchkey = request.getParameter("searchkey"); bookname = request.getParameter("bookname"); author = request.getParameter("author"); bookcon = request.getParameter("bookcon"); isbn = request.getParameter("isbn"); sortid = Integer.parseInt(request.getParameter("sortid")); }catch(Exception e){} try{ curpage = Integer.parseInt(request.getParameter("curpage")); }catch(Exception e){} try{ sellprice = Integer.parseInt(request.getParameter("sellprice")); }catch(Exception e){} if(change!=null&&!change.equals("")) { if(change.equals("bookname")) bookname = searchkey; if(change.equals("author")) author = searchkey; if(change.equals("bookcon")) bookcon = searchkey; if(change.equals("isbn")) isbn = searchkey; } DisBooks disbooks = new DisBooks(conn,-1,bookname,author,bookcon,isbn,-1,sellprice,-1,-1,sortid,curpage,perPageRows,"intime"); curpage = disbooks.getCurpage(); pagecount = disbooks.getPageCount(); rowcount = disbooks.getRowCount(); Vector books = disbooks.getData(); Book book = null; for(int i=0;i<books.size();i++) { book = (Book)books.elementAt(i); 我qq172823183!!!谢谢了
追问:
        	
				
那您帮我解释一下吧    救命的!!!
有那么急么?我看看先
答案:这个报错了么?   很容易理解的代码啊
其他:change = request.getParameter("change");
这样的是从请求url里面获取参数值
if(change!=null&&!change.equals(""))
里面是值为空的话设置默认值
其实最关键是这个方法是干嘛的
DisBooks disbooks = new DisBooks(conn,-1,bookname,author,bookcon,isbn,-1,sellprice,-1,-1,sortid,curpage,perPageRows,"intime");
估计是你的业务逻辑
然后后面的就是根据的你的业务逻辑得到的结果获取你需要的值了 

上一个:如何在jsp页面上实现点击注册按钮,弹出一个窗体来注册(类似于百度贴吧的登录和注册),求详细代码和注释
下一个:如何是JS中嵌入JSP代码?

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,