导航:首页 > 文件教程 > jsp教程参考答案

jsp教程参考答案

发布时间:2023-07-30 03:46:21

1. jsP简单编程题求答案

特意花时间帮你写了一个,三个文件分别如下:1.logon.jsp<%@page contentType="text/html" pageEncoding="UTF-8"%> http://www.w3.org/TR/html4/loose.dtd"> JSP Page 用户名 密码 2.Logon.java(Servlet)import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class Logon extends HttpServlet implements Filter { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String password = request.getParameter("password"); request.getSession().setAttribute("user", name + " " + password); System.err.println(name + " " + password); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } public String getServletInfo() { return "Short description"; } public void init(FilterConfig arg0) throws ServletException { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { try { request.setCharacterEncoding("UTF-8");//设置编码 ((HttpServletResponse) response).setHeader("Pragma", "No-cache"); ((HttpServletResponse) response).setHeader("Cache-Control", "no-cache"); ((HttpServletResponse) response).setHeader("Expires", "0");//禁止缓存 filterChain.doFilter(request, response); } catch (ServletException sx) { } catch (IOException iox) { } }}3.web.xml ?xml version="1.0" encoding="UTF-8"? http://java.sun.com/xml/ns/javaee" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> Logon Logon Logon /Logon 30 index.jsp 接分,呵呵。

2. JSP编程题目求答案


publicclassRectangle{

privateIntegerrLength;//长

privateIntegerrWidth;//宽

privateIntegerrArea;//面积

publicIntegergetrLength(){
returnrLength;
}

publicvoidsetrLength(IntegerrLength){
this.rLength=rLength;
}

publicIntegergetrWidth(){
returnrWidth;
}

publicvoidsetrWidth(IntegerrWidth){
this.rWidth=rWidth;
}

publicIntegergetrArea(){
returnrArea;
}

publicvoidsetrArea(IntegerrArea){
this.rArea=rArea;
}

}
<%@pagelanguage="java"contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8"%>

<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8">
<metaname="renderer"content="webkit|ie-comp|ie-stand">
<metahttp-equiv="X-UA-Compatible"content="IE=edge,chrome=1">
<metaname="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<metahttp-equiv="Cache-Control"content="no-siteapp"/>
<scripttype="text/javascript"src="jquery/1.9.1/jquery.min.js"></script>
<title></title>
</head>

<body>
<div>
<formaction="/xxxxxxxx"method="post"id="form-depart-edit">
<div>
<label><span>*</span>长:</label>
<div>
<inputtype="text"class="input-text"value=""placeholder="长"id="rLength"name="rLength">
</div>
</div>
<div>
<label><span>*</span>宽:</label>
<div>
<inputtype="text"class="input-text"value=""placeholder="宽"id="rWidth"name="rWidth">
</div>
</div>
<div>
<label><span>*</span>面积:</label>
<div>
<inputtype="text"value=""placeholder="面积"id="rArea"name="rArea"readonly="readonly">
</div>
</div>
<div>
<buttononClick="jisuan();"type="button">提交</button>
</div>
</form>
</div>
<scripttype="text/javascript">
functionjisuan(){
varrLength=$("#rLength").val();
varrWidth=$("#rWidth").val();
if(rWidth==null||rWidth==""||rLength==null||rLength==""){
alert("必须填写长、宽!");
returnfalse;
}
varrArea=rLength*rWidth;
$("#rArea").val(rArea);
$("#form-depart-edit").submit();
}
</script>
</body>
</html>

3. JSP实用教程(第二版)课后习题答案

jsp的答案是:抄
你在删除那里写个连接,然后将该行的id获得
<a href="DelUserServlet?id=<%=((User)users.get(i)).getId()%>">删除</a>
再在servlet里面取这个id
String id=request.getParameter("id");

关于数据库,你应该将book的状态设置成默认为没借,这个类型可以声明成int,比如,0代表没借1代表借了,这样添加的书本都是没借的才合理

至于第3个表里面要有id,还要有用户账号,图书id,

去这里参考一下:http://ishare.iask.sina.com.cn/search.php?key=JSP%CA%B5%D3%C3%BD%CC%B3%CC&format=

4. jsp程序设计教程课后习题答案

checkRegis.jsp页
给你写一部分参考一下吧
<%
String uname=request.getParameter("取值");
String upass=request.getParameter("取值");
if(uname.equls("user")){
%>

<script type="text/javascript">
alert("该用户已经注册",window.location.href="register.jsp");
</script>
<%
}
%>

阅读全文

与jsp教程参考答案相关的资料

热点内容
有什么女生主动聊天的app 浏览:436
有哪些可以督促自己的app 浏览:244
用USB传输视频文件夹显示为空 浏览:710
恢复文件软件免费版手机 浏览:648
lg怎么隐藏文件 浏览:836
苹果免费读书app推荐 浏览:497
刘骏微信 浏览:113
书旗旧版本80 浏览:467
教编程考什么证 浏览:990
下载编程猫后哪里有客服 浏览:13
如何编辑歌曲文件格式 浏览:638
cf无限领取cdk工具 浏览:350
如何让手机文件保存到电脑上 浏览:459
sa数据库默认密码是多少 浏览:191
电脑正在查找文件 浏览:541
一个文件盒省内寄顺丰多少钱 浏览:41
诛仙62坐骑怎么升级到63 浏览:926
linux以日期查看日志记录 浏览:446
工业大数据是什么东西 浏览:881
魅族note3怎么重置网络 浏览:510

友情链接