相关代码:
from提交
<form action="/newsSystem/admin/MaAddnews.jsp" method="post" name="from">
<table width="617" height="450" border="0" align="center">
<tr>
<td width="105" height="28"><div align="center">标 题:</div></td>
<td width="496"><div align="left"><input type="text" name="title" width="38%"/>
<font color="red" size="4">(1-20 个汉字)</font>
</div></td>
</tr>
<tr>
<td height="27"><div align="center">类 型:</div></td>
<td><div align="left">
<select name="select">
<%
String sql="select type_id,new_type from type";
Connection conn = DB.getConn();
Statement stmt = DB.stmt(conn);
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()){
%><option value="<%=rs.getInt("type_id")%>"><%=rs.getString("new_type")%></option>
<%} %>
</select>
</div></td>
<% rs.close();
stmt.close();
conn.close(); %>
</tr>
<tr>
<td height="31"><div align="center">内 容:</div></td>
<td><div align="left"><textarea name="text" rows="20" cols="60"></textarea></div></td>
<tr><td height="24" align="center">图 片:</td><td><input type="file" name="pictureid" accept="image"></td>
</tr>
<tr>
<td height="24"><div align="center">作 者:</div></td>
<td><div align="left"><input type="text" name=author ></div></td>
</tr>
<tr><td height="24" align="center">发 表:</td><td><select name="statu"><option value="是">是</option><option value="否">否</option></select></td>
</tr>
<tr>
<td height="24"><input type="submit" value="提交"/ onclick="return check()"> </td>
<td><input type="reset"/></td>
</tr>
</table>
</form>
处理页面:
<%@ page language="java" import="java.util.*,com.jspsmart.upload.*,java.util.Date" pageEncoding="gb2312"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.awt.Color,news.Tool.*"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
</head>
<body>
<%