⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendpage.jsp

📁 一个用jsp写的完整的论坛源代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=GBK"%>
<%@ include file="INC/const.jsp"%>
<%@ page import = "java.util.Vector"%>
<script>
function checkForm(f){
	if(f.fromuser.value==''){
		alert('请填写您的姓名');
		f.fromuser.focus();
		return false;
	}
	if(f.touser.value==''){
		alert('请填写您朋友的邮箱');
		f.touser.focus();
		return false;
	}
	if(f.title.value==''){
		alert('请填写邮件标题');
		f.title.focus();
		return false;
	}
	if(f.message.value==''){
		alert('请填写邮件内容');
		f.message.focus();
		return false;
	}
	f.issend.value = '1';
	return true;
}
</script>
<%
	int forumId = ParamUtil.getInt(request, "forumID", 0);
	int rootId = ParamUtil.getInt(request, "rootID", 0);
	int announceId = ParamUtil.getInt(request, "announceID", 0);
	String issend = ParamUtil.getString(request, "issend", "");
	String url = StringUtil.substring(forumURL, forumURL.lastIndexOf("/")) + "/dispbbs.jsp?forumID="+forumId+"&rootID="+rootId+"&announceID="+announceId;
	String msg = "帖子地址 <a href=" + url + " target=_blank>" + url + "</a>";
	if("1".equals(issend))
	{
		String fromUser = ParamUtil.getString(request, "fromuser", "鲤鱼网");
		String toUser = ParamUtil.getString(request, "touser", "liyunet@yeah.net");
		String title = ParamUtil.getString(request, "title", "一篇不错的文章,时间看一下");
		String message = ParamUtil.getString(request, "message", msg);
		com.bcxy.mail.SendMail.sendMail(toUser, fromUser + title, message);
		out.print("<script>alert('发送成功!');location='"+url+"';</script>");
		return;
	}
%>
<%
	stats=forumName+"发送本页面给朋友.";
	forumID=ParamUtil.getInt(request,"forumID",0);
%>
<%@ include file="INC/theme.jsp"%>
<%
out.println(headLine(1,forumName,forumLogo,"",1,stats,tableWidth));
%>
<%

try{
	if(!foundUser){
		//throw new Exception("请您先登陆!");
	}
%>	
<form action="sendpage.jsp" method=post name=messager onsubmit="return checkForm(this);">
<input type="hidden" name="issend" value="0">
<input type="hidden" name="forumID" value="<%=forumId%>">
<input type="hidden" name="rootID" value="<%=rootId%>">
<input type="hidden" name="announceID" value="<%=announceId%>">
  <table cellpadding=0 cellspacing=0 border=0 width=<%=tableWidth%> bgcolor=<%=tableBackColor%> align=center>
    <tr> 
      <td> 
        <table cellpadding=3 cellspacing=1 border=0 width=100%>
          <tr> 
            <td bgcolor=<%=tableTitleColor%> colspan=2 align=center> 
              <input type=hidden name="action" value="send">
              <font color="<%=tableFontColor%>"><b>发送本页面给朋友</b>--请完整输入下列信息</font></td>
          </tr>
          <tr> 
            <td bgcolor=<%=tableBodyColor%> valign=middle width=70><font color="<%=tableContentColor%>"><b>发件人:</b></font></td>
            <td bgcolor=<%=tableBodyColor%> valign=middle><font color="<%=tableContentColor%>">
              <input type=text name="fromuser" value="" size=50>&nbsp;您的姓名
            </td>
          </tr>
          <tr> 
            <td bgcolor=<%=tableBodyColor%> valign=middle width=70><font color="<%=tableContentColor%>"><b>收件人:</b></font></td>
            <td bgcolor=<%=tableBodyColor%> valign=middle><font color="<%=tableContentColor%>">
              <input type=text name="touser" value="" size=50>&nbsp;您朋友的邮件地址
            </td>
          </tr>
          <tr> 
            <td bgcolor=<%=tableBodyColor%> valign=top><font color="<%=tableContentColor%>"><b>标题:</b></font></td>
            <td bgcolor=<%=tableBodyColor%> valign=middle><font color="<%=tableContentColor%>">
              <input type=text name="title" size=50 maxlength=80 value=发送本页面给朋友>&nbsp;请限定50字内</font>
            </td>
          </tr>
          <tr> 
            <td bgcolor=<%=tableBodyColor%> valign=top><font color="<%=tableContentColor%>"><b>内容:</b><br></font></td>
            <td bgcolor=<%=tableBodyColor%> valign=middle>
              <textarea cols=70 rows=8 name="message" title=""><%=msg%></textarea>
            </td>
          </tr>
          <tr> 
            <td bgcolor=<%=tableTitleColor%> valign=middle colspan=2 align=center> 
              <input type="submit" value="发送" >
              &nbsp; 
              <input type="reset" name="Clear" value="重置">
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
<%

}
catch(Exception e){
	e.printStackTrace();
	String errMsg=e.getMessage();
	%>
	<%@include file="INC/error.jsp"%>
	<%
}
%>
<%@ include file="foot.jsp"%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -