主题:大家救救小妹,看一下我的JSP代码吧
HTML代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>论文评语--评阅教师</title>
</head>
<body>
<form name="form1" method="POST" action="write.jsp">
<table width="100%" border="0">
<tr>
<td colspan="2"> <div align="left">请输入学号 :
<input type="text" name="studentid">
</div>
</td>
<td colspan="4"><div align="center"></div></td>
</tr>
<tr>
<td width="20%" rowspan="2"><div align="center">评价项目</div></td>
<td width="60%" rowspan="2"><div align="center">项目内涵</div></td>
<td colspan="4"><div align="center">等级</div></td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>论文选题</td>
<td>理论前瞻性、应用适用性、有助于解决实际问题或重大现实问题</td>
<td width="5%"><input name="radiobutton1" type="radio" value="A" checked></td>
<td width="5%"><input type="radio" name="radiobutton1" value="B"></td>
<td width="5%"><input type="radio" name="radiobutton1" value="C"></td>
<td width="5%"><input type="radio" name="radiobutton1" value="D"></td>
</tr>
<tr>
<td>论文结构</td>
<td>结构合理、程次分明、逻辑严明</td>
<td><input name="radiobutton2" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton2" value="B"></td>
<td><input type="radio" name="radiobutton2" value="C"></td>
<td><input type="radio" name="radiobutton2" value="D"></td>
</tr>
<tr>
<td>论文内容</td>
<td>构思新颖、思路清晰、论证充分、资料翔实、能熟练运用各种理论知识解决实际问题</td>
<td><input name="radiobutton3" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton3" value="B"></td>
<td><input type="radio" name="radiobutton3" value="C"></td>
<td><input type="radio" name="radiobutton3" value="D"></td>
</tr>
<tr>
<td>系统分析设计质量</td>
<td>系统分析、设计文档规范,正确</td>
<td><input name="radiobutton4" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton4" value="B"></td>
<td><input type="radio" name="radiobutton4" value="C"></td>
<td><input type="radio" name="radiobutton4" value="D"></td>
</tr>
<tr>
<td>图文格式</td>
<td>行文流畅、图文规范美观,无拼写错误</td>
<td><input name="radiobutton6" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton6" value="B"></td>
<td><input type="radio" name="radiobutton6" value="C"></td>
<td><input type="radio" name="radiobutton6" value="D"></td>
</tr>
<tr>
<td>基础知识</td>
<td>拥有宽广的知识面和扎实的理论基础;运用所学知识解决实际问题;熟练阅读外文资料</td>
<td><input name="radiobutton7" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton7" value="B"></td>
<td><input type="radio" name="radiobutton7" value="C"></td>
<td><input type="radio" name="radiobutton7" value="D"></td>
</tr>
<tr>
<td>文献综述</td>
<td>阅读文献数量充足,理解文献阐述内容,表述清楚</td>
<td><input name="radiobutton8" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton8" value="B"></td>
<td><input type="radio" name="radiobutton8" value="C"></td>
<td><input type="radio" name="radiobutton8" value="D"></td>
</tr>
<tr>
<td>翻译质量</td>
<td>译文流畅,用于准确</td>
<td><input name="radiobutton9" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton9" value="B"></td>
<td><input type="radio" name="radiobutton9" value="C"></td>
<td><input type="radio" name="radiobutton9" value="D"> </td>
</tr>
<tr>
<td colspan="6"> <input type="submit" name="Submit" value="提交" > <input type="reset" name="Submit2" value="重置">
</td>
</tr>
</table>
</form>
</body>
</html>
JSP页面代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=utf-8" pageEncoding="gb2312"%>
<%@ page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<jsp:useBean id="connbean" scope="page" class="lw.DbConn" />
<%String radio1=request.getParameter("radiobutton1");
String radio2=request.getParameter("radiobutton2");
String radio3=request.getParameter("radiobutton3");
String radio4=request.getParameter("radiobutton4");
String radio6=request.getParameter("radiobutton6");
String radio7=request.getParameter("radiobutton7");
String radio8=request.getParameter("radiobutton8");
String radio9=request.getParameter("radiobutton9");
String studid=request.getParameter("studentid");
int rs=connbean.executeUpdate(radio1, radio2, radio3, radio4, radio6, radio7, radio8, radio9,studid);%>
<%out.println("评分成功!");%>
</body>
</html>
JAVABEAN代码
package lw;
import java.sql.*;
public class DbConn{
String CLASSFORNAME="sun.jdbc.odbc.JdbcOdbcDriver";
String SERVANDDB="jdbc:odbc:cjpd";
String USER="";
String PWD="";
Connection connect=null;
ResultSet rs=null;
public DbConn(){
try {
Class.forName(CLASSFORNAME);
connect = DriverManager.getConnection(SERVANDDB,USER,PWD);
}catch(Exception e){ e.printStackTrace();}
}
public ResultSet executeQuery(String sql) {
try
{ Statement stmt=connect.createStatement();
rs=stmt.executeQuery(sql);
}catch(Exception e){ e.printStackTrace(); }
return rs;
}
public int executeUpdate( String radio1,String radio2, String radio3, String radio4, String radio6, String radio7, String radio8, String radio9, String studid ) {
try
{ String sql="INSERT INTO lwpy (theme, stru, content, quality, gs, wx, trans) Values ('"+radio1+"','"+radio2+"','"+radio3+"','"+radio4+"','"+radio6+"','"+radio7+"','"+radio8+"','"+radio9+"') where studentid='"+studid+"'";
Statement stmt=connect.createStatement();
stmt.executeUpdate(sql);
return 1;
}catch(SQLException sqle){ System.out.print( sqle.getMessage()); }
return 0;
}
public ResultSet executeCheck(String userID) {
try
{ String sql="select * from userinfo where userID='"+userID+"'";
Statement stmt=connect.createStatement();
rs=stmt.executeQuery(sql);
}catch(Exception e){ e.printStackTrace(); }
return rs;
}
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>论文评语--评阅教师</title>
</head>
<body>
<form name="form1" method="POST" action="write.jsp">
<table width="100%" border="0">
<tr>
<td colspan="2"> <div align="left">请输入学号 :
<input type="text" name="studentid">
</div>
</td>
<td colspan="4"><div align="center"></div></td>
</tr>
<tr>
<td width="20%" rowspan="2"><div align="center">评价项目</div></td>
<td width="60%" rowspan="2"><div align="center">项目内涵</div></td>
<td colspan="4"><div align="center">等级</div></td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>论文选题</td>
<td>理论前瞻性、应用适用性、有助于解决实际问题或重大现实问题</td>
<td width="5%"><input name="radiobutton1" type="radio" value="A" checked></td>
<td width="5%"><input type="radio" name="radiobutton1" value="B"></td>
<td width="5%"><input type="radio" name="radiobutton1" value="C"></td>
<td width="5%"><input type="radio" name="radiobutton1" value="D"></td>
</tr>
<tr>
<td>论文结构</td>
<td>结构合理、程次分明、逻辑严明</td>
<td><input name="radiobutton2" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton2" value="B"></td>
<td><input type="radio" name="radiobutton2" value="C"></td>
<td><input type="radio" name="radiobutton2" value="D"></td>
</tr>
<tr>
<td>论文内容</td>
<td>构思新颖、思路清晰、论证充分、资料翔实、能熟练运用各种理论知识解决实际问题</td>
<td><input name="radiobutton3" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton3" value="B"></td>
<td><input type="radio" name="radiobutton3" value="C"></td>
<td><input type="radio" name="radiobutton3" value="D"></td>
</tr>
<tr>
<td>系统分析设计质量</td>
<td>系统分析、设计文档规范,正确</td>
<td><input name="radiobutton4" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton4" value="B"></td>
<td><input type="radio" name="radiobutton4" value="C"></td>
<td><input type="radio" name="radiobutton4" value="D"></td>
</tr>
<tr>
<td>图文格式</td>
<td>行文流畅、图文规范美观,无拼写错误</td>
<td><input name="radiobutton6" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton6" value="B"></td>
<td><input type="radio" name="radiobutton6" value="C"></td>
<td><input type="radio" name="radiobutton6" value="D"></td>
</tr>
<tr>
<td>基础知识</td>
<td>拥有宽广的知识面和扎实的理论基础;运用所学知识解决实际问题;熟练阅读外文资料</td>
<td><input name="radiobutton7" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton7" value="B"></td>
<td><input type="radio" name="radiobutton7" value="C"></td>
<td><input type="radio" name="radiobutton7" value="D"></td>
</tr>
<tr>
<td>文献综述</td>
<td>阅读文献数量充足,理解文献阐述内容,表述清楚</td>
<td><input name="radiobutton8" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton8" value="B"></td>
<td><input type="radio" name="radiobutton8" value="C"></td>
<td><input type="radio" name="radiobutton8" value="D"></td>
</tr>
<tr>
<td>翻译质量</td>
<td>译文流畅,用于准确</td>
<td><input name="radiobutton9" type="radio" value="A" checked></td>
<td><input type="radio" name="radiobutton9" value="B"></td>
<td><input type="radio" name="radiobutton9" value="C"></td>
<td><input type="radio" name="radiobutton9" value="D"> </td>
</tr>
<tr>
<td colspan="6"> <input type="submit" name="Submit" value="提交" > <input type="reset" name="Submit2" value="重置">
</td>
</tr>
</table>
</form>
</body>
</html>
JSP页面代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=utf-8" pageEncoding="gb2312"%>
<%@ page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<jsp:useBean id="connbean" scope="page" class="lw.DbConn" />
<%String radio1=request.getParameter("radiobutton1");
String radio2=request.getParameter("radiobutton2");
String radio3=request.getParameter("radiobutton3");
String radio4=request.getParameter("radiobutton4");
String radio6=request.getParameter("radiobutton6");
String radio7=request.getParameter("radiobutton7");
String radio8=request.getParameter("radiobutton8");
String radio9=request.getParameter("radiobutton9");
String studid=request.getParameter("studentid");
int rs=connbean.executeUpdate(radio1, radio2, radio3, radio4, radio6, radio7, radio8, radio9,studid);%>
<%out.println("评分成功!");%>
</body>
</html>
JAVABEAN代码
package lw;
import java.sql.*;
public class DbConn{
String CLASSFORNAME="sun.jdbc.odbc.JdbcOdbcDriver";
String SERVANDDB="jdbc:odbc:cjpd";
String USER="";
String PWD="";
Connection connect=null;
ResultSet rs=null;
public DbConn(){
try {
Class.forName(CLASSFORNAME);
connect = DriverManager.getConnection(SERVANDDB,USER,PWD);
}catch(Exception e){ e.printStackTrace();}
}
public ResultSet executeQuery(String sql) {
try
{ Statement stmt=connect.createStatement();
rs=stmt.executeQuery(sql);
}catch(Exception e){ e.printStackTrace(); }
return rs;
}
public int executeUpdate( String radio1,String radio2, String radio3, String radio4, String radio6, String radio7, String radio8, String radio9, String studid ) {
try
{ String sql="INSERT INTO lwpy (theme, stru, content, quality, gs, wx, trans) Values ('"+radio1+"','"+radio2+"','"+radio3+"','"+radio4+"','"+radio6+"','"+radio7+"','"+radio8+"','"+radio9+"') where studentid='"+studid+"'";
Statement stmt=connect.createStatement();
stmt.executeUpdate(sql);
return 1;
}catch(SQLException sqle){ System.out.print( sqle.getMessage()); }
return 0;
}
public ResultSet executeCheck(String userID) {
try
{ String sql="select * from userinfo where userID='"+userID+"'";
Statement stmt=connect.createStatement();
rs=stmt.executeQuery(sql);
}catch(Exception e){ e.printStackTrace(); }
return rs;
}
}