ホームページ >ウェブフロントエンド >htmlチュートリアル >JSP+サーブレットの質問は 100 点です。すべて受けていただけますか_html/css_WEB-ITnose
を要求します。
0dd737a2fe7af14e2110dae3fcd32bdf
f83abd538a37a3d1d2056473c56ba916
9df77c0d95530ae338b8abcca04b846f
ee245328f5ba53565b3277cdb499a45f
6a7ad55982668d7d34f9521d5775458c
function IsDigit(cCheck)
{
return (('0'f7907d41b3ee4fa6f336408c2e947112
6718135b29893a7d17041dc2dea225af
td,th {
font-family: Arial, Helvetica, sans-serif;
フォントサイズ: 14px;
行の高さ: 24px;
カラー:#333333;
}
img {
background-repeat: none;
背景位置: 中央;
}
a2d87b9af1e305217ec9648d1e8a0a47
9c3bca370b5104690d9ef395f2c5f8d1
844b2b3b1d6bd3486ee63ff4c0d24c51/image/content.jpg">
dfb4d23c807e8ce66d86a7db2dd1cbbb 尊敬する5b3e556b77a5be583492bc0e3ce7c2a2511b0bedb81f4cde98fa3f4cd3dd90d154bdf357c58b8a65c66d7c19c8e4d114请修正个人资料86ac1c50e272ae44fc078ccffb92bf34
0cbb9c151304f48d7e672764f1ef5b23/servlet/lybControServlet"
Method="post" onSubmit="docheck()">
6e6b5ed8e650ae8b8f2e7bfea4e85fbd
a34de1251f0d9fe1e645927f19a896e8
80bc85ab4563f7a3c96fae09a4a277c6afc954667d90f8eabc01cb549ecdade8用户名:e6e38b3c62e8df885fe2e3986461aa630d982cab94d706caf48984212e356b0feaf53d163d785ba61a0609db8c8063d6 「> dfcd5a29d05c5b117d6cda5a7044aaef 0c6dc11e160d3b678d68754cc175188a
b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
80bc85ab4563f7a3c96fae09a4a277c6请修改昵称:b90dd5946f0946207856a8a37f441edf
af0c006170b102628b3ee4eae646dbc299c7555199491264742123a8c7216993b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
80bc85ab4563f7a3c96fae09a4a277c6请修正性:b90dd5946f0946207856a8a37f441edf
af0c006170b102628b3ee4eae646dbc29cac8c32e646b29875270828397f7725男 47a915ae7ae5243e3d8d3a2d8711bb33女b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
80bc85ab4563f7a3c96fae09a4a277c6请修正Email 地址:b90dd5946f0946207856a8a37f441edf
af0c006170b102628b3ee4eae646dbc2a4d8d07ab594a28411c7db8f6290e351b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
271cb3d2ff227ca6331ee41e81293d65
e388a4556c0f65e1904146cc1a846bee
45a3c9849221f06c27221462913e274f 5b27ba212fefa0e9952bb6e4d9579f51
94b3e26ee717c64999d7867364b1b4a3
e388a4556c0f65e1904146cc1a846bee
00d493dff134553745672d138b9dc1a4返す5db79b134e9f6b82c0b36e0489ee08ed
94b3e26ee717c64999d7867364b1b4a3
f5a47148e367a6035fd7a2faa965022e
16b28748ea4df4d9c2150843fecfba68
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e
これは前台の代コード、後台方法怎么写ですか?
public void changeUserInfo(HttpServ letRequest req, HttpServletResponse res) throws IOException, SQLException{
int user_id = Integer.parseInt(req.getParameter("user_id"));
UserinfoBean userinfoBean = new UserinfoBean();
userinfoBean.setUser_name("");
userinfoBean.setUser_nicheng("");
userinfoBean.setUser_sex("");
userinfoBean.setUser_mail("");
userinfoBean.setUser_id(user_id);
HttpSession セッション = req.getSession() ;
session.setAttribute("userinfoBean", userinfoBean);
res.sendRedirect(req.getContextPath()+"/jsp/mofy.jsp");
}
この方法は私がすでに使用できていますが、書き込みがありません、大神高数を求めています
要求更新コード、struts フレームは使用しない
给你書了一简单的、
首先真的很简单、是 W7+mysql5.5+servlet
mysql の SQL 句:
りー
- -----------------
以下は Java 部分です:
DB 类[時間间仓促進,可改进地方很多,自己ゆっくり练吧]
create database person;use personcreate table student( id int not null auto_increment, username varchar(100), name varchar(50), sex varchar(10), email varchar(50), primary key(id));-- 插入一条测试数据insert into student(username,name,sex,email)values('test123','fdsaas','1','fdsafkldjsklfds@qq.com');
package test;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.sql.Statement;/** * Created by prd on 2014/11/6. */public class DB { private Connection conn = null; /** * 获取连接 * * @return * @throws java.sql.SQLException */ public Connection getConn() { try { Class.forName("com.mysql.jdbc.Driver");// 加载Mysql数据驱动 conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/person", "root", "123456"); return conn; } catch (Exception e) { e.printStackTrace(); } return conn; } /** * 关闭连接 * * @throws SQLException */ public void closeConn() { try { if (conn != null && conn.isClosed()) { conn.close(); } } catch (SQLException e) { e.printStackTrace(); } } /** * 更新数据. * <p/> * 数组分别是:username,name,sex,email, * id为固定.可动态修改. * * @param params * @return */ public int update(String[] params) { conn = getConn(); String sql = " update student set username='" + params[0] + "',name='" + params[1] + "',sex='" + params[2] + "',email='" + params[3] + "' where id=1 "; Statement st = null; int count = 0; try { st = conn.createStatement(); count = st.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); } closeConn(); return count; }}
package test;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import java.io.IOException;/** * Created by prd on 2014/11/6. */public class UpdateUserServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); String name = request.getParameter("name"); String username = request.getParameter("username"); String sex = request.getParameter("sex"); String email = request.getParameter("email"); if(sex.equals("0")) { sex="男"; }else { sex="女"; } DB db = new DB(); int count =db.update(new String[]{username,name,sex,email}); if(count>0) { System.out.println("更新成功"); }else { System.out.println("更新失败"); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }}
<form name="reg" action="<%=request.getContextPath()%>/servlet/UpdateUserServlet" method="post" onSubmit="docheck()"> <table width="90%" border="0"> <tr> <td width="50%" align="right" height="25"><font face="Arial, Helvetica, sans-serif">用户名:</font></td> <td width="50%" align="left" height="25"><input type="text" name="username" value=""> <input type="hidden" name="method" value="edituser"> <br> </td> </tr> <tr> <td width="50%" align="right" height="25">请修改昵称:</td> <td width="50%" align="left" height="25"><input type="text" name="name"></td> </tr> <tr> <td width="50%" align="right" height="25">请修改性别:</td> <td width="50%" align="left" height="25"><input type="radio"h name="sex" value="0" checked>男 <input type="radio" name="sex" value="1">女</td> </tr> <tr> <td width="50%" align="right" height="25">请修改Email地址:</td> <td width="50%" align="left" height="25"><input type="text" name="email"></td> </tr> </table> <p> <input type="submit" name="sub" value="更改"> <input type="reset" name="res" value="重填"> </p> <p> <a href="index.jsp">返回</a> </p> </form>
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <servlet> <servlet-name>UpdateUserServlet</servlet-name> <servlet-class>test.UpdateUserServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>UpdateUserServlet</servlet-name> <url-pattern>/servlet/UpdateUserServlet</url-pattern> </servlet-mapping></web-app>
大神、完全跟你写的不一样、我已经打私信给你了,你打开加我qq远成协助一下你就知道怎么回事了