Author: dolander
Date: Fri Sep 24 14:04:26 2004
New Revision: 47173
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
Log:
THe FileUpload tag now reports an error when the WebApp doesn't support
multipart request handling.
Changed the test webapp CoreWeb so it does support multipart request handling
so the FileUpload tag can be tested.
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/FileUpload.java
Fri Sep 24 14:04:26 2004
@@ -17,12 +17,13 @@
*/
package org.apache.beehive.netui.tags.html;
+import org.apache.beehive.netui.pageflow.internal.InternalUtils;
import org.apache.beehive.netui.tags.rendering.AbstractHtmlState;
import org.apache.beehive.netui.tags.rendering.InputFileTag;
import org.apache.beehive.netui.tags.rendering.TagRenderingBase;
import org.apache.beehive.netui.util.Bundle;
-import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
/**
@@ -244,8 +245,17 @@
*/
public int doEndTag() throws JspException
{
+ HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
+
+ // if we are not handling multipart requests then we can't output the
file upload tag and we will
+ // report an error
+ if (!InternalUtils.isMultipartHandlingEnabled(req)) {
+ String s = Bundle.getString("Tags_FileMultiOff", null);
+ registerTagError(s, null);
+ return EVAL_PAGE;
+ }
+
String idScript = null;
- ServletRequest req = pageContext.getRequest();
// Create the state for the input tag.
String realName = doNaming();
Modified:
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java
==============================================================================
---
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java
(original)
+++
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/SelectOption.java
Fri Sep 24 14:04:26 2004
@@ -28,19 +28,14 @@
/**
* An option whose state is determined by its enclosing SelectOption.
+ * @jsptagref.tagdescription Renders a single <option> tag.
*
-
- * @jsptagref.tagdescription
- * Renders a single <option> tag.
- *
* <p>The <netui:selectOption> must have a parent [EMAIL PROTECTED] Select}
tag.
- *
+ *
* <p>To dynamically generate a set of <option> tags, point the [EMAIL
PROTECTED] Select}
- * tag at a String[], [EMAIL PROTECTED] java.util.HashMap java.util.HashMap},
+ * tag at a String[], [EMAIL PROTECTED] java.util.HashMap java.util.HashMap},
* or any object that implements [EMAIL PROTECTED] java.util.Map
java.util.Map}.
- *
- * @example
- * The following sample generates a set of <option> tags.
+ * @example The following sample generates a set of <option> tags.
* <pre> <netui:form action="submit">
* <netui:select dataSource="{actionForm.selections}" size="5">
* <netui:selectOption value="red" />
@@ -51,7 +46,6 @@
* </netui:select>
* <netui:button type="submit" value="Submit"/>
* </netui:form></pre>
- *
* @netui:tag name="selectOption" description="An option whose state is
determined by its enclosing netui:selectOption."
* @netui.tldx:tag requiredparent="select"
* requiredchild="label attribute"
@@ -120,13 +114,9 @@
/**
* Set if this option is disabled or not.
* @param disabled - "true" or "false"
- * @jsptagref.attributedescription
- * Boolean. Determines whether the <option> is disabled.
- *
+ * @jsptagref.attributedescription Boolean. Determines whether the
<option> is disabled.
* @jsptagref.databindable Read Only
- *
* @jsptagref.attributesyntaxvalue <i>boolean_disabled</i>
- *
* @netui:attribute required="false" rtexprvalue="true" type="boolean"
* description="Determines whether the <option> is disabled."
* @netui.tldx:attribute category="misc"
@@ -172,14 +162,10 @@
/**
* Set the value of this SelectOption.
* @param value - the SelectOption value
- * @jsptagref.attributedescription
- * A literal or a data binding expression that determines the value
submitted by the
+ * @jsptagref.attributedescription A literal or a data binding expression
that determines the value submitted by the
* <option> tag.
- *
* @jsptagref.databindable Read Only
- *
* @jsptagref.attributesyntaxvalue <i>string_or_expression_value</i>
- *
* @netui:attribute required="true" rtexprvalue="true"
* description="A literal or a data binding expression that determines the
value submitted by the
* <option> tag."
@@ -199,7 +185,7 @@
{
Tag parentTag = getParent();
- while (! (parentTag instanceof Select))
+ while (!(parentTag instanceof Select))
parentTag = parentTag.getParent();
if (parentTag == null) {
@@ -269,7 +255,7 @@
// the parent was validated in the doStartTag call
Tag parentTag = getParent();
- while (! (parentTag instanceof Select))
+ while (!(parentTag instanceof Select))
parentTag = parentTag.getParent();
assert (parentTag instanceof Select);
@@ -296,7 +282,7 @@
_state.id = _id;
}
- _state.disabled = _disabled;
+ _state.disabled = _disabled;
if (parentSelect.isMatched(_value))
_state.selected = true;
Modified:
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
==============================================================================
---
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
(original)
+++
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/netui.properties
Fri Sep 24 14:04:26 2004
@@ -101,6 +101,7 @@
Tags_ParameterRenderError=The parameter type [{0}] was not recognized as a
valid type.
Tags_ParameterAccessError=The parameter type [{0}] was not recognized as a
valid type, attempting to access argument ''{1}''.
Tags_DataSourceExpressionError=An error occurred converting the data source
"{0}" into an expression; {1}
+Tags_FileMultiOff=The FileUpload tag may not be used because Multipart Request
Handling is turned off for this WebApp.
DataSourceError=The expression "<b>{0}</b>" is an invalid expression for a
<b>dataSource</b>. Expressions in a dataSource must bind to a single property.
TreeRootError=The expression "<b>{0}</b>" is invalid. Cause: {1}
Modified:
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
==============================================================================
---
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
(original)
+++
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
Fri Sep 24 14:04:26 2004
@@ -47,6 +47,10 @@
<forward-redirect-handler-class>pageFlowCore.forwards.Controller$Redirector</forward-redirect-handler-class>
</pageflow-handlers>
+ <pageflow-config>
+ <multipart-handler>memory</multipart-handler>
+ </pageflow-config>
+
<iterator-factories>
</iterator-factories>