Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/edit
In directory james.mmbase.org:/tmp/cvs-serv12585
Modified Files:
Tag: MMBase-1_8
FormTag.java
Log Message:
details + comments + documentation
See also:
http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/edit
Index: FormTag.java
===================================================================
RCS file:
/var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/edit/FormTag.java,v
retrieving revision 1.6.2.5
retrieving revision 1.6.2.6
diff -u -b -r1.6.2.5 -r1.6.2.6
--- FormTag.java 28 Nov 2007 18:00:21 -0000 1.6.2.5
+++ FormTag.java 22 Apr 2008 22:56:52 -0000 1.6.2.6
@@ -26,7 +26,7 @@
* The result can be reported with mm:valid.
*
* @author Michiel Meeuwissen
- * @version $Id: FormTag.java,v 1.6.2.5 2007/11/28 18:00:21 michiel Exp $
+ * @version $Id: FormTag.java,v 1.6.2.6 2008/04/22 22:56:52 michiel Exp $
* @since MMBase-1.8
*/
@@ -36,10 +36,28 @@
public static final String KEY = "org.mmbase.bridge.jsp.taglib.form";
public static final int SCOPE = PageContext.REQUEST_SCOPE;
+ /**
+ * Produces an HTML form, and (reuses) an MMBase transaction. Only
explicit commit/cancel (with
+ * mm:commit, mm:cancel, or 'commitonclose').
+ */
public static final int MODE_HTML_FORM = 0;
+
+ /**
+ * Produces an URL for an HTML form only, and (reuses) an MMBase
transaction. Only explicit commit/cancel.
+ */
public static final int MODE_URL = 1;
+
+ /**
+ * Does not produce any content. Implicitely cancels the transaction if
not committed.
+ */
public static final int MODE_VALIDATE = 2;
+ /**
+ * Does not produce any content. Behaves like mm:transaction. Only
difference is that on default
+ * it does not commit on close.
+ */
+ public static final int MODE_TRANSACTION = 3;
+
private Attribute mode = Attribute.NULL;
private int m;
@@ -75,6 +93,8 @@
return MODE_URL;
} else if (m.equals("validate")) {
return MODE_VALIDATE;
+ } else if (m.equals("transaction")) {
+ return MODE_TRANSACTION;
} else {
throw new JspTagException("Value '" + m + "' not known for 'mode'
attribute");
}
@@ -104,6 +124,7 @@
break;
case MODE_HTML_FORM:
String url = page.getString(this);
+ if (url.startsWith("/")) url =
((javax.servlet.http.HttpServletRequest)
pageContext.getRequest()).getContextPath() + url;
String id = getId();
String c = clazz.getString(this);
try {
@@ -130,15 +151,18 @@
} catch (java.io.IOException ioe) {
throw new TaglibException(ioe);
}
+ break;
}
if (getId() != null) {
getContextProvider().getContextContainer().unRegister(getId());
}
Transaction t = transaction;
int result = super.doEndTag();
+ if (m == MODE_VALIDATE) {
if (! t.isCommitted()) {
t.cancel();
}
+ }
return result;
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs