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

热点内容
win7自带截图工具不能用 浏览:939
javamail发送html邮件 浏览:682
穿越火线枪战王者游戏录制在哪个文件夹 浏览:10
cad图复制到另一个cad文件标注变形 浏览:198
腾讯大数据平台部属于哪个群 浏览:350
电极自动编程哪个软件好用 浏览:550
cad看图大师下载的文件在哪 浏览:227
硬盘损坏内部数据怎么修 浏览:880
微信你真列害图片大全 浏览:49
jsin类型可以传数值吗 浏览:532
win10文件从左边滑出 浏览:53
win10关机后桌面文件丢失 浏览:266
watch卸载自带应用程序 浏览:292
有什么plc自学网站 浏览:219
176纯金币假人版本 浏览:334
红米note4微信计步代码 浏览:259
站长之家有app吗 浏览:912
office应用视频教程 浏览:690
html数据库有哪些 浏览:489
钢笔工具线不会变细 浏览:762

友情链接