當前位置: 首頁>>代碼示例>>Java>>正文


Java PageContext.getSession方法代碼示例

本文整理匯總了Java中javax.servlet.jsp.PageContext.getSession方法的典型用法代碼示例。如果您正苦於以下問題:Java PageContext.getSession方法的具體用法?Java PageContext.getSession怎麽用?Java PageContext.getSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.servlet.jsp.PageContext的用法示例。


在下文中一共展示了PageContext.getSession方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: vocabTreeMenu

import javax.servlet.jsp.PageContext; //導入方法依賴的package包/類
/**
 *  Recursive method invoked by getVocabTreeMenu()
 *
 * @param  list
 * @param  id
 * @param  fieldId
 * @param  page
 * @param  language
 * @return
 */
private synchronized String vocabTreeMenu( VocabList list,
                                           String language,
                                           String id,
                                           String fieldId,
                                           PageContext page ) {
	StringBuffer ret = new StringBuffer();
	boolean isHeading = false;
	int jsCount = 0;
	HttpSession session = page.getSession();
	String base = page.getServletContext().getRealPath( "/" );
	for ( int i = 0; i < list.item.size(); i++ ) {
		VocabNode node = (VocabNode)list.item.get( i );
		isHeading = ( node.getList().item.size() > 0 ) ? true : false;
		String wrap = "false";
		if ( node.getWrap() ) {
			wrap = "true";
		}
		String labelAbbrev = node.getLabelAbbrev();
		if ( labelAbbrev == null ) {
			labelAbbrev = (String)abbreviatedLabels.get( language + fieldId + node.getId() );
			if ( labelAbbrev == null ) {
				labelAbbrev = node.getLabel();
			}
		}
		String description = node.getDescription( page );
		if ( description != null ) {
			description = stringUtil.replace( description, "\n", " ", false );
			description = stringUtil.replace( description, "\r", " ", false );
			description = stringUtil.replace( description, "'", "\'", false );
			description = ", null, '" + description + "'";
		}
		else {
			description = "";
		}
		if ( isHeading ) {
			String varName = id + new Integer( jsCount++ ).toString();
			String groupType = Integer.toString( node.getList().groupType );
			node.getList().jsVar = "tm_" + varName;
			ret.append( "var tm_" + varName + " = new VocabList( 'tm_" + varName + "', " + groupType + " );\n" );
			ret.append( "AV( tm_" + id + ", \"" + node.getLabel() + "\", \"" + labelAbbrev + "\", '"
				 + fieldId + "', '" + node.getId() + "', false, " + wrap + ", tm_" + varName + description + " );\n" );

			ret.append( vocabTreeMenu( node.getList(), language, varName, fieldId, page ) );
		}
		else if ( !node.getNoDisplay() ) {
			jsCount++;
			ret.append( "AV( tm_" + id + ", \"" + node.getLabel() + "\", \"" + labelAbbrev + "\", '" + fieldId
				 + "', '" + node.getId() + "', false, " + wrap + ", null" + description + " );\n" );
		}
	}
	return ret.toString();
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:63,代碼來源:MetadataVocabTermsGroups.java

示例2: vocabTreeMenu

import javax.servlet.jsp.PageContext; //導入方法依賴的package包/類
/**
 *  Description of the Method
 *
 * @param  list
 * @param  id
 * @param  fieldId
 * @param  page
 * @return
 */
private synchronized String vocabTreeMenu( OPMLTree.TreeNode list,
                                           String id,
                                           String fieldId,
                                           PageContext page ) {
	StringBuffer ret = new StringBuffer();
	boolean isHeading = false;
	int jsCount = 0;
	HttpSession session = page.getSession();
	for ( int i = 0; i < list.treeNodes.size(); i++ ) {
		OPMLTree.TreeNode node = (OPMLTree.TreeNode)list.treeNodes.get( i );
		isHeading = ( node.treeNodes.size() > 0 ) ? true : false;
		String wrap = "false";
		if ( ( node.getAttribute( "wrap" ) != null ) &&
			( node.getAttribute( "wrap" ).equals( "true" ) ) ) {
			wrap = "true";
		}
		String labelAbbrev = node.getAttribute( "textAbbrev" );
		if ( labelAbbrev == null ) {
			labelAbbrev = node.getAttribute( "text" );
		}
		String description = getDescription( node, page );
		if ( description != null ) {
			if ( description.length() > 1 ) {
				description = description.substring( 0, 1 ).toUpperCase() + description.substring( 1, description.length() );
			}
			description = ", null, \"" + description + "\"";
		}
		else {
			description = "";
		}
		if ( !node.isHr && !node.isComment
			 && ( ( node.getAttribute( "display" ) == null ) || !( ( (String)node.getAttribute( "display" ) ).equals( "false" ) ) ) ) {
			if ( isHeading ) {
				String varName = id + new Integer( jsCount++ ).toString();
				String inlineType = "0";
				String collapsible = node.getAttribute( "collapsible" );
				if ( ( collapsible != null ) && collapsible.toLowerCase().equals( "false" ) ) {
					collapsible = "1";
				}
				else {
					collapsible = "0";
				}
				ret.append( "var tm_" + varName + " = new dlese_vocabList( \"tm_" + varName + "\", " + collapsible + " );\n" );
				ret.append( "dlese_AV( tm_" + id + ", \"" + node.getAttribute( "text" ) + "\", \"" + labelAbbrev + "\", \""
					 + fieldId + "\", \"" + node.getAttribute( "id" ) + "\", false, " + wrap + ", tm_" + varName + description + " );\n" );
				ret.append( vocabTreeMenu( node, varName, fieldId, page ) );
			}
			else {
				jsCount++;
				ret.append( "dlese_AV( tm_" + id + ", \"" + node.getAttribute( "text" ) + "\", \"" + labelAbbrev + "\", \"" + fieldId
					 + "\", \"" + node.getAttribute( "id" ) + "\", false, " + wrap + ", null" + description + " );\n" );
			}
		}
	}
	return ret.toString();
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:66,代碼來源:MetadataVocabOPML.java


注:本文中的javax.servlet.jsp.PageContext.getSession方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。