|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
令人可喜的是java现在已经开源了,所以我想我上述的想法也许有一天会实现,因为java一直都是不断创新的语言,每次创新都会给我们惊喜,这也是我喜欢java的一个原因。js|server
<!--add_message.jsp-->
<%@pageimport="java.sql.*"%>
<HTML>
<HEAD>
<TITLE>addmessageintotable</TITLE>
</HEAD>
<BODY>
<%
Stringname=request.getParameter("name");
Stringmail=request.getParameter("mail");
Stringtitle=request.getParameter("title");
Stringcontent=request.getParameter("content");
if(name==null)
name="";
if(title==null)
title="";
if(content==null)
content="";
if(mail==null)
mail="";
if(name.length()==0)
out.println("留言人姓名不克不及为空!");
elseif(title.length()==0)
out.println("留言主题不克不及为空!");
elseif(content.length()==0)
out.println("留言内容不克不及为空!");
else
{
java.util.Datedate=newjava.util.Date();
Stringdatetime=newTimestamp(date.getTime()).toString();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Stringurl="jdbc:odbc:user_db";
Connectioncon=DriverManager.getConnection(url,"insher","insher");
PreparedStatementstm=con.prepareStatement("insertintomessagevalues(?,?,?,?,?)");
stm.setString(1,title);
stm.setString(2,name);
if(mail.length()==0)
stm.setString(3,null);
elsestm.setString(3,mail);
stm.setString(4,datetime);
stm.setString(5,content);
try
{
stm.executeQuery();
}catch(Exceptione)
{}
con.close();
}
catch(Exceptione)
{}
%>
<jsp:forwardpage="view_message.jsp"/>
<%
}
%>
</body>
</html>
<!--add_message.jsp--
<%@pageimport="java.sql.*"%>
<HTML>
<HEAD>
<TITLE>addmessageintotable</TITLE>
</HEAD>
<BODY>
<%
Stringname=request.getParameter("name");
Stringmail=request.getParameter("mail");
Stringtitle=request.getParameter("title");
Stringcontent=request.getParameter("content");
if(name==null)
name="";
if(title==null)
title="";
if(content==null)
content="";
if(mail==null)
mail="";
if(name.length()==0)
out.println("留言人姓名不克不及为空!");
elseif(title.length()==0)
out.println("留言主题不克不及为空!");
elseif(content.length()==0)
out.println("留言内容不克不及为空!");
else
{
java.util.Datedate=newjava.util.Date();
Stringdatetime=newTimestamp(date.getTime()).toString();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Stringurl="jdbc:odbc:user_db";
Connectioncon=DriverManager.getConnection(url,"insher","insher");
PreparedStatementstm=con.prepareStatement("insertintomessagevalues(?,?,?,?,?)");
stm.setString(1,title);
stm.setString(2,name);
if(mail.length()==0)
stm.setString(3,null);
elsestm.setString(3,mail);
stm.setString(4,datetime);
stm.setString(5,content);
try
{
stm.executeQuery();
}catch(Exceptione)
{}
con.close();
}
catch(Exceptione)
{}
%>
<jsp:forwardpage="view_message.jsp"/>
<%
}
%>
</body>
</html>
<!--index.html-->
<HTML>
<HEAD>
<TITLE>messageboard</TITLE>
</HEAD>
<BODY>
<TABLEwidth="90%"align="center"border=1cellspacing="0"cellpadding="0"bordercolordark="#88a6dd"bordercolorlight="#88a6dd">
<TR>
<TDalign="center"bgcolor="#88a6dd">访客留言板</TD>
</TR>
<TR>
<TD><TABLEalign="center"border=1cellspacing="0"cellpadding="0"bordercolordark="#88a6dd"bordercolorlight="#88a6dd">
<FORMACTION="add_message.jsp">
<TR>
<TD>姓名:</TD>
<TDbgcolor="#88a6dd"><inputtype="text"name="name"size=25></TD>
</TR>
<TR>
<TDbgcolor="#88a6dd">E-mail:</TD>
<TDbgcolor="#88a6dd"><inputtype="text"name="mail"size=25></TD>
</TR>
<TR>
<TD>主题:</TD>
<TDbgcolor="#88a6dd"><inputtype="text"name="title"size=25></TD>
</TR>
<TR>
<TDvalign="top"bgcolor="#88a6dd">留言:</TD>
<TD><textareaname="content"rows=7cols=25></textarea></TD>
</TR>
<TR>
<TDcolspan=3><TABLEalign="center"width="100%"cellspacing="0"cellpadding="0"bordercolordark="#88a6dd"bordercolorlight="#88a6dd">
<TR>
<TDalign="center"bgcolor="#88a6dd"><inputtype="submit"value="提交留言"></TD>
<TDalign="center"><ahref="view_message.jsp"><fontsize=2>检察留言</font></a></TD>
<TDalign="center"bgcolor="#88a6dd"><inputtype="reset"value="从头填写"></TD>
</TR>
</TABLE></TD>
</TR>
</FORM>
</TABLE></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>messageboard</TITLE>
</HEAD>
<BODY>
<TABLEwidth="60%"align="center"border=1cellspacing="0"cellpadding="0"bordercolordark="#88a6dd"bordercolorlight="#88a6dd">
<TR>
<TDalign="center"bgcolor="#88a6dd">访客留言板</TD>
</TR>
<TR>
<TD><TABLEalign="center"border=1cellspacing="0"cellpadding="0"bordercolordark="#88a6dd"bordercolorlight="#88a6dd">
<FORMACTION="add_message.jsp">
<TR>
<TD>姓名:</TD>
<TDbgcolor="#88a6dd"><inputtype="text"name="name"size=25></TD>
</TR>
<TR>
<TDbgcolor="#88a6dd">E-mail:</TD>
<TDbgcolor="#88a6dd"><inputtype="text"name="mail"size=25></TD>
</TR>
<TR>
<TD>主题:</TD>
<TDbgcolor="#88a6dd"><inputtype="text"name="title"size=25></TD>
</TR>
<TR>
<TDvalign="top"bgcolor="#88a6dd">留言:</TD>
<TD><textareaname="content"rows=7cols=25></textarea></TD>
</TR>
<TR>
<TDcolspan=3><TABLEalign="center"width="100%"cellspacing="0"cellpadding="0"bordercolordark="#88a6dd"bordercolorlight="#88a6dd">
<TR>
<TDalign="center"bgcolor="#88a6dd"><inputtype="submit"value="提交留言"></TD>
<TDalign="center"><ahref="view_message.jsp"><fontsize=2>检察留言</font></a></TD>
<TDalign="center"bgcolor="#88a6dd"><inputtype="reset"value="从头填写"></TD>
</TR>
</TABLE></TD>
</TR>
</FORM>
</TABLE></TD>
</TR>
</TABLE>
</BODY>
</HTML>
<!--view_message.jsp-->
<%@pageimport="java.sql.*"%>
<HTML>
<HEAD>
<TITLE>showthemessageinthetable</TITLE>
</HEAD>
<BODY>
<palign="center">一切访客留言</p>
<hr>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Stringurl="jdbc:odbc:user_db";
Connectioncon=DriverManager.getConnection(url,"insher","insher");
Statementstm=con.createStatement();
ResultSetresult=stm.executeQuery("selectcount(*)frommessage");
intmessage_count=0;
if(result.next())
{
message_count=result.getInt(1);
result.close();
}
if(message_count>0)
{
result=stm.executeQuery("select*frommessageorderbytimedesc");
while(result.next())
{
Stringtitle=result.getString("title");
Stringname=result.getString("name");
Stringmail=result.getString("mail");
Timestamptime=result.getTimestamp("time");
Datedate_time=newDate(time.getTime());
Timetime_time=newTime(time.getTime());
Stringcontent=result.getString("content");
%>
<TABLEwidth="100%"align="center"border=1cellspacing="0"cellpadding="0"bordercolordark="#000000"bordercolorlight="#88a6dd">
<tr><tdbgcolor="#88a6dd"><fontsize=2>主题:</font></td>
<tdcolspan=3><%=title%></td></tr>
<tr><tdbgcolor="#88a6dd"><fontsize=2>留言人:</font></td>
<td><%=name%></td><tdbgcolor="#88a6dd"><fontsize=2>E-mail:</font></td>
<td>
<%
out.println("<ahref=mailto:"+mail+">"+mail+"</a>");
%>
</td></tr>
<tr><tdbgcolor="#88a6dd"><fontsize=2>留言工夫:</font></td><tdcolspan=3>
<%
out.println("<fontsize=2>"+date_time+""+time_time+"</font>");
%>
</td></tr>
<tr><tdalign="center">
<%
out.println("("+message_count+")");
%>
</td>
<tdcolspan=3><%=content%>
</td></tr>
</table>
<%
out.println("<hr>");
message_count--;
}
result.close();
con.close();
}
else
{
out.println("今朝还没有任何留言!");
con.close();
}
}catch(Exceptione)
{out.println(e);}
%>
<palign="center"><ahref="../message/index.html">我要留言</a></p>
</body>
</html>
<!--view_message.jsp-->
<%@pageimport="java.sql.*"%>
<HTML>
<HEAD>
<TITLE>showthemessageinthetable</TITLE>
</HEAD>
<BODY>
<palign="center">一切访客留言</p>
<hr>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Stringurl="jdbc:odbc:user_db";
Connectioncon=DriverManager.getConnection(url,"insher","insher");
Statementstm=con.createStatement();
ResultSetresult=stm.executeQuery("selectcount(*)frommessage");
intmessage_count=0;
if(result.next())
{
message_count=result.getInt(1);
result.close();
}
if(message_count>0)
{
result=stm.executeQuery("select*frommessageorderbytimedesc");
while(result.next())
{
Stringtitle=result.getString("title");
Stringname=result.getString("name");
Stringmail=result.getString("mail");
Timestamptime=result.getTimestamp("time");
Datedate_time=newDate(time.getTime());
Timetime_time=newTime(time.getTime());
Stringcontent=result.getString("content");
%>
<TABLEwidth="100%"align="center"border=1cellspacing="0"cellpadding="0"bordercolordark="#000000"bordercolorlight="#88a6dd">
<tr><tdbgcolor="#88a6dd"><fontsize=2>主题:</font></td>
<tdcolspan=3><%=title%></td></tr>
<tr><tdbgcolor="#88a6dd"><fontsize=2>留言人:</font></td>
<td><%=name%></td><tdbgcolor="#88a6dd"><fontsize=2>E-mail:</font></td>
<td>
<%
out.println("<ahref=mailto:"+mail+">"+mail+"</a>");
%>
</td></tr>
<tr><tdbgcolor="#88a6dd"><fontsize=2>留言工夫:</font></td><tdcolspan=3>
<%
out.println("<fontsize=2>"+date_time+time_time+"</font>");
%>
</td></tr>
<tr><tdalign="center">
<%
out.println("("+message_count+")");
%>
</td>
<tdcolspan=3><%=content%>
</td></tr>
</table>
<%
out.println("<hr>");
message_count--;
}
result.close();
con.close();
}
else
{
out.println("今朝还没有任何留言!");
con.close();
}
}catch(Exceptione)
{out.println(e);}
%>
<palign="center"><ahref="../message/index.html">我要留言</a></p>
</body>
</html>
没有那个大公司会傻了吧唧用.net开发大型项目,开发了,那等于自己一半的生命线被微软握着呢。而.net不行,限制在window系统,又是捆绑,鄙视微软之! |
|