商务合作:179001057@qq.com

做了一些项目后的总结

技术2022-05-11  0


某平台价值19860元的编程课程资料免费领取【点我领取】


将变量及参数多多输出可以找到错误。也会使程序层次更清晰。要给程序多加注释。

 

分页要注意要保留上次的输入。1.在同一个jsp中要用到request.getparemeter();<%    String pages = request.getParameter("dipage");    if (request.getParameter("dipage") == null || pages.length() == 0) {   %>   <input type="text" name="dipage" size="4">   <%    pages = "1";    } else {   %>   <input type="text" name="dipage" size="4"    value=<%=request.getParameter("dipage")%>>   <%   }   %>

2.在sevelet中可以用request.getattribute();

%>    <a href="<%=request.getContextPath() %>/servlet/Sellservelets?pageNow=<%=pageNow - 1%>&mtype=<%=(String)request.getAttribute("mtype")%>">上一页</a>    <a href="<%=request.getContextPath() %>/servlet/Sellservelets?pageNow=1&mytpe=<%=(String)request.getAttribute("mtype")%>">首页</a>    <%      }     if (pageNow < pageCount) {    %>    <a href="<%=request.getContextPath() %>/servlet/Sellservelets?pageNow=<%=pageNow + 1%>&mtype=<%=(String)request.getAttribute("mtype")%>">下一页</a>    <a href="<%=request.getContextPath() %>/servlet/Sellservelets?pageNow=<%=pageCount%>&mtype=<%=(String)request.getAttribute("mtype")%>">尾页</a>    <%     }         %>


最新回复(0)