craigmcc 01/02/11 17:26:59 Modified: src/share/org/apache/struts/taglib/bean CookieTag.java CookieTei.java DefineTag.java DefineTei.java HeaderTag.java HeaderTei.java IncludeTag.java IncludeTei.java LocalStrings.properties MessageTag.java PageTag.java PageTei.java ParameterTag.java ParameterTei.java ResourceTag.java ResourceTei.java StrutsTag.java StrutsTei.java WriteTag.java Log: Clean up licenses, and refactor common code, for the struts-bean tag library implementation classes. Revision Changes Path 1.8 +9 -11 jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java Index: CookieTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- CookieTag.java 2001/02/03 03:23:24 1.7 +++ CookieTag.java 2001/02/12 01:26:57 1.8 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java,v 1.7 2001/02/03 03:23:24 craigmcc Exp $ - * $Revision: 1.7 $ - * $Date: 2001/02/03 03:23:24 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java,v 1.8 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.8 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -71,18 +71,17 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; -import org.apache.struts.action.Action; import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; +import org.apache.struts.util.RequestUtils; - /** * Define a scripting variable based on the value(s) of the specified * cookie received with this request. * * @author Craig R. McClanahan - * @version $Revision: 1.7 $ $Date: 2001/02/03 03:23:24 $ + * @version $Revision: 1.8 $ $Date: 2001/02/12 01:26:57 $ */ public class CookieTag extends TagSupport { @@ -181,9 +180,8 @@ values.add(new Cookie(name, value)); if (values.size() < 1) { JspException e = new JspException - (messages.getMessage("getter.cookie", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + (messages.getMessage("cookie.get", name)); + RequestUtils.saveException(pageContext, e); throw e; } 1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTei.java Index: CookieTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTei.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CookieTei.java 2000/10/30 06:02:10 1.3 +++ CookieTei.java 2001/02/12 01:26:57 1.4 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTei.java,v 1.3 2000/10/30 06:02:10 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2000/10/30 06:02:10 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTei.java,v 1.4 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.4 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -74,7 +74,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.3 $ $Date: 2000/10/30 06:02:10 $ + * @version $Revision: 1.4 $ $Date: 2001/02/12 01:26:57 $ */ public class CookieTei extends TagExtraInfo { 1.11 +8 -64 jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java Index: DefineTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DefineTag.java 2001/01/27 03:59:35 1.10 +++ DefineTag.java 2001/02/12 01:26:57 1.11 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v 1.10 2001/01/27 03:59:35 craigmcc Exp $ - * $Revision: 1.10 $ - * $Date: 2001/01/27 03:59:35 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v 1.11 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.11 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -68,8 +68,6 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; -import org.apache.struts.action.Action; -import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; import org.apache.struts.util.RequestUtils; @@ -79,7 +77,7 @@ * bean property. * * @author Craig R. McClanahan - * @version $Revision: 1.10 $ $Date: 2001/01/27 03:59:35 $ + * @version $Revision: 1.11 $ $Date: 2001/02/12 01:26:57 $ */ public class DefineTag extends TagSupport { @@ -104,14 +102,6 @@ /** - * The message resources for this package. - */ - protected static MessageResources messages = - MessageResources.getMessageResources - ("org.apache.struts.taglib.bean.LocalStrings"); - - - /** * The name of the bean owning the property to be exposed. */ protected String name = null; @@ -206,55 +196,9 @@ public int doStartTag() throws JspException { // Retrieve the required property value - Object bean = null; Object value = this.value; - try { - - if (value == null) { - - // Locate the specified bean - bean = RequestUtils.lookup(pageContext, name, scope); - - // Locate the specified property - if (bean == null) { - JspException e = new JspException - (messages.getMessage("getter.bean", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw e; - } - if (property == null) - value = bean; - else - value = PropertyUtils.getProperty(bean, property); - - } - - } catch (IllegalAccessException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.access", property, name)); - } catch (IllegalArgumentException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.scope", scope)); - } catch (InvocationTargetException e) { - Throwable t = e.getTargetException(); - if (t == null) - t = e; - pageContext.setAttribute(Action.EXCEPTION_KEY, t, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.invocation", - property, name, t.toString())); - } catch (NoSuchMethodException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.method", property, name)); - } + if (value == null) + value = RequestUtils.lookup(pageContext, name, property, scope); // Expose this value as a scripting variable int inScope = PageContext.PAGE_SCOPE; 1.5 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java Index: DefineTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DefineTei.java 2001/01/28 03:59:12 1.4 +++ DefineTei.java 2001/02/12 01:26:57 1.5 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java,v 1.4 2001/01/28 03:59:12 craigmcc Exp $ - * $Revision: 1.4 $ - * $Date: 2001/01/28 03:59:12 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java,v 1.5 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.5 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -73,7 +73,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.4 $ $Date: 2001/01/28 03:59:12 $ + * @version $Revision: 1.5 $ $Date: 2001/02/12 01:26:57 $ */ public class DefineTei extends TagExtraInfo { 1.7 +11 -14 jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java Index: HeaderTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- HeaderTag.java 2001/02/03 03:23:24 1.6 +++ HeaderTag.java 2001/02/12 01:26:57 1.7 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java,v 1.6 2001/02/03 03:23:24 craigmcc Exp $ - * $Revision: 1.6 $ - * $Date: 2001/02/03 03:23:24 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTag.java,v 1.7 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.7 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -71,18 +71,17 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; -import org.apache.struts.action.Action; import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; +import org.apache.struts.util.RequestUtils; - /** * Define a scripting variable based on the value(s) of the specified * header received with this request. * * @author Craig R. McClanahan - * @version $Revision: 1.6 $ $Date: 2001/02/03 03:23:24 $ + * @version $Revision: 1.7 $ $Date: 2001/02/12 01:26:57 $ */ public class HeaderTag extends TagSupport { @@ -174,9 +173,8 @@ value = this.value; if (value == null) { JspException e = new JspException - (messages.getMessage("getter.header", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + (messages.getMessage("header.get", name)); + RequestUtils.saveException(pageContext, e); throw e; } pageContext.setAttribute(id, value); @@ -194,9 +192,8 @@ String headers[] = new String[values.size()]; if (headers.length == 0) { JspException e = new JspException - (messages.getMessage("getter.header", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + (messages.getMessage("header.get", name)); + RequestUtils.saveException(pageContext, e); throw e; } pageContext.setAttribute(id, (String[]) values.toArray(headers)); 1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTei.java Index: HeaderTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTei.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HeaderTei.java 2000/10/30 06:02:11 1.3 +++ HeaderTei.java 2001/02/12 01:26:57 1.4 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTei.java,v 1.3 2000/10/30 06:02:11 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2000/10/30 06:02:11 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/HeaderTei.java,v 1.4 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.4 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -73,7 +73,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.3 $ $Date: 2000/10/30 06:02:11 $ + * @version $Revision: 1.4 $ $Date: 2001/02/12 01:26:57 $ */ public class HeaderTei extends TagExtraInfo { 1.10 +18 -16 jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTag.java Index: IncludeTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTag.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- IncludeTag.java 2001/01/16 01:20:53 1.9 +++ IncludeTag.java 2001/02/12 01:26:57 1.10 @@ -1,10 +1,10 @@ /* - * $Id: IncludeTag.java,v 1.9 2001/01/16 01:20:53 craigmcc Exp $ + * $Id: IncludeTag.java,v 1.10 2001/02/12 01:26:57 craigmcc Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -89,7 +89,7 @@ * wrapped response passed to RequestDispatcher.include(). * * @author Craig R. McClanahan - * @version $Revision: 1.9 $ $Date: 2001/01/16 01:20:53 $ + * @version $Revision: 1.10 $ $Date: 2001/02/12 01:26:57 $ */ public class IncludeTag extends TagSupport { @@ -202,8 +202,7 @@ conn.setDoOutput(false); conn.connect(); } catch (Exception e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw new JspException (messages.getMessage("include.open", url.toString(), e.toString())); @@ -225,8 +224,7 @@ } in.close(); } catch (Exception e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw new JspException (messages.getMessage("include.read", url.toString(), e.toString())); @@ -277,8 +275,7 @@ if (n != 1) { JspException e = new JspException (messages.getMessage("include.destination")); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw e; } @@ -289,13 +286,19 @@ ActionForwards forwards = (ActionForwards) pageContext.getAttribute(Action.FORWARDS_KEY, PageContext.APPLICATION_SCOPE); - if (forwards == null) - throw new JspException + if (forwards == null) { + JspException e = new JspException (messages.getMessage("include.forwards")); + RequestUtils.saveException(pageContext, e); + throw e; + } ActionForward forward = forwards.findForward(this.forward); - if (forward == null) - throw new JspException + if (forward == null) { + JspException e = new JspException (messages.getMessage("include.forward", this.forward)); + RequestUtils.saveException(pageContext, e); + throw e; + } HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); href = RequestUtils.absoluteURL(request, forward.getPath()); @@ -334,10 +337,9 @@ try { return (new URL(href)); } catch (MalformedURLException e) { + RequestUtils.saveException(pageContext, e); JspException f = new JspException (messages.getMessage("include.malformed", href)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.APPLICATION_SCOPE); throw f; } 1.3 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTei.java Index: IncludeTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTei.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IncludeTei.java 2000/10/30 06:02:12 1.2 +++ IncludeTei.java 2001/02/12 01:26:57 1.3 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTei.java,v 1.2 2000/10/30 06:02:12 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/10/30 06:02:12 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/IncludeTei.java,v 1.3 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -73,7 +73,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/10/30 06:02:12 $ + * @version $Revision: 1.3 $ $Date: 2001/02/12 01:26:57 $ */ public class IncludeTei extends TagExtraInfo { 1.9 +6 -15 jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties Index: LocalStrings.properties =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- LocalStrings.properties 2001/01/16 01:13:49 1.8 +++ LocalStrings.properties 2001/02/12 01:26:57 1.9 @@ -1,17 +1,6 @@ -common.io=Encountered input/output error: {0} -getter.access=IllegalAccessException accessing property {0} of bean {1} -getter.argument=IllegalArgumentException: {0} -getter.bean=No bean found for attribute key {0} -getter.cookie=No cookie {0} was included in this request -getter.header=No header {0} was included in this request -getter.invocation=InvocationTargetException accessing property {0} of bean {1}: {2} -getter.io=IOException: {0} -getter.method=No property getter method for property {0} of bean {1} -getter.parameter=No parameter {0} was included in this request -getter.resource=No resource {0} available in this application -getter.scope=Invalid bean scope {0} specified -include.destination=You must specify exactly one of 'forward', 'href', or 'page' -include.format=Context relative name {0} must start with a '/' character +cookie.get=No cookie {0} was included in this request +header.get=No header {0} was included in this request +include.destination=You must specify exactly one of forward, href, or page include.forward=Missing ActionForward entry {0} include.forwards=Missing ActionForwards application scope bean include.malformed=Cannot create URL for {0} @@ -20,5 +9,7 @@ message.message=Missing message for key {0} message.resources=Missing resources attribute {0} page.selector=Invalid page context selector {0} +parameter.get=No parameter {0} was included in this request +resource.get=No resource {0} available in this application struts.missing=No Struts internal object named {0} is available -struts.selector=You must specify exactly one of formBean, forward, and mapping +struts.selector=You must specify exactly one of formBean, forward, or mapping 1.3 +11 -20 jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java Index: MessageTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MessageTag.java 2001/01/16 01:13:49 1.2 +++ MessageTag.java 2001/02/12 01:26:57 1.3 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java,v 1.2 2001/01/16 01:13:49 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2001/01/16 01:13:49 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java,v 1.3 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -71,6 +71,8 @@ import javax.servlet.jsp.tagext.TagSupport; import org.apache.struts.action.Action; import org.apache.struts.util.MessageResources; +import org.apache.struts.util.RequestUtils; +import org.apache.struts.util.ResponseUtils; /** @@ -80,7 +82,7 @@ * <code>ActionServlet</code> implementation. * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2001/01/16 01:13:49 $ + * @version $Revision: 1.3 $ $Date: 2001/02/12 01:26:57 $ */ public class MessageTag extends TagSupport { @@ -231,8 +233,7 @@ if (resources == null) { JspException e = new JspException (messages.getMessage("message.resources", bundle)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw e; } @@ -260,22 +261,12 @@ if (message == null) { JspException e = new JspException (messages.getMessage("message.message", key)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw e; } // Print the retrieved message to our output writer - JspWriter writer = pageContext.getOut(); - try { - writer.print(message); - } catch (IOException e) { - JspException t = new JspException - (messages.getMessage("common.io", e.toString())); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw t; - } + ResponseUtils.write(pageContext, message); // Continue processing this page return (SKIP_BODY); 1.5 +8 -9 jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTag.java Index: PageTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PageTag.java 2000/10/30 06:02:12 1.4 +++ PageTag.java 2001/02/12 01:26:57 1.5 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTag.java,v 1.4 2000/10/30 06:02:12 craigmcc Exp $ - * $Revision: 1.4 $ - * $Date: 2000/10/30 06:02:12 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTag.java,v 1.5 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.5 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -67,10 +67,10 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; -import org.apache.struts.action.Action; import org.apache.struts.util.BeanUtils; import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; +import org.apache.struts.util.RequestUtils; /** @@ -78,7 +78,7 @@ * item as a scripting variable and a page scope bean. * * @author Craig R. McClanahan - * @version $Revision: 1.4 $ $Date: 2000/10/30 06:02:12 $ + * @version $Revision: 1.5 $ $Date: 2001/02/12 01:26:57 $ */ public class PageTag extends TagSupport { @@ -150,8 +150,7 @@ else { JspException e = new JspException (messages.getMessage("page.selector", property)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw e; } 1.3 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTei.java Index: PageTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTei.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PageTei.java 2000/10/30 06:02:13 1.2 +++ PageTei.java 2001/02/12 01:26:57 1.3 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTei.java,v 1.2 2000/10/30 06:02:13 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/10/30 06:02:13 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/PageTei.java,v 1.3 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -73,7 +73,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/10/30 06:02:13 $ + * @version $Revision: 1.3 $ $Date: 2001/02/12 01:26:57 $ */ public class PageTei extends TagExtraInfo { 1.6 +11 -13 jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTag.java Index: ParameterTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ParameterTag.java 2001/02/03 03:23:24 1.5 +++ ParameterTag.java 2001/02/12 01:26:57 1.6 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTag.java,v 1.5 2001/02/03 03:23:24 craigmcc Exp $ - * $Revision: 1.5 $ - * $Date: 2001/02/03 03:23:24 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTag.java,v 1.6 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.6 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -68,9 +68,9 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; -import org.apache.struts.action.Action; import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; +import org.apache.struts.util.RequestUtils; @@ -79,7 +79,7 @@ * parameter received with this request. * * @author Craig R. McClanahan - * @version $Revision: 1.5 $ $Date: 2001/02/03 03:23:24 $ + * @version $Revision: 1.6 $ $Date: 2001/02/12 01:26:57 $ */ public class ParameterTag extends TagSupport { @@ -173,9 +173,8 @@ value = this.value; if (value == null) { JspException e = new JspException - (messages.getMessage("getter.parameter", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + (messages.getMessage("parameter.get", name)); + RequestUtils.saveException(pageContext, e); throw e; } pageContext.setAttribute(id, value); @@ -193,9 +192,8 @@ } if ((values == null) || (values.length == 0)) { JspException e = new JspException - (messages.getMessage("getter.parameter", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + (messages.getMessage("parameter.get", name)); + RequestUtils.saveException(pageContext, e); throw e; } pageContext.setAttribute(id, values); 1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTei.java Index: ParameterTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTei.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ParameterTei.java 2000/10/30 06:02:13 1.3 +++ ParameterTei.java 2001/02/12 01:26:57 1.4 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTei.java,v 1.3 2000/10/30 06:02:13 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2000/10/30 06:02:13 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ParameterTei.java,v 1.4 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.4 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -73,7 +73,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.3 $ $Date: 2000/10/30 06:02:13 $ + * @version $Revision: 1.4 $ $Date: 2001/02/12 01:26:57 $ */ public class ParameterTei extends TagExtraInfo { 1.7 +11 -13 jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTag.java Index: ResourceTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTag.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ResourceTag.java 2000/10/30 06:02:14 1.6 +++ ResourceTag.java 2001/02/12 01:26:57 1.7 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTag.java,v 1.6 2000/10/30 06:02:14 craigmcc Exp $ - * $Revision: 1.6 $ - * $Date: 2000/10/30 06:02:14 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTag.java,v 1.7 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.7 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -70,9 +70,9 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; -import org.apache.struts.action.Action; import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; +import org.apache.struts.util.RequestUtils; @@ -81,7 +81,7 @@ * web application resource. * * @author Craig R. McClanahan - * @version $Revision: 1.6 $ $Date: 2000/10/30 06:02:14 $ + * @version $Revision: 1.7 $ $Date: 2001/02/12 01:26:57 $ */ public class ResourceTag extends TagSupport { @@ -162,9 +162,8 @@ pageContext.getServletContext().getResourceAsStream(name); if (stream == null) { JspException e = new JspException - (messages.getMessage("getter.resource", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + (messages.getMessage("resource.get", name)); + RequestUtils.saveException(pageContext, e); throw e; } @@ -190,10 +189,9 @@ reader.close(); pageContext.setAttribute(id, sb.toString()); } catch (IOException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw new JspException - (messages.getMessage("getter.resource", name)); + (messages.getMessage("resource.get", name)); } return (SKIP_BODY); 1.4 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTei.java Index: ResourceTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTei.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ResourceTei.java 2000/10/30 06:02:14 1.3 +++ ResourceTei.java 2001/02/12 01:26:57 1.4 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTei.java,v 1.3 2000/10/30 06:02:14 craigmcc Exp $ - * $Revision: 1.3 $ - * $Date: 2000/10/30 06:02:14 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/ResourceTei.java,v 1.4 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.4 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -74,7 +74,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.3 $ $Date: 2000/10/30 06:02:14 $ + * @version $Revision: 1.4 $ $Date: 2001/02/12 01:26:57 $ */ public class ResourceTei extends TagExtraInfo { 1.6 +9 -11 jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTag.java Index: StrutsTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- StrutsTag.java 2001/01/06 01:50:25 1.5 +++ StrutsTag.java 2001/02/12 01:26:57 1.6 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTag.java,v 1.5 2001/01/06 01:50:25 craigmcc Exp $ - * $Revision: 1.5 $ - * $Date: 2001/01/06 01:50:25 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTag.java,v 1.6 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.6 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -71,9 +71,9 @@ import org.apache.struts.action.ActionFormBeans; import org.apache.struts.action.ActionForwards; import org.apache.struts.action.ActionMappings; -import org.apache.struts.util.BeanUtils; import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; +import org.apache.struts.util.RequestUtils; /** @@ -81,7 +81,7 @@ * internal configuraton object. * * @author Craig R. McClanahan - * @version $Revision: 1.5 $ $Date: 2001/01/06 01:50:25 $ + * @version $Revision: 1.6 $ $Date: 2001/02/12 01:26:57 $ */ public class StrutsTag extends TagSupport { @@ -177,8 +177,7 @@ if (n != 1) { JspException e = new JspException (messages.getMessage("struts.selector")); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw e; } @@ -210,8 +209,7 @@ if (object == null) { JspException e = new JspException (messages.getMessage("struts.missing", selector)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); + RequestUtils.saveException(pageContext, e); throw e; } 1.3 +6 -6 jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTei.java Index: StrutsTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTei.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StrutsTei.java 2000/10/30 06:02:15 1.2 +++ StrutsTei.java 2001/02/12 01:26:57 1.3 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTei.java,v 1.2 2000/10/30 06:02:15 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/10/30 06:02:15 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/StrutsTei.java,v 1.3 2001/02/12 01:26:57 craigmcc Exp $ + * $Revision: 1.3 $ + * $Date: 2001/02/12 01:26:57 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -73,7 +73,7 @@ * tag, identifying the scripting object(s) to be made visible. * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/10/30 06:02:15 $ + * @version $Revision: 1.3 $ $Date: 2001/02/12 01:26:57 $ */ public class StrutsTei extends TagExtraInfo { 1.10 +20 -92 jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java Index: WriteTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- WriteTag.java 2001/01/07 22:39:07 1.9 +++ WriteTag.java 2001/02/12 01:26:58 1.10 @@ -1,13 +1,13 @@ /* - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v 1.9 2001/01/07 22:39:07 craigmcc Exp $ - * $Revision: 1.9 $ - * $Date: 2001/01/07 22:39:07 $ + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v 1.10 2001/02/12 01:26:58 craigmcc Exp $ + * $Revision: 1.10 $ + * $Date: 2001/02/12 01:26:58 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999 The Apache Software Foundation. All rights + * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * Alternately, this acknowlegement may appear in the software itself, * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * 4. The names "The Jakarta Project", "Struts", and "Apache Software * Foundation" must not be used to endorse or promote products derived * from this software without prior written permission. For written * permission, please contact [EMAIL PROTECTED] @@ -63,17 +63,12 @@ package org.apache.struts.taglib.bean; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; -import org.apache.struts.action.Action; -import org.apache.struts.util.BeanUtils; -import org.apache.struts.util.MessageResources; import org.apache.struts.util.PropertyUtils; import org.apache.struts.util.RequestUtils; +import org.apache.struts.util.ResponseUtils; /** @@ -82,7 +77,7 @@ * output stream, optionally filtering characters that are sensitive in HTML. * * @author Craig R. McClanahan - * @version $Revision: 1.9 $ $Date: 2001/01/07 22:39:07 $ + * @version $Revision: 1.10 $ $Date: 2001/02/12 01:26:58 $ */ public class WriteTag extends TagSupport { @@ -121,14 +116,6 @@ /** - * The message resources for this package. - */ - protected static MessageResources messages = - MessageResources.getMessageResources - ("org.apache.struts.taglib.bean.LocalStrings"); - - - /** * Name of the bean that contains the data we will be rendering. */ protected String name = null; @@ -181,84 +168,25 @@ */ public int doStartTag() throws JspException { - // Retrieve the required property value + // Look up the requested bean (if necessary) Object bean = null; - Object value = null; - try { - - // Locate the specified bean - try { - bean = RequestUtils.lookup(pageContext, name, scope); - } catch (IllegalArgumentException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.scope", scope)); - } - if ((bean == null) && ignore) + if (ignore) { + if (RequestUtils.lookup(pageContext, name, scope) == null) return (SKIP_BODY); // Nothing to output - else if (bean == null) { - JspException e = new JspException - (messages.getMessage("getter.bean", name)); - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw e; - } - - // Locate the specified property - if (property == null) - value = bean; - else - value = PropertyUtils.getProperty(bean, property); - if (value == null) - return (SKIP_BODY); // Nothing to output - - // Convert the property value to a String if necessary - // FIXME - deal with array valued properties - // FIXME - use a PropertyEditor as necessary - if (!(value instanceof String)) - value = value.toString(); - - } catch (IllegalAccessException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.access", property, name)); - } catch (IllegalArgumentException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.argument", e.toString())); - } catch (InvocationTargetException e) { - Throwable t = e.getTargetException(); - if (t == null) - t = e; - pageContext.setAttribute(Action.EXCEPTION_KEY, t, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.invocation", - property, name, t.toString())); - } catch (NoSuchMethodException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.method", property, name)); } + // Look up the requested property value + Object value = + RequestUtils.lookup(pageContext, name, property, scope); + if (value == null) + return (SKIP_BODY); // Nothing to output // Print this property value to our output writer, suitably filtered - JspWriter writer = pageContext.getOut(); - try { - if (filter) - writer.print(BeanUtils.filter((String) value)); - else - writer.print((String) value); - } catch (IOException e) { - pageContext.setAttribute(Action.EXCEPTION_KEY, e, - PageContext.REQUEST_SCOPE); - throw new JspException - (messages.getMessage("getter.io", e.toString())); - } + String output = value.toString(); + if (filter) + ResponseUtils.write(pageContext, ResponseUtils.filter(output)); + else + ResponseUtils.write(pageContext, output); // Continue processing this page return (SKIP_BODY);