本文整理汇总了Java中javax.servlet.jsp.JspContext类的典型用法代码示例。如果您正苦于以下问题:Java JspContext类的具体用法?Java JspContext怎么用?Java JspContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JspContext类属于javax.servlet.jsp包,在下文中一共展示了JspContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JspContextWrapper
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
public JspContextWrapper(JspContext jspContext,
ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
ArrayList<String> atEndVars, Map<String,String> aliases) {
this.invokingJspCtxt = (PageContext) jspContext;
if (jspContext instanceof JspContextWrapper) {
rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
}
else {
rootJspCtxt = invokingJspCtxt;
}
this.nestedVars = nestedVars;
this.atBeginVars = atBeginVars;
this.atEndVars = atEndVars;
this.pageAttributes = new HashMap<String, Object>(16);
this.aliases = aliases;
if (nestedVars != null) {
this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
}
syncBeginTagFile();
}
示例2: getValue
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
@Override
public Object getValue(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
String key = property.toString();
PageContext page = (PageContext) context
.getContext(JspContext.class);
return page.findAttribute(key);
}
}
return null;
}
示例3: setValue
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
@Override
public void setValue(ELContext context, Object base, Object property,
Object value) throws NullPointerException,
PropertyNotFoundException, PropertyNotWritableException,
ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
String key = property.toString();
PageContext page = (PageContext) context
.getContext(JspContext.class);
int scope = page.getAttributesScope(key);
if (scope != 0) {
page.setAttribute(key, value, scope);
} else {
page.setAttribute(key, value);
}
}
}
}
示例4: JspContextWrapper
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
public JspContextWrapper(JspContext jspContext, ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
ArrayList<String> atEndVars, Map<String, String> aliases) {
this.invokingJspCtxt = (PageContext) jspContext;
if (jspContext instanceof JspContextWrapper) {
rootJspCtxt = ((JspContextWrapper) jspContext).rootJspCtxt;
} else {
rootJspCtxt = invokingJspCtxt;
}
this.nestedVars = nestedVars;
this.atBeginVars = atBeginVars;
this.atEndVars = atEndVars;
this.pageAttributes = new HashMap<String, Object>(16);
this.aliases = aliases;
if (nestedVars != null) {
this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
}
syncBeginTagFile();
}
示例5: getValue
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
@Override
public Object getValue(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
String key = property.toString();
PageContext page = (PageContext) context.getContext(JspContext.class);
return page.findAttribute(key);
}
}
return null;
}
示例6: setValue
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
@Override
public void setValue(ELContext context, Object base, Object property, Object value)
throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
String key = property.toString();
PageContext page = (PageContext) context.getContext(JspContext.class);
int scope = page.getAttributesScope(key);
if (scope != 0) {
page.setAttribute(key, value, scope);
} else {
page.setAttribute(key, value);
}
}
}
}
示例7: JspContextWrapper
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
public JspContextWrapper(JspContext jspContext,
ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
ArrayList<String> atEndVars, Map<String,String> aliases) {
this.invokingJspCtxt = (PageContext) jspContext;
if (jspContext instanceof JspContextWrapper) {
rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
}
else {
rootJspCtxt = invokingJspCtxt;
}
this.nestedVars = nestedVars;
this.atBeginVars = atBeginVars;
this.atEndVars = atEndVars;
this.pageAttributes = new HashMap<>(16);
this.aliases = aliases;
if (nestedVars != null) {
this.originalNestedVars = new HashMap<>(nestedVars.size());
} else {
this.originalNestedVars = null;
}
syncBeginTagFile();
}
示例8: setValue
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
@Override
public void setValue(ELContext context, Object base, Object property,
Object value) {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(base, property);
if (property != null) {
String key = property.toString();
PageContext page = (PageContext) context
.getContext(JspContext.class);
int scope = page.getAttributesScope(key);
if (scope != 0) {
page.setAttribute(key, value, scope);
} else {
page.setAttribute(key, value);
}
}
}
}
示例9: doTag
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
/**
* Ecriture HTML du Tag
* @throws JspException
* @throws IOException
*/
@Override
public void doTag() throws JspException, IOException {
JspContext jsp = this.getJspContext();
JspWriter out =jsp.getOut();
// Create a top menu or reuse the existing one
if (menuCache == null) {
leftMenu(out);
} else {
out.println("<div id='" + cssDivMenu + "'>");
out.println(menuCache);
out.println("</div>");
}
}
示例10: doTag
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
/**
* Ecriture HTML du Tag
* @throws JspException
* @throws IOException
*/
@Override
public void doTag() throws JspException, IOException {
JspContext jsp = this.getJspContext();
JspWriter out =jsp.getOut();
try {
Action actionform = (Action)jsp.findAttribute(C.ACTION_FORM_BEAN);
String embedded = actionform.getSessionAttr("mode");
if (embedded.equalsIgnoreCase("embedded"))
leftMenu(out);
else
topMenu(out);
} catch (IOException ex) {
Joy.log().debug ( ex.toString());
out.println("No menu defined.");
}
}
示例11: JspContextWrapper
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
public JspContextWrapper(JspContext jspContext,
ArrayList<String> nestedVars,
ArrayList<String> atBeginVars,
ArrayList<String> atEndVars,
Map<String, String> aliases) {
this.invokingJspCtxt = (PageContext) jspContext;
this.nestedVars = nestedVars;
this.atBeginVars = atBeginVars;
this.atEndVars = atEndVars;
this.pageAttributes = new Hashtable<String, Object>(16);
this.aliases = aliases;
if (nestedVars != null) {
this.originalNestedVars =
new HashMap<String, Object>(nestedVars.size());
}
syncBeginTagFile();
}
示例12: setup
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
@Before
public void setup() throws Exception {
mockPageContext = new MockPageContext(mockServletContext, new MockHttpServletRequest(), new MockHttpServletResponse());
tag = new PageTag();
tag.setAppcacheEnabled("false");
tag.setJspContext(mockPageContext);
tag.setJspBody(new JspFragment() {
@Override
public void invoke(Writer out) throws JspException, IOException {
}
@Override
public JspContext getJspContext() {
return null;
}
});
}
示例13: render
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
/**
* パンクズリストを表示します。
* このメソッドはJSP-BODYを評価せずに、
* 既存のHTMLテンプレート、あるいはクラスコンフィグオーバライドされたHTMLテンプレートを利用します。
* @throws JspException JSP処理中にエラーが発生した場合
* @throws IOException 入出力エラーの場合
*/
protected void render() throws JspException, IOException {
render(new JspFragment() {
@Override public JspContext getJspContext() {
return PankuzuTag.this.getJspContext();
}
@Override public void invoke(Writer out) throws JspException, IOException {
JspContext context = getJspContext();
ViewId vid = (ViewId) context.getAttribute(var);
String encodedUrl = encodeURL(vid.getUrl());
String item = Strings.substitute(DEFAULT_TEMPLATE, Maps
.hash("url", encodedUrl)
.map("label", Strings.escapeHTML(vid.getLabel()))
.map("query", trimQueryMarkerIfGetRequestParameterExists(encodedUrl, vid.getQuery())));
context.getOut().print(item);
}
});
}
示例14: getBeanFactory
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
/**
* Gets the {@link BeanFactory} from the given {@link JspContext}. The default
* implementation automagically finds a {@link BeanFactory} that was previously set by
* a {@link FrameworkServlet}. The result is cached.
*
* @param jspContext
* {@link JspContext} to be used
* @return {@link BeanFactory} found
*/
@SuppressWarnings("unchecked")
protected BeanFactory getBeanFactory(JspContext jspContext) {
Object bfCache = jspContext.getAttribute(TAGPROXY_BEANFACTORY_CACHE, PageContext.APPLICATION_SCOPE);
if (bfCache != null && bfCache instanceof BeanFactory) {
return (BeanFactory) bfCache;
}
Enumeration<String> en = jspContext.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE);
while (en.hasMoreElements()) {
String attribute = en.nextElement();
if (attribute.startsWith(FrameworkServlet.SERVLET_CONTEXT_PREFIX)) {
Object bf = jspContext.getAttribute(attribute, PageContext.APPLICATION_SCOPE);
if (bf != null && bf instanceof BeanFactory) {
BeanFactory bfBean = (BeanFactory) bf;
jspContext.setAttribute(TAGPROXY_BEANFACTORY_CACHE, bfBean, PageContext.APPLICATION_SCOPE);
return bfBean;
}
}
}
throw new IllegalStateException("Could not find a BeanFactory. Use a FrameworkServlet or @BeanFactoryReference.");
}
示例15: doExecute
import javax.servlet.jsp.JspContext; //导入依赖的package包/类
protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this.getServlet(), request, response, null, true, 8192, true);
JspContext jspContext = pageContext;
java.util.ArrayList _jspx_nested = null;
java.util.ArrayList _jspx_at_begin = null;
java.util.ArrayList _jspx_at_end = null;
jspContext = new org.apache.jasper.runtime.JspContextWrapper(jspContext, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);
/*patientid_005fdistricts_tag tag = new patientid_005fdistricts_tag();
tag.setJspContext(jspContext);
try {
tag.doTag();
} catch (JspException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}*/
return mapping.findForward(SUCCESS_FORWARD);
}