当前位置:首页 » 软件设计 » JSP程序设计

JSP程序设计

发布时间: 2020-12-15 04:59:04

⑴ jsp程序设计

直接用 javascript脚本就可以实现。
把下面一段代码保存为 test.html 双击运行就可以。

如果内想调整时间,容修改setTimeout("go()",3000);
3000表示3秒...

<html>
<head>
<title>newpaeg</title>
<script language='Javascript'>
function change(){

window.location="http://www..com";

setTimeout("go()",3000);
}

</script>
</head>

<body onLoad="change()">
3秒后跳转
</body>
</html>

⑵ jsp程序设计

用Struts 来做,就一JSP,
表单上 添加
<body>
<from action="User.do">
Username:<input typr="text" name="U_name"/><br>
Password:<input tyoe="password" name="U_pass"/><br>
<radio/>
.
.
.
// 需要什么再添加什么
<input type="submit" value="确定"/>
</from>
</body>

JSP页面写好了,添加一个form 做表单收集
public class From extends ActionForm {
private String U_name;

private String U_password;

public String getU_name() {
return U_name;
}

public void setU_name(String u_name) {
U_name = u_name;
}

public String getU_password() {
return U_password;
}

public void setU_password(String u_password) {
U_password = u_password;
}
}

写一个Ation类,从fron得到数据,传到DAO层,做数据库写入操作

⑶ 《JSP程序设计》期末考试试题A

so easy!

⑷ JSP程序设计中的"i++"什么意思

这个 i++ 对于java程序,是指 i 这个变量 自增 1 的意思
如:
int i = 0;
执行完这行代码 后 i++;
i 的值已经变成了1 。

i++ 意思 是,自增加 1

⑸ JSP程序设计

jsp代码:
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<table width="80%" border="1" align="center">
<tr>
<td height="61" colspan="2" align="center">
<jsp:include page="head.jsp"></jsp:include>
</td>
</tr>
<tr>
<td width="21%" height="208" align="center">
<jsp:include page="left.jsp"></jsp:include>
</td>
<td width="86%" align="center">
<font color="red">${list }</font>
<form action="UserServlet" method="post">
姓名:<input type="text" name="username"><br>
密码:<input type="text" name="password"><br>
<input type="submit" value="登录"><input type="reset" value="重置">
</form>
</td>
</tr>
<tr>
<td height="68" colspan="2" align="center">
<jsp:include page="tail.jsp"></jsp:include>
</td>
</tr>
</table>
</body>
</html>

servlet代码:
package com.test.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.gly.bean.UserPlace;

@SuppressWarnings("serial")
public class UserServlet extends HttpServlet {

/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @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 doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String method = request.getParameter("method");
String username = request.getParameter("username");
String password = request.getParameter("password");

UserPlace user = new UserPlace();
if(user.Login(username, password)){
request.getRequestDispatcher("suce.jsp").forward(request, response);
}
else{
request.setAttribute("list", "抱歉!您的帐号或密码有误");
request.getRequestDispatcher("login.jsp").forward(request, response);
}
}
}
else{
request.getRequestDispatcher("jsp/error.jsp").forward(request, response);
}
}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to 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)
throws ServletException, IOException {

this.doGet(request, response);
}

}

⑹ JSP程序设计

可以做的,拍视频演示demo

热点内容
美发店认证 发布:2021-03-16 21:43:38 浏览:443
物业纠纷原因 发布:2021-03-16 21:42:46 浏览:474
全国著名不孕不育医院 发布:2021-03-16 21:42:24 浏览:679
知名明星确诊 发布:2021-03-16 21:42:04 浏览:14
ipad大专有用吗 发布:2021-03-16 21:40:58 浏览:670
公务员协议班值得吗 发布:2021-03-16 21:40:00 浏览:21
知名书店品牌 发布:2021-03-16 21:39:09 浏览:949
q雷授权码在哪里买 发布:2021-03-16 21:38:44 浏览:852
图书天猫转让 发布:2021-03-16 21:38:26 浏览:707
宝宝水杯品牌 发布:2021-03-16 21:35:56 浏览:837