文档介绍:jsp,内置对象实验报告
第四章 JSP 内置对象实验报告
第四章 JSP 内置对象
实验一:request对象
1,相关知识点
在就是jsp中,内置对象request封装了用户请求信息时所提交的信息,那么该对象调用相应的方法可以获取封装的信息,即使用该对象可以获取用户提交的信息。
2,参考代码:
:
[email protected]/* */ contentType=text/html;charset=gb2312%
head%@ include file=%/head
[email protected]/* */ tagdir=/WEB-INF/tags prefix=look%
htmlbody bgcolor=pinkfont size=2
form action= method=post
请输入注册信息,用户名必须由字母或数字组成,带*为必填项。
table border=1
trtd员工编号:/tdtdInput type=text name=id*/td/tr
trtd用户名:/tdtdInput type=text name=name*/td/tr
trtd用户密码:/tdtdInput type=text name=password*/td/tr
trtd用户权限(Y/N):/tdtdInput type=text name=right*/td/tr
trtd性别:/tdtdInput type=text name=sex*/td/tr
trtd联系电话:/tdtdInput type=text name=phone/td/tr
trtd备注:/tdtdInput type=text name=remark/td/tr
/table
brInput type=submit name=b value=提交
br注册前
look:QueryTag dataSource=SupermarketMS tableName=Staff user=sa password=sa/ br%=queryResult%
/font/body/html
[email protected]/* */ contentType=text/html;charset=gb2312%
%@ taglib tagdir=/WEB-INF/tags prefix=inquire%
htmlbody bgcolor=pinkfont size=2
%
String ID=(id);
String aa=(name);
String PassWord=(password);
String Right=(right);
String Sex=(sex);
String Phone=(phone);
String Remark=(remark);
byte bb[]=(iso-8859-1);
aa=new String(bb);
%
inquire:Register_2 ID=%=ID% nn=%=aa% pw=%=PassWord%right=%=Right% sex=%=Sex%phone=%=Phone%remark=%=Remark%/
br注册后所有员工信息
inquire:QueryTag dataSource=SupermarketMS tableName=Staff user=sa password=sa/
br%=queryResult%
/font/body/html
:
[email protected]/* */ pageEncoding=gb2312%
[email protected]/* */ import=.*%
%@ attribute name=ID required=true%
%@ attribute name=nn required=true%
%@ attribute name=pw required=tr