Examples of StripesJspException


Examples of net.sourceforge.stripes.exception.StripesJspException

    @Override
    @SuppressWarnings("unchecked")
  public int doEndTag() throws JspException {
        try {
            if (!name.startsWith("/")) {
                throw new StripesJspException("The name= attribute of the layout-render tag must be " +
                    "an absolute path, starting with a forward slash (/). Please modify the " +
                    "layout-render tag with the name '" + name + "' accordingly.");
            }

            HttpServletRequest request = (HttpServletRequest) getPageContext().getRequest();

            // Put the components into the request, for the definition tag to use.. using a stack
            // to allow for the same layout to be nested inside itself :o
            String attributeName = LayoutDefinitionTag.PREFIX + this.name;
            Stack<LayoutContext> stack =
                    (Stack<LayoutContext>) request.getAttribute(attributeName);
            if (stack == null) {
                stack = new Stack<LayoutContext>();
                request.setAttribute(attributeName, stack);
            }

            stack.push(this.context);

            // Now wrap the JSPWriter, and include the target JSP
            BodyContent content = getPageContext().pushBody();
            getPageContext().include(this.name, false);
            getPageContext().popBody();
            getPageContext().getOut().write(content.getString());

            // Check that the layout actually got rendered as some containers will
            // just quietly ignore includes of non-existent pages!
            if (!this.context.isRendered()) {
                throw new StripesJspException(
                    "Attempt made to render a layout that does not exist. The layout name " +
                    "provided was '" + this.name + "'. Please check that a JSP/view exists at " +
                    "that location within your web application."
                );
            }


            stack.pop();
            popPageContextAttributes(); // remove any dynattrs from page scope

            // Clean up in case the tag gets pooled
            this.context = new LayoutContext();
        }
        catch (StripesJspException sje) { throw sje; }
        catch (Exception e) {
            throw new StripesJspException(
                "An exception was raised while invoking a layout. The layout used was " +
                "'" + this.name + "'. The following information was supplied to the render " +
                "tag: " + this.context.toString(), e);
        }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

     *         because of a mis-spelled class name, or a class that's not an ActionBean
     */
    public void setBeanclass(Object beanclass) throws StripesJspException {
        String url = getActionBeanUrl(beanclass);
        if (url == null) {
            throw new StripesJspException("Could not determine action from 'beanclass' supplied. " +
                "The value supplied was '" + beanclass + "'. Please ensure that this bean type " +
                "exists and is in the classpath. If you are developing a page and the ActionBean " +
                "does not yet exist, consider using the 'action' attribute instead for now.");
        }
        else {
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

     * doEndTag.
     */
    @Override
    public int doStartTag() throws JspException {
        if (this.actionWithoutContext == null) {
            throw new StripesJspException("The form tag attributes 'beanClass' and 'action' "
                    + "are both null. One of the two must be supplied to determine which "
                    + "action bean should handle the form submission.");
        }
        getTagStack().push(this);
        urlBuilder = new UrlBuilder(pageContext.getRequest().getLocale(), getAction(), false)
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

            this.fieldsPresent.clear();
            this.focusSet = false;
            this.urlBuilder = null;
        }
        catch (IOException ioe) {
            throw new StripesJspException("IOException in FormTag.doEndTag().", ioe);
        }

        return EVAL_PAGE;
    }
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

                    writer.write("\r\n//]]>");
                    writeCloseTag(writer, "script");
                }
            }
            catch (IOException ioe) {
                throw new StripesJspException("IOException while writing output in LinkTag.", ioe);
            }
        }
       
        // Only keep the type attribute between uses
        String type = getAttributes().get("type");
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

     *             because of a mis-spelled class name, or a class that's not an ActionBean
     */
    public void setBeanclass(Object beanclass) throws StripesJspException {
        String url = getActionBeanUrl(beanclass);
        if (url == null) {
            throw new StripesJspException(
                    "Could not determine action from 'beanclass' supplied. "
                            + "The value supplied was '"
                            + beanclass
                            + "'. Please ensure that this bean type "
                            + "exists and is in the classpath. If you are developing a page and the ActionBean "
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

     * @param beanclass the FQN of an ActionBean class, or a Class object for one.
     */
    public void setBeanclass(Object beanclass) throws StripesJspException {
        String url = getActionBeanUrl(beanclass);
        if (url == null) {
            throw new StripesJspException("The 'beanclass' attribute provided could not be " +
                    "used to identify a valid and configured ActionBean. The value supplied was: " +
                    beanclass);
        }
        else {
            this.action = url;
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

                    clazz = ReflectUtil.findClass(n2);
                }
            }
            // If our second attempt didn't work, wrap the *original* exception
            catch (Exception e2) {
                throw new StripesJspException
                        ("Could not process class [" + this.className + "]. Attribute 'enum' on " +
                         "tag options-enumeration must be the fully qualified name of a " +
                         "class which is a java 1.5 enum.", e);
            }
        }

        if (!clazz.isEnum()) {
            throw new StripesJspException
                    ("The class name supplied, [" + this.className + "], does not appear to be " +
                     "a JDK1.5 enum class.");
        }

        Enum[] enums = clazz.getEnumConstants();

        try {
            Locale locale = getPageContext().getRequest().getLocale();

            for (Enum item : enums) {
                Object label = null;
                String packageName = clazz.getPackage() == null ? "" : clazz.getPackage().getName();

                // Check for a localized label using class.ENUM_VALUE and package.class.ENUM_VALUE
                label = LocalizationUtility.getLocalizedFieldName(clazz.getSimpleName() + "." + item.name(),
                                                                  packageName,
                                                                  null,
                                                                  locale);
                if (label == null) {
                    if (getLabel() != null) {
                        label = BeanUtil.getPropertyValue(getLabel(), item);
                    }
                    else {
                        label = item.toString();
                    }
                }
               
                Object group = null;
                if (getGroup() != null)
                    group = BeanUtil.getPropertyValue(getGroup(), item);

                addEntry(item, label, item, group);
            }
        }
        catch (ExpressionException ee) {
            throw new StripesJspException("A problem occurred generating an options-enumeration. " +
                "Most likely either the class [" + getEnum() + "] is not an enum or, [" +
                    getLabel() + "] is not a valid property of the enum.", ee);
        }

        return SKIP_BODY;
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

                getPageContext().getOut().write(body.trim());
            }
            writeCloseTag(getPageContext().getOut(), "a");
        }
        catch (IOException ioe) {
            throw new StripesJspException("IOException while writing output in LinkTag.", ioe);
        }

        // Restore state and go on with the page
        getAttributes().remove("href");
        clearParameters();
View Full Code Here

Examples of net.sourceforge.stripes.exception.StripesJspException

            writeCloseTag(getPageContext().getOut(), "textarea");

            return EVAL_PAGE;
        }
        catch (IOException ioe) {
            throw new StripesJspException("Could not write out textarea tag.", ioe);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.