Package javax.servlet.jsp

Examples of javax.servlet.jsp.PageContext


   */
  @Override
  public String getResource(String messageKey, String defaultValue, Object... params) {

    String message = null;
    PageContext pageContext = null;

    // I'm still so ashamed about that...
    pageContext = (PageContext) params[0];

    // Both title and titleKey attributes are not used
    if (messageKey == null || StringUtils.isBlank(messageKey) && StringUtils.isNotBlank(defaultValue)) {
      message = StringUtils.capitalize(defaultValue);
    }
    // The titleKey attribute is used
    else {
      MessageResources resources = (MessageResources) pageContext.getAttribute(Globals.MESSAGES_KEY,
          PageContext.REQUEST_SCOPE);

      if (resources == null) {
        ModuleConfig moduleConfig = (ModuleConfig) pageContext.getRequest().getAttribute(Globals.MODULE_KEY);

        if (moduleConfig == null) {
          moduleConfig = (ModuleConfig) pageContext.getServletContext().getAttribute(Globals.MODULE_KEY);
          pageContext.getRequest().setAttribute(Globals.MODULE_KEY, moduleConfig);
        }

        resources = (MessageResources) pageContext.getAttribute(
            Globals.MESSAGES_KEY + moduleConfig.getPrefix(), PageContext.APPLICATION_SCOPE);
      }

      if (resources == null) {
        resources = (MessageResources) pageContext.getAttribute(Globals.MESSAGES_KEY,
            PageContext.APPLICATION_SCOPE);
      }

      if (resources != null) {
        message = resources.getMessage(messageKey);
View Full Code Here


   */
  @Override
  public String getResource(String messageKey, String defaultValue, Object... params) {

    String message = null;
    PageContext pageContext = null;

    // I'm so ashamed about that...
    pageContext = (PageContext) params[0];

    // Both title and titleKey attributes are not used
View Full Code Here

    private PageContext internalGetPageContext(Servlet servlet, ServletRequest request,
            ServletResponse response, String errorPageURL, boolean needsSession,
            int bufferSize, boolean autoflush) {
        try {
            PageContext pc = new PageContextImpl();
            pc.initialize(servlet, request, response, errorPageURL,
                    needsSession, bufferSize, autoflush);
            return pc;
        } catch (Throwable ex) {
            /* FIXME: need to do something reasonable here!! */
            log.fatal("Exception initializing page context", ex);
View Full Code Here

  public static Map createPageScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.PAGE_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.PAGE_SCOPE);
View Full Code Here

  public static Map createRequestScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.REQUEST_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.REQUEST_SCOPE);
View Full Code Here

  public static Map createSessionScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.SESSION_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.SESSION_SCOPE);
View Full Code Here

  public static Map createApplicationScopeMap (PageContext pContext)

  {

    final PageContext context = pContext;

    return new EnumeratedMap ()

      {

  public Enumeration enumerateKeys ()

  {

    return context.getAttributeNamesInScope

      (PageContext.APPLICATION_SCOPE);

  }



  public Object getValue (Object pKey)

  {

    if (pKey instanceof String) {

      return context.getAttribute

        ((String) pKey,

         PageContext.APPLICATION_SCOPE);
View Full Code Here

    Servlet servlet = JspSupportServlet.jspSupportServlet;

    velocityManager.init(servletContext);

    boolean usedJspFactory = false;
    PageContext pageContext = (PageContext) ActionContext.getContext().get(
        ServletActionContext.PAGE_CONTEXT);

    if (pageContext == null && servlet != null)
    {
      jspFactory = JspFactory.getDefaultFactory();
View Full Code Here

              String errorPageURL,
                                      boolean needsSession, int bufferSize,
                                      boolean autoflush)
    {
        try {
      PageContext pc;
      if( usePool ) {
    pc=(PageContextImpl)pool.get();
    if( pc == null ) pc= new PageContextImpl(this);
      } else {
    pc =  new PageContextImpl(this);
      }

      //      System.out.println("JspFactoryImpl.getPC"  + pc);
      pc.initialize(servlet, request, response, errorPageURL,
                          needsSession, bufferSize, autoflush);
     
            return pc;
        } catch (Throwable ex) {
            /* FIXME: need to do something reasonable here!! */
 
View Full Code Here

    private PageContext internalGetPageContext(Servlet servlet, ServletRequest request,
            ServletResponse response, String errorPageURL, boolean needsSession,
            int bufferSize, boolean autoflush) {
        try {
            PageContext pc;
            if (USE_POOL) {
                PageContextPool pool = localPool.get();
                if (pool == null) {
                    pool = new PageContextPool();
                    localPool.set(pool);
                }
                pc = pool.get();
                if (pc == null) {
                    pc = new PageContextImpl();
                }
            } else {
                pc = new PageContextImpl();
            }
            pc.initialize(servlet, request, response, errorPageURL,
                    needsSession, bufferSize, autoflush);
            return pc;
        } catch (Throwable ex) {
            /* FIXME: need to do something reasonable here!! */
            log.fatal("Exception initializing page context", ex);
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.