Package javax.servlet.jsp

Examples of javax.servlet.jsp.JspException


            int level = 0;
            TreeControlNode node = treeControl.getRoot();
            render(out, node, level, treeControl.getWidth(), true);
            out.println("</table>");
        } catch (IOException e) {
            throw new JspException(e);
        }

        return (EVAL_PAGE);

    }
View Full Code Here


                pageContext.getAttribute(tree, PageContext.SESSION_SCOPE);
        else if ("application".equals(scope))
            treeControl =
                pageContext.getAttribute(tree, PageContext.APPLICATION_SCOPE);
        if (treeControl == null)
            throw new JspException("Cannot find tree control attribute '" +
                                   tree + "'");
        else if (!(treeControl instanceof TreeControl))
            throw new JspException("Invalid tree control attribute '" +
                                   tree + "'");
        else
            return ((TreeControl) treeControl);

    }
View Full Code Here

      if (writer instanceof BodyContent)
        writer = ((BodyContent) writer).getEnclosingWriter();
      try {
        writer.print(bodyContent.getString());
      } catch (IOException e) {
        throw new JspException(e);
      }
      bodyContent.clearBody();
    }

    if (_iterator.hasNext()) {
View Full Code Here


        // Acquire the select tag we are associated with
        CVSelectTag selectTag = (CVSelectTag) pageContext.getAttribute(Constants.SELECT_KEY);
        if (selectTag == null) {
            throw new JspException(messages.getMessage("optionsTag.select"));
        }
        StringBuffer sb = new StringBuffer();

        // If a collection was specified, use that mode to render options
        if (collection != null) {
            Iterator collIterator = getIterator(collection, null);
            while (collIterator.hasNext()) {

                Object bean = collIterator.next();
                Object value = null;
                Object label = null;

                try {
                    value = PropertyUtils.getProperty(bean, property);
                    if (value == null) {
                        value = "";
                    }
                } catch (IllegalAccessException e) {
                    throw new JspException(
                        messages.getMessage("getter.access", property, collection));
                } catch (InvocationTargetException e) {
                    Throwable t = e.getTargetException();
                    throw new JspException(
                        messages.getMessage("getter.result", property, t.toString()));
                } catch (NoSuchMethodException e) {
                    throw new JspException(
                        messages.getMessage("getter.method", property, collection));
                }

                try {
                    if (labelProperty != null) {
                        label = PropertyUtils.getProperty(bean, labelProperty);
                    } else {
                        label = value;
                    }

                    if (label == null) {
                        label = "";
                    }
                } catch (IllegalAccessException e) {
                    throw new JspException(
                        messages.getMessage("getter.access", labelProperty, collection));
                } catch (InvocationTargetException e) {
                    Throwable t = e.getTargetException();
                    throw new JspException(
                        messages.getMessage("getter.result", labelProperty, t.toString()));
                } catch (NoSuchMethodException e) {
                    throw new JspException(
                        messages.getMessage("getter.method", labelProperty, collection));
                }


        String stringValue = value.toString();
View Full Code Here

            beanName = Constants.BEAN_KEY;
        }

        Object bean = RequestUtils.lookup(pageContext, beanName, null);
        if (bean == null) {
            throw new JspException(messages.getMessage("getter.bean", beanName));
        }

        // Identify the collection itself
        Object collection = bean;
        if (property != null) {
            try {
                collection = PropertyUtils.getProperty(bean, property);
                if (collection == null) {
                    throw new JspException(messages.getMessage("getter.property", property));
                }
            } catch (IllegalAccessException e) {
                throw new JspException(messages.getMessage("getter.access", property, name));
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                throw new JspException(
                    messages.getMessage("getter.result", property, t.toString()));
            } catch (NoSuchMethodException e) {
                throw new JspException(messages.getMessage("getter.method", property, name));
            }
        }

        // Construct and return an appropriate iterator
        if (collection.getClass().isArray()) {
            collection = Arrays.asList((Object[]) collection);
        }

        if (collection instanceof Collection) {
            return (((Collection) collection).iterator());

        } else if (collection instanceof Iterator) {
            return ((Iterator) collection);

        } else if (collection instanceof Map) {
            return (((Map) collection).entrySet().iterator());

        } else if (collection instanceof Enumeration) {
            return IteratorUtils.asIterator((Enumeration) collection);

        } else {
            throw new JspException(
                messages.getMessage("optionsTag.iterator", collection.toString()));
        }
    }
View Full Code Here

            this.match[0] = this.value;

        } else {
            Object bean = RequestUtils.lookup(pageContext, name, null);
            if (bean == null) {
                JspException e =
                    new JspException(messages.getMessage("getter.bean", name));

                RequestUtils.saveException(pageContext, e);
                throw e;
            }

            try {
                this.match = BeanUtils.getArrayProperty(bean, property);
                if (this.match == null) {
                    this.match = new String[0];
                }

            } catch (IllegalAccessException e) {
                RequestUtils.saveException(pageContext, e);
                throw new JspException(
                    messages.getMessage("getter.access", property, name));

            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                RequestUtils.saveException(pageContext, t);
                throw new JspException(
                    messages.getMessage("getter.result", property, t.toString()));

            } catch (NoSuchMethodException e) {
                RequestUtils.saveException(pageContext, e);
                throw new JspException(
                    messages.getMessage("getter.method", property, name));
            }
        }
    }
View Full Code Here

        throws JspException
    {
        Object obj = RequestUtils.lookup(pageContext, s, null);
   
        if(obj == null)
            throw new JspException(messages.getMessage("getter.bean", s));
        try
        {
            return BeanUtils.getProperty(obj, s1);
        }
        catch(IllegalAccessException illegalaccessexception)
        {
            throw new JspException(messages.getMessage("getter.access", s1, s));
        }
        catch(InvocationTargetException invocationtargetexception)
        {
            Throwable throwable = invocationtargetexception.getTargetException();
            throw new JspException(messages.getMessage("getter.result", s1, throwable.toString()));
        }
        catch(NoSuchMethodException nosuchmethodexception)
        {
            throw new JspException(messages.getMessage("getter.method", s1, s));
        }
    }
View Full Code Here

        // Acquire the select tag we are associated with
        CVSelectTag selectTag = (CVSelectTag) pageContext.getAttribute(Constants.SELECT_KEY);

        if (selectTag == null) {
            JspException e = new JspException(messages.getMessage("optionsCollectionTag.select"));
            RequestUtils.saveException(pageContext, e);
            throw e;
        }

        // Acquire the collection containing our options
        Object collection = RequestUtils.lookup(pageContext, name, property, null);

        if (collection == null) {
            JspException e =
                new JspException(messages.getMessage("optionsCollectionTag.collection"));
            RequestUtils.saveException(pageContext, e);
            throw e;
        }

        // Acquire an iterator over the options collection
        Iterator iter = getIterator(collection);

        StringBuffer sb = new StringBuffer();

        // Render the options
        while (iter.hasNext()) {

            Object bean = iter.next();
            Object beanLabel = null;
            Object beanValue = null;

            // Get the label for this option
            try {
                beanLabel = PropertyUtils.getProperty(bean, label);
                if (beanLabel == null) {
                    beanLabel = "";
                }
            } catch (IllegalAccessException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.access", label, bean));
                RequestUtils.saveException(pageContext, jspe);
                throw jspe;
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                JspException jspe =
                    new JspException(messages.getMessage("getter.result", label, t.toString()));
                RequestUtils.saveException(pageContext, jspe);
                throw jspe;
            } catch (NoSuchMethodException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.method", label, bean));
                RequestUtils.saveException(pageContext, jspe);
                throw jspe;
            }

            // Get the value for this option
            try {
                beanValue = PropertyUtils.getProperty(bean, value);
                if (beanValue == null) {
                    beanValue = "";
                }
            } catch (IllegalAccessException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.access", value, bean));
                RequestUtils.saveException(pageContext, jspe);
                throw jspe;
            } catch (InvocationTargetException e) {
                Throwable t = e.getTargetException();
                JspException jspe =
                    new JspException(messages.getMessage("getter.result", value, t.toString()));
                RequestUtils.saveException(pageContext, jspe);
                throw jspe;
            } catch (NoSuchMethodException e) {
                JspException jspe =
                    new JspException(messages.getMessage("getter.method", value, bean));
                RequestUtils.saveException(pageContext, jspe);
                throw jspe;
            }

            String stringLabel = beanLabel.toString();
View Full Code Here

        } else if (collection instanceof Enumeration) {
            return IteratorUtils.asIterator((Enumeration) collection);

        } else {
            throw new JspException(
                messages.getMessage("optionsCollectionTag.iterator", collection.toString()));
        }
    }
View Full Code Here

    private CVSelectTag selectTag() throws JspException {
        CVSelectTag selectTag =
            (CVSelectTag) pageContext.getAttribute(Constants.SELECT_KEY);
           
        if (selectTag == null) {
            JspException e =
                new JspException(messages.getMessage("optionTag.select"));
               
            RequestUtils.saveException(pageContext, e);
            throw e;
        }
       
View Full Code Here

TOP

Related Classes of javax.servlet.jsp.JspException

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.