You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by ri...@locus.apache.org on 2000/05/08 17:01:25 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp/library XSPRequestLibrary.java
ricardo 00/05/08 08:01:25
Modified: src/org/apache/cocoon/processor/xsp/library
XSPRequestLibrary.java
Log:
Added 'defaultValue' argument to 'getParameter' methods. This optional value will substitute missing request attributes
Revision Changes Path
1.6 +12 -2 xml-cocoon/src/org/apache/cocoon/processor/xsp/library/XSPRequestLibrary.java
Index: XSPRequestLibrary.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/XSPRequestLibrary.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSPRequestLibrary.java 2000/02/13 18:29:37 1.5
+++ XSPRequestLibrary.java 2000/05/08 15:01:24 1.6
@@ -203,8 +203,9 @@
return element;
}
- public static Element getParameter(HttpServletRequest request, String name, Document document) {
- String value = request.getParameter(name);
+ public static Element getParameter(HttpServletRequest request, String name, String defaultValue, Document document) {
+ String value = getParameter(request, name, defaultValue);
+
Element element = document.createElement("request:parameter");
element.setAttribute("name", name);
@@ -213,6 +214,15 @@
}
return element;
+ }
+
+ public static String getParameter(HttpServletRequest request, String name, String defaultValue) {
+ String value = request.getParameter(name);
+ if (value == null) {
+ value = defaultValue;
+ }
+
+ return value;
}
public static Element getParameterValues(HttpServletRequest request, String name, Document document) {