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

📄 _search__jsp.java

📁 JSP聊天系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*
 * JSP generated by Resin 2.1.2 (built Tue Jun 11 08:26:56 PDT 2002)
 */

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

public class _search__jsp extends com.caucho.jsp.JavaPage{
  private boolean _caucho_isDead;
  	/////////////////
	// global vars
	
	private final String[] months =
		{"一月","二月","三月 ","四月 ","五月 ","六月","七月","八月","九月","十月","十一月","十二月"};
	private final int[] results =
		{10,25,50,100};
	private final SimpleDateFormat dateFormatter
		= new SimpleDateFormat( "MMMM dd, yyyy 'at' h:mm:ss a z" );

  	////////////////////////
	// 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 {
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      
/**
 *	$RCSfile: search.jsp,v $
 *	$Revision: 1.4.2.1 $
 *	$Date: 2001/03/15 03:39:19 $
 */

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.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_string1, 0, _jsp_string1.length);
      	///////////////////////
	// page forum variables
	
	// do not delete these
	ForumFactory forumFactory = ForumFactory.getInstance(authToken);
	User user = forumFactory.getProfileManager().getUser(authToken.getUserID());
	long userLastVisitedTime = SkinUtils.getLastVisited(request,response);

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      	//////////////////
	// get parameters
	
	boolean doSearch = ParamUtils.getBooleanParameter(request,"doSearch");
	boolean advancedSearch = ParamUtils.getBooleanParameter(request,"adv");
	String queryText = ParamUtils.getParameter(request,"q");
	int forumID = ParamUtils.getIntParameter(request,"forum",-1);
	int range = ParamUtils.getIntParameter(request,"numResults",10);
	int start = ParamUtils.getIntParameter(request,"start",0);
	int threadID = ParamUtils.getIntParameter(request,"thread",-1);
	String between = ParamUtils.getParameter(request,"between");
	String when = ParamUtils.getParameter(request,"when");
	
	int month = ParamUtils.getIntParameter(request,"month",-1);
	int day = ParamUtils.getIntParameter(request,"day",-1);
	
	int fromMonth = ParamUtils.getIntParameter(request,"fromMonth",-1);
	int fromDay = ParamUtils.getIntParameter(request,"fromDay",-1);
	int toMonth = ParamUtils.getIntParameter(request,"toMonth",-1);
	int toDay = ParamUtils.getIntParameter(request,"toDay",-1);

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      
	ProfileManager manager = forumFactory.getProfileManager();

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      	//////////////////////////
	// try loading up forums (exceptions may be thrown)
	Forum forum = null;
	boolean notAuthorizedToViewForum = false;
	boolean forumNotFound = false;
	forum = forumFactory.getForum(forumID);
	String forumName = forum.getName();
	ForumThread thread = null;
	if( threadID > -1 ) {
		thread = forum.getThread(threadID);
	}

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      	////////////////////
	// perform a search
	
	Iterator searchResults = null;
	Query query = null;
	int numResults = -1;
	if( doSearch && queryText!=null && forumID>0 ) {
		query = forum.createQuery();
		query.setQueryString(queryText);
		
		// dates
		if( between != null ) {
			Calendar cal = Calendar.getInstance();
			int todayMonth = cal.get(Calendar.MONTH);
			int todayDay = cal.get(Calendar.DAY_OF_MONTH);
			if( between.equals("false") ) {
				if( month > -1 ) { cal.set(Calendar.MONTH,month); }
				if( day > -1 ) { cal.set(Calendar.DAY_OF_MONTH,day); }
				// before or after
				if( when!=null && when.equals("before") && month > -1 && day > -1 ) {
					query.setBeforeDate( cal.getTime() );
				}
				else if( when!=null && when.equals("after") && month > -1 && day > -1 ) {
					query.setAfterDate( cal.getTime() );
				}
			}
			else if( between.equals("true") ) {
				if( fromMonth > -1 ) { cal.set(Calendar.MONTH,fromMonth); }
				if( fromDay > -1 ) { cal.set(Calendar.DAY_OF_MONTH,fromDay); }
				if( fromMonth > -1 && fromDay > -1 ) {
					query.setBeforeDate( cal.getTime() );
				}
				// reset cal obj to today
				cal.set(Calendar.MONTH,todayMonth);
				cal.set(Calendar.DAY_OF_MONTH,todayDay);
				if( toMonth > -1 ) { cal.set(Calendar.MONTH,toMonth); }
				if( toDay > -1 ) { cal.set(Calendar.DAY_OF_MONTH,toDay); }
				if( toMonth > -1 && toDay > -1 ) {
					query.setAfterDate( cal.getTime() );
				}
			}
		}
		//query.filterOnUser( manager.getUser("bill") );
		//if( thread != null ) {
		//	query.filterOnThread( thread );
		//}
		
		// run the search
		searchResults = query.results(start,range);
		// get the number of results
		numResults = query.resultCount();
	}

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      	////////////////////
	// page title variable for header
	String title = "Jive 论坛: 搜索";

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	/////////////////////
	// page header

      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
	String[][] breadcrumbs = {
		{ "论坛主页", "index.jsp" },
		{ forumName, ("viewForum.jsp?forum="+forumID) },
		{ "查找", "" }
	};

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

⌨️ 快捷键说明

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