导航:首页 > 文件教程 > 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教程参考答案相关的资料

热点内容
shell编辑文件内容 浏览:614
u盘驱动在哪个文件夹里 浏览:938
华为手机跟苹果手机怎么克隆app 浏览:172
cad文件为什么显示文件名是否正确 浏览:174
程序配置文件能自动转换成txt 浏览:985
r4烧录卡不同版本 浏览:962
怎么升级qq群为2000 浏览:347
微信己册除的文件怎样找回来 浏览:715
苹果美国账号共享2017 浏览:252
ps文件修改后打开还是原图 浏览:220
烧卡机苹果4微信qq哪里下载 浏览:780
ug120找不到指定文件 浏览:522
cda文件怎么转换成mp3格式 浏览:702
青岛hpv疫苗在哪个app预约 浏览:881
双十一成交额2021数据在哪里看 浏览:631
苹果手机怎么打开移动数据 浏览:637
文件扫描成图片是彩色的吗 浏览:50
编程里的comply什么意思 浏览:91
电脑上面点了禁用网络怎么改回来 浏览:28
javacatch执行 浏览:182

友情链接