当前位置: 首页>>代码示例>>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;未经允许,请勿转载。