1 表单的另一种参数传递方法:
2 防止为登陆浏览:
if(session.getAttribute("UserName")==null||session.getAttribute("UserName")=="")
{
out.println("");
}
else
{
%>
3验证 用户信息的合法性:
<%@ page language="java" import="java.sql.*" %>
<%! String bookid,bookNumS; int Id,bookNumI;
%>
<%
bookid=request.getParameter("bookid");//得到ID
bookNumS=request.getParameter("bookfield");//得到数量
if(bookNumS!=""&bookNumS!=null)
{
try
{
bookNumI=Integer.parseInt(bookNumS);//转换成int类型
Id=Integer.parseInt(bookid) ;
}
catch(NumberFormatException e)
{
out.println("");
}
boolean one=bookM.bookQuery(Id,bookNumI,""+session.getAttribute("loginTime"),""+session.getAttribute("UserName"));
if(one)
{
out.println("");
}
else
{
out.println("");
}
}
bookM.bclose();
}%>
4表单的检验