dgraham 2003/07/13 17:00:14 Modified: src/share/org/apache/struts/taglib/bean ParameterTag.java Log: Fixed formatting. Revision Changes Path 1.9 +29 -41 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ParameterTag.java 22 Sep 2002 06:32:46 -0000 1.8 +++ ParameterTag.java 14 Jul 2003 00:00:14 -0000 1.9 @@ -7,7 +7,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,17 +59,14 @@ * */ - package org.apache.struts.taglib.bean; - import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.TagSupport; + import org.apache.struts.util.MessageResources; import org.apache.struts.util.RequestUtils; - - /** * Define a scripting variable based on the value(s) of the specified * parameter received with this request. @@ -77,13 +74,10 @@ * @author Craig R. McClanahan * @version $Revision$ $Date$ */ - public class ParameterTag extends TagSupport { - // ------------------------------------------------------------- Properties - /** * The name of the scripting variable that will be exposed as a page * scope attribute. @@ -98,14 +92,12 @@ this.id = id; } - /** * The message resources for this package. */ protected static MessageResources messages = - MessageResources.getMessageResources - ("org.apache.struts.taglib.bean.LocalStrings"); - + MessageResources.getMessageResources( + "org.apache.struts.taglib.bean.LocalStrings"); /** * Return an array of parameter values if <code>multiple</code> is @@ -121,7 +113,6 @@ this.multiple = multiple; } - /** * The name of the parameter whose value is to be exposed. */ @@ -135,7 +126,6 @@ this.name = name; } - /** * The default value to return if no parameter of the specified name is * found. @@ -150,10 +140,8 @@ this.value = value; } - // --------------------------------------------------------- Public Methods - /** * Retrieve the required property and expose it as a scripting variable. * @@ -163,41 +151,42 @@ // Deal with a single parameter value if (multiple == null) { - String value = - pageContext.getRequest().getParameter(name); - if ((value == null) && (this.value != null)) + String value = pageContext.getRequest().getParameter(name); + if ((value == null) && (this.value != null)) { value = this.value; - if (value == null) { - JspException e = new JspException - (messages.getMessage("parameter.get", name)); + } + + if (value == null) { + JspException e = + new JspException(messages.getMessage("parameter.get", name)); RequestUtils.saveException(pageContext, e); throw e; } - pageContext.setAttribute(id, value); - return (SKIP_BODY); - } - - // Deal with multiple parameter values - String values[] = - pageContext.getRequest().getParameterValues(name); + + pageContext.setAttribute(id, value); + return (SKIP_BODY); + } + + // Deal with multiple parameter values + String values[] = pageContext.getRequest().getParameterValues(name); if ((values == null) || (values.length == 0)) { if (this.value != null) { - values = new String[1]; - values[0] = this.value; + values = new String[] { this.value }; } } - if ((values == null) || (values.length == 0)) { - JspException e = new JspException - (messages.getMessage("parameter.get", name)); + + if ((values == null) || (values.length == 0)) { + JspException e = + new JspException(messages.getMessage("parameter.get", name)); RequestUtils.saveException(pageContext, e); throw e; } - pageContext.setAttribute(id, values); + + pageContext.setAttribute(id, values); return (SKIP_BODY); } - /** * Release all allocated resources. */ @@ -210,6 +199,5 @@ value = null; } - }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]