一个简单的新闻系统之二
插入新闻页面
insert.jsp

<%@page contentType="text/html;charset=gb2312"%>
<%@ include file=
"inc.jsp" %>
<%
String stitle = request.getParameter(
"title");
String Date= request.getParameter(
"Date");
String sbody = request.getParameter(
"content");
String semail = request.getParameter(
"keyw");
String stel = request.getParameter(
"author");
java.util.Date date=new java.util.Date();
int yyyy=1900+date.getYear();
int mm=date.getMonth()+1;
int dd=date.getDate();
int hh=date.getHours();
int mi=date.getMinutes();
int ss=date.getSeconds();
Date= yyyy+
"-"+mm+"-"+dd+" "+hh+":"+mi+":"+ss;
boolean go;
sql=
"insert into new_sz (title,Date,content,keyw,author) values (' "+stitle+" ',' "+Date+" ',' "+sbody+" ',' "+semail+" ',' "+stel+" ')";
//out.println(sql);
go = apple.insert(sql);
if(go)
out.println(
"");
else
out.println(
"Failed.");
apple.closeConn();
%><title>新闻插入</title>
<body bgcolor=
"#F4F4F4">
<div align=
"center"><br>
<b><font size=
"6" face="华文中宋" color="#FF0000">恭喜你~~!!</font></b><br>
</div>
<table width=
"50%" border="1" align="center" bgcolor="#E7E7E7">
<tr>
<td width=
"42%"><font color="#0033FF">新闻发表成功!!</font></td>
<td width=
"58%">&nbsp;</td>
</tr>
<tr>
<td width=
"42%"><font color="#0033FF">看看去!!</font></td>
<td width=
"58%"><a href = "show.jsp"><font color="#FF0000">查看新闻</font></a>
<a href=
"fabiao.htm"><font color="#FF0000">继续发布</font></a></td>
</tr>
</table>

lunzi   2004-11-09 20:33:23 评论:2   阅读:1430   引用:0
@2006-11-29 16:14:19  lunzi
inc.jsp是调用连接数据库的javabean的jsp文件
<%@page language="java" import="java.sql.*" %>
<jsp:useBean id="apple" scope="session" class="apple.DBmysql" />
<%!
String sql;
ResultSet rs;  
%>
为什么不全啊 @2006-11-29 11:48:26  gg
好象不全,还有几个文件没有啊,如inc.jsp,能否发布出来。

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog