ImageVerifierCode 换一换
格式:DOCX , 页数:41 ,大小:23.26KB ,
资源ID:6307293      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-6307293.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Java实验.docx)为本站会员(b****4)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

Java实验.docx

1、Java实验实验一Index.jsp: 请输入用户名: 请输入密码: Check.java/servletpublic void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException response.setContentType(text/html;charset=gb2312); String username=new String(request.getParameter(username).getBytes(iso-8859-1),gb2

2、312); String password=request.getParameter(password); user User=new user(); PrintWriter out=response.getWriter(); if(username=|password=) out.println(The username and the password would not be Null!); else if (username.equals(User.user1)|username.equals(User.user2) if (password.equals(User.password1

3、)&username.equals(User.user1) |(password.equals(User.password2)&username.equals(User.user2) out.println(Welcome!); else out.println(You are not the VIP!); out.flush(); out.close(); 实验二(1) login.jsp: 用户名: 密码: Check.jsp: Final.jsp: 用户名为: (2) login.jsp: 昵称: Message.jsp: alert(请先登录);location.href=login.

4、jsp; 欢迎来到聊天室  编号留言标题留言者昵称留言时间 a href=web_message/showmessage.jsp?id= 发新留言 Showmessage: 留言内容 返回列表 标题 时间 作者 内容 Addmessage.jsp 添加留言 返回列表 留言标题: 留言内容: Message_bean.javapackage bean;import java.util.Date;public class Message public Message() public Message(int id,String title,String nickname,String c

5、ontent) this.id = id; this.title = title; this.nickname = nickname; this.content = content; this.time = new Date().toString(); /编号、留言标题、留言者昵称、留言时间 private int id; private String title,nickname,content,time; public String getContent() return content; public void setContent(String content) this.conten

6、t = content; public int getId() return id; public void setId(int id) this.id = id; public String getTitle() return title; public void setTitle(String title) this.title = title; public String getNickname() return nickname; public void setNickname(String nickname) this.nickname = nickname; public Stri

7、ng getTime() return time; public void setTime(String time) this.time = time; (3) Add.jsp: 商品编号: 商品名字: 商品单价: 生产厂商: InsertServlet.java:package One;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http

8、.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import javax.servlet.http.HttpServlet;public class InsertServlet extends HttpServlet /* * The doPost method of the servlet. * * This method is called when a form has its tag value method equals to

9、 post. * * param request the request send by the client to the server * param response the response send by the server to the client * throws ServletException if an error occurred * throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response

10、) throws ServletException, IOException response.setContentType(text/html;charset=gb2312); HttpSession session = request.getSession(); String no=new String(request.getParameter(NO).getBytes(iso-8859-1),gb2312);/(iso-8859-1),gb2312); String price=new String(request.getParameter(Price).getBytes(iso-885

11、9-1),gb2312); String name=new String(request.getParameter(Name).getBytes(iso-8859-1),gb2312); String factory=new String(request.getParameter(Factory).getBytes(iso-8859-1),gb2312); session.setAttribute(NO,no); session.setAttribute(Price,price); session.setAttribute(Name,name); session.setAttribute(Fa

12、ctory,factory); response.sendRedirect(addfinish.jsp); Addfinish.jsp 商品编号: 商品名字: 商品单价: 生产厂商: 实验三(1)student.jsppackage bean;public class student private String stuNum; private String stuName; private String telephone; private String email; private String address; private String postCode; public String

13、 getStuNum() return stuNum; public void setStuNum(String stuNum) this.stuNum = stuNum; public String getStuName() return stuName; public void setStuName(String stuName) this.stuName = stuName; public String getTelephone() return telephone; public void setTelephone(String telephone) this.telephone =

14、telephone; public String getEmail() return email; public void setEmail(String email) this.email = email; public String getAddress() return address; public void setAddress(String address) this.address = address; public String getPostCode() return postCode; public void setPostCode(String postCode) thi

15、s.postCode = postCode; Insert.javapublic class Insert extends HttpServlet public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException response.setContentType(text/html;charset=utf-8); request.setCharacterEncoding(utf-8); student stu1 =new student

16、(); stu1.setStuNum(request.getParameter(stuNum); stu1.setStuName(request.getParameter(stuName); stu1.setTelephone(request.getParameter(telephone); stu1.setAddress(request.getParameter(address); stu1.setEmail(request.getParameter(email); stu1.setPostCode(request.getParameter(postCode); int num; try num=Integer.parseInt(stu1.getStuNum().trim(); catch(Exception e)num=0; System.out.print(未输入学号!); String sqlString =null;/Sql 语句 sqlString =insert

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2