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

📄 _post__jsp.java

📁 JSP聊天系统
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/*
 * JSP generated by Resin 2.1.4 (built Fri Aug  2 14:16:52 PDT 2002)
 */

package _forum;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import com.coolservlets.forum.*;
import com.coolservlets.forum.util.*;
import com.coolservlets.util.*;
import java.util.Date;
import java.text.SimpleDateFormat;

public class _post__jsp extends com.caucho.jsp.JavaPage{
  private boolean _caucho_isDead;
  	////////////////////////
	// global page variables
	
	// date formatter for today's date
	private final SimpleDateFormat todayDateFormatter = 
		new SimpleDateFormat("MMMM d");

  	///////////////////////
	// breadcrumb variables
	
	// change these values to customize the look of your breadcrumb bar
	
	// Colors
	final static String crumbBgcolor = "#999999";
	final static String crumbFgcolor = "#ccccdd";

  	/////////////////////
	// toolbar variables
	
	// change these values to customize the look of your toolbar
	
	// Colors
	final static String toolbarBgcolor = "#cccccc";
	final static String toolbarFgcolor = "#eeeeff";

  
  public void
  _jspService(javax.servlet.http.HttpServletRequest request,
              javax.servlet.http.HttpServletResponse response)
    throws java.io.IOException, javax.servlet.ServletException
  {
    com.caucho.jsp.QPageContext pageContext = (com.caucho.jsp.QPageContext) com.caucho.jsp.QJspFactory.create().getPageContext(this, request, response, "/forum/error.jsp", true, 8192, true);
    javax.servlet.jsp.JspWriter out = (javax.servlet.jsp.JspWriter) pageContext.getOut();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    javax.servlet.http.HttpSession session = pageContext.getSession();
    javax.servlet.ServletContext application = pageContext.getServletContext();
    response.setContentType("text/html;charset=gb2312");
    request.setCharacterEncoding("GB2312");
    try {
      
/**
 *	$RCSfile: post.jsp,v $
 *	$Revision: 1.5.2.3 $
 *	$Date: 2001/03/15 03:38:48 $
 */

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	////////////////////////
	// Authorization check
	
	// check for the existence of an authorization token
	Authorization authToken = SkinUtils.getUserAuthorization(request,response);
	
	// if the token was null, they're not authorized. Since this skin will
	// allow guests to view forums, we'll set a "guest" authentication
	// token
	if( authToken == null ) {
		authToken = AuthorizationFactory.getAnonymousAuthorization();
	}

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	///////////////////////
	// page forum variables
	
	// do not delete these
	ForumFactory forumFactory = ForumFactory.getInstance(authToken);
	User user = forumFactory.getProfileManager().getUser(authToken.getUserID());

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	/////////////////
	// get parameters
	
	int forumID = ParamUtils.getIntParameter(request,"forum",-1);
	int threadID = ParamUtils.getIntParameter(request,"thread",-1);
	int messageID = ParamUtils.getIntParameter(request,"message",-1);
	boolean doPost = ParamUtils.getBooleanParameter(request,"doPost");
	boolean reply = ParamUtils.getBooleanParameter(request,"reply");
	String name = ParamUtils.getParameter(request,"name");
	String email = ParamUtils.getParameter(request,"email");
	String subject = ParamUtils.getParameter(request,"subject");
	String body = ParamUtils.getParameter(request,"body");
	String referringPage = ParamUtils.getParameter(request,"referer");

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	///////////////////////////////////////
	// Create forum, parent message objects
	
	// Load the forum -- if an exception is thrown, we'll redirect to
	// the error page
	Forum forum = forumFactory.getForum(forumID);
	
	// Load the forum message and thread it is associated with. Do
	// this only if we're replying to a message
	ForumThread thread = null;
	ForumMessage parentMessage = null;
	if( reply ) {
		thread = forum.getThread(threadID);
		parentMessage = thread.getMessage(messageID);
	}

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	/////////////////
	// error check
	
	boolean errors = false;
	String errorMessage = "";
	if( doPost && subject == null ) {
		errors = true;
		errorMessage = "请输入主题";
	}
	else if( doPost && body == null ) {
		errors = true;
		errorMessage = "对不起, 您不能发空信息. 请输入信息.";
	}

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	/////////////////////////
	// Create the new message
	
	if( doPost && !errors ) {
		// Create a new message object
		ForumMessage newMessage = forum.createMessage(user);
		newMessage.setSubject(subject);
		newMessage.setBody(body);
		// add the name and email as an extended property if this user
		// is a guest
		if( user.isAnonymous() ) {
			if( name  != null ) { 
				newMessage.setProperty("name",name);
				SkinUtils.store(request,response,"jive.post.name",name);
			}
			if( email != null ) {
				newMessage.setProperty("email",email);
				SkinUtils.store(request,response,"jive.post.email",email);
			}
		}
		// if this is a reply, add it to the thread
		if( reply ) {
			thread.addMessage(parentMessage,newMessage);
		}
		else {
			// it is a new posting
			forum.addThread(forum.createThread(newMessage));
		}
		// Redirect to the thread list page
		response.sendRedirect("viewForum.jsp?forum="+forumID);
		return;
	}

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	//////////////////////
	// Header file include
	
	// The header file looks for the variable "title"
	String title = "交通论坛: 发送信息";

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      
/**
 *	$RCSfile: header.jsp,v $
 *	$Revision: 1.3 $
 *	$Date: 2000/12/18 02:04:56 $
 */

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string2, 0, _jsp_string2.length);
      pageContext.write(_jsp_string3, 0, _jsp_string3.length);
      	/////////////////////
	// header variables
	
	// change these values to customize the look of your header
	
	// Colors
	String headerBgcolor = "#000000";
	String headerFgcolor = "#ffffff";
	
	// header image vars
	String headerImgURL = "";
	String headerImgSRC = "images/jnjtzxlt.gif";
	String headerImgWidth = "140";
	String headerImgHeight = "60";
	String headerImgAltText = "Jive: 实例层";
	
	// Header text
	String headerText = "";

      pageContext.write(_jsp_string4, 0, _jsp_string4.length);
      out.print(( headerFgcolor ));
      pageContext.write(_jsp_string5, 0, _jsp_string5.length);
      out.print(( headerImgURL ));
      pageContext.write(_jsp_string6, 0, _jsp_string6.length);
      out.print(( headerImgSRC ));
      pageContext.write(_jsp_string7, 0, _jsp_string7.length);
      out.print(( headerImgWidth ));
      pageContext.write(_jsp_string8, 0, _jsp_string8.length);
      out.print(( headerImgHeight ));
      pageContext.write(_jsp_string9, 0, _jsp_string9.length);
      out.print(( headerImgAltText ));
      pageContext.write(_jsp_string10, 0, _jsp_string10.length);
      out.print(( headerText ));
      pageContext.write(_jsp_string11, 0, _jsp_string11.length);
      	//////////////////////
	// breadcrumb variable
	
	// load up different breadcrumbs based on if this is a reply to a message
	// or a new post.
	String[][] breadcrumbs = null;
	if( reply ) {
		breadcrumbs = new String[][] {
			{ "论坛主页", "index.jsp" },
			{ forum.getName(), ("viewForum.jsp?forum=" + forumID) },
			{ thread.getName(), ("viewThread.jsp?forum=" + forumID + "&thread=" + threadID) },
			{ "回复", "" }
		};
	} else {
		breadcrumbs = new String[][] {
			{ "论坛主页", "index.jsp" },
			{ forum.getName(), ("viewForum.jsp?forum="+forumID) },
			{ "发表新帖子", "" }
		};
	}

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      
/**
 *	$RCSfile: breadcrumb.jsp,v $
 *	$Revision: 1.4 $
 *	$Date: 2000/12/18 02:04:56 $
 */

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string4, 0, _jsp_string4.length);

⌨️ 快捷键说明

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