dgraham 2003/11/15 13:33:57 Modified: src/share/org/apache/struts/taglib/html MultiboxTag.java Log: Minor formatting changes such as using braces for one line if blocks to prevent confusion. Revision Changes Path 1.22 +24 -16 jakarta-struts/src/share/org/apache/struts/taglib/html/MultiboxTag.java Index: MultiboxTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/MultiboxTag.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- MultiboxTag.java 31 Jul 2003 00:34:15 -0000 1.21 +++ MultiboxTag.java 15 Nov 2003 21:33:57 -0000 1.22 @@ -7,7 +7,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2003 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -188,12 +188,15 @@ */ public int doAfterBody() throws JspException { - if (bodyContent != null) + if (bodyContent != null) { this.constant = bodyContent.getString().trim(); - if ("".equals(this.constant)) + } + + if ("".equals(this.constant)) { this.constant = null; - return (SKIP_BODY); - + } + + return SKIP_BODY; } /** @@ -219,9 +222,8 @@ results.append("\""); } results.append(" value=\""); - String value = this.value; - if (value == null) - value = this.constant; + String value = (this.value == null) ? this.constant : this.value; + if (value == null) { JspException e = new JspException(messages.getMessage("multiboxTag.value")); pageContext.setAttribute(Globals.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE); @@ -231,12 +233,17 @@ results.append("\""); Object bean = TagUtils.getInstance().lookup(pageContext, name, null); String values[] = null; - if (bean == null) + + if (bean == null) { throw new JspException(messages.getMessage("getter.bean", name)); + } + try { values = BeanUtils.getArrayProperty(bean, property); - if (values == null) + if (values == null) { values = new String[0]; + } + } catch (IllegalAccessException e) { throw new JspException(messages.getMessage("getter.access", property, name)); } catch (InvocationTargetException e) { @@ -245,20 +252,21 @@ } catch (NoSuchMethodException e) { throw new JspException(messages.getMessage("getter.method", property, name)); } + for (int i = 0; i < values.length; i++) { if (value.equals(values[i])) { results.append(" checked=\"checked\""); break; } } + results.append(prepareEventHandlers()); results.append(prepareStyles()); results.append(getElementClose()); TagUtils.getInstance().write(pageContext, results.toString()); - return (EVAL_PAGE); - + return EVAL_PAGE; } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]