Package javax.servlet.jsp

Examples of javax.servlet.jsp.PageContext


  {
    if (base != null)
      return null;

    context.setPropertyResolved(true);
    PageContext pageContext
      = (PageContext) context.getContext(JspContext.class);

    return pageContext.getAttribute(String.valueOf(property));
  }
View Full Code Here


      return;

    context.setPropertyResolved(true);

    context.setPropertyResolved(true);
    PageContext pageContext
      = (PageContext) context.getContext(JspContext.class);

    pageContext.setAttribute(String.valueOf(property), value);
  }
View Full Code Here

   */
  @Override
  public Object getValue(ELContext env)
    throws ELException
  {
    PageContext page = (PageContext) env.getContext(JspContext.class);

    if (page == null)
      return null;

    Object fieldValue = _field.evalObject(env);

    if (fieldValue == null)
      return null;

    String fieldString = toString(fieldValue, env);

    switch (_index) {
    case ImplicitObjectExpr.APPLICATION_SCOPE:
      return page.getServletContext().getAttribute(fieldString);

    case ImplicitObjectExpr.SESSION_SCOPE:
      {
        HttpSession session = page.getSession();

        if (session != null) {
          return session.getAttribute(fieldString);
        }
        else
          return null;
      }

    case ImplicitObjectExpr.REQUEST_SCOPE:
      {
        return page.getRequest().getAttribute(fieldString);
      }

    case ImplicitObjectExpr.PAGE_SCOPE:
      return page.getAttribute(fieldString);
     
    case ImplicitObjectExpr.PARAM:
      return page.getRequest().getParameter(fieldString);

    case ImplicitObjectExpr.PARAM_VALUES:
      return page.getRequest().getParameterValues(fieldString);
     
    case ImplicitObjectExpr.HEADER:
      return ((HttpServletRequest) page.getRequest()).getHeader(fieldString);

    case ImplicitObjectExpr.HEADER_VALUES: {
      Enumeration e =
        ((HttpServletRequest) page.getRequest()).getHeaders(fieldString);

      if (e == null)
        return null;

      if (! e.hasMoreElements())
        return null;
     
      ArrayList<String> list = new ArrayList<String>();

      while (e.hasMoreElements())
        list.add((String) e.nextElement());
     
      return list.toArray(new String[list.size()]);
    }
     
    case ImplicitObjectExpr.INIT_PARAM:
      return page.getServletContext().getInitParameter(fieldString);

    case ImplicitObjectExpr.COOKIE: {
      Cookie []cookies = ((HttpServletRequest) page.getRequest()).getCookies();
      if (cookies == null)
        return null;

      for (int i = 0; i < cookies.length; i++) {
        if (cookies[i].getName().equals(fieldString))
View Full Code Here

                              javax.xml.transform.Transformer transformer,
                              CauchoRequest req,
                              CauchoResponse res)
    throws IOException, ServletException
  {
    PageContext pageContext;

    JspFactory factory = JspFactory.getDefaultFactory();

    TransformerImpl xform = null;
    if (transformer instanceof TransformerImpl)
      xform = (TransformerImpl) transformer;
    String errorPage = null;
    if (xform != null)
      errorPage = (String) xform.getProperty("caucho.error.page");
    pageContext = factory.getPageContext(this,
                                         req, res,
                                         errorPage,
                                         false,
                                         8192, // bufferSize,
                                         false); // autoFlush);

    try {
      if (xform != null) {
        xform.setProperty("caucho.page.context", pageContext);
        xform.setProperty("caucho.pwd", Vfs.lookup());
      }

      DOMSource source = new DOMSource(doc);
      StreamResult result = new StreamResult(os);

      xform.setFeature(TransformerImpl.GENERATE_LOCATION, true);
      transformer.transform(source, result);

      if (xform != null)
        return (LineMap) xform.getProperty(TransformerImpl.LINE_MAP);
      else
        return null;
    } catch (Exception e) {
      pageContext.handlePageException(e);
    } finally {
      factory.releasePageContext(pageContext);
    }

    return null;
View Full Code Here

     
      getJspBody().invoke(null);
     
      Definition definition = new Definition();
      PageContext context = (PageContext)getJspContext();
      ArrayList params = (ArrayList) screens.get(screenId);
      Iterator  ir = null;
      if (params != null) {
        ir = params.iterator();
        while (ir.hasNext())
          definition.setParam((Parameter) ir.next());

        // put the definition in the page context
        context.setAttribute(definitionName, definition, context.APPLICATION_SCOPE);
      }
       else           
        Debug.println("DefinitionTag: params are not defined.");
    } catch (Exception ex) {
        ex.printStackTrace();
View Full Code Here

   }
   public void doTag() throws JspTagException {
    Definition definition = null;
    Parameter parameter = null;
    boolean directInclude = false;       
    PageContext context = (PageContext)getJspContext();

    // get the definition from the page context
    definition = (Definition)context.getAttribute(definitionName, context.APPLICATION_SCOPE);
    // get the parameter
    if (parameterName != null && definition != null)
        parameter = (Parameter) definition.getParam(parameterName);

    if (parameter != null)
        directInclude = parameter.isDirect();

    try {
        // if parameter is direct, print to out
        if (directInclude && parameter  != null)
          context.getOut().print(parameter.getValue());
        // if parameter is indirect, include results of dispatching to page
        else {
          if ((parameter != null) && (parameter.getValue() !=  null))
              context.include(parameter.getValue());
        }
      } catch (Exception ex) {
          Throwable rootCause = null;
          if (ex instanceof ServletException) {
            rootCause = ((ServletException) ex).getRootCause();
View Full Code Here

   }
   public void doTag() throws JspTagException {
    Definition definition = null;
    Parameter parameter = null;
    boolean directInclude = false;       
    PageContext context = (PageContext)getJspContext();

    // get the definition from the page context
    definition = (Definition)context.getAttribute(definitionName, context.APPLICATION_SCOPE);
    // get the parameter
    if (parameterName != null && definition != null)
        parameter = (Parameter) definition.getParam(parameterName);

    if (parameter != null)
        directInclude = parameter.isDirect();

    try {
        // if parameter is direct, print to out
        if (directInclude && parameter  != null)
          context.getOut().print(parameter.getValue());
        // if parameter is indirect, include results of dispatching to page
        else {
          if ((parameter != null) && (parameter.getValue() !=  null))
              context.include(parameter.getValue());
        }
      } catch (Exception ex) {
          Throwable rootCause = null;
          if (ex instanceof ServletException) {
            rootCause = ((ServletException) ex).getRootCause();
View Full Code Here

     
      getJspBody().invoke(null);
     
      Definition definition = new Definition();
      PageContext context = (PageContext)getJspContext();
      ArrayList params = (ArrayList) screens.get(screenId);
      Iterator  ir = null;
      if (params != null) {
        ir = params.iterator();
        while (ir.hasNext())
          definition.setParam((Parameter) ir.next());

        // put the definition in the page context
        context.setAttribute(definitionName, definition, context.APPLICATION_SCOPE);
      }
       else           
        Debug.println("DefinitionTag: params are not defined.");
    } catch (Exception ex) {
        ex.printStackTrace();
View Full Code Here

     
      getJspBody().invoke(null);
     
      Definition definition = new Definition();
      PageContext context = (PageContext)getJspContext();
      ArrayList params = (ArrayList) screens.get(screenId);
      Iterator  ir = null;
      if (params != null) {
        ir = params.iterator();
        while (ir.hasNext())
          definition.setParam((Parameter) ir.next());

        // put the definition in the page context
        context.setAttribute(definitionName, definition, context.APPLICATION_SCOPE);
      }
       else           
        Debug.println("DefinitionTag: params are not defined.");
    } catch (Exception ex) {
        ex.printStackTrace();
View Full Code Here

   }
   public void doTag() throws JspTagException {
    Definition definition = null;
    Parameter parameter = null;
    boolean directInclude = false;       
    PageContext context = (PageContext)getJspContext();

    // get the definition from the page context
    definition = (Definition)context.getAttribute(definitionName, context.APPLICATION_SCOPE);
    // get the parameter
    if (parameterName != null && definition != null)
        parameter = (Parameter) definition.getParam(parameterName);

    if (parameter != null)
        directInclude = parameter.isDirect();

    try {
        // if parameter is direct, print to out
        if (directInclude && parameter  != null)
          context.getOut().print(parameter.getValue());
        // if parameter is indirect, include results of dispatching to page
        else {
          if ((parameter != null) && (parameter.getValue() !=  null))
              context.include(parameter.getValue());
        }
      } catch (Exception ex) {
          Throwable rootCause = null;
          if (ex instanceof ServletException) {
            rootCause = ((ServletException) ex).getRootCause();
View Full Code Here

TOP

Related Classes of javax.servlet.jsp.PageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.