Here's a little patch to add a locationHash attribute to the
html:form tag.

e.g. <html:form action="/lesson/gradeQuiz" locationHash="quizId">

turns into <form action="/tutor/lesson/gradeQuiz.do#quizId">

so a user doesn't have to scroll to see the results..

I couldn't find the struts-html.tld in the src distro to patch,
and it looks like it might be auto-generated?  Anyway, I hope
someone finds this patch usefull..

Zach
--- FormTag.java        Mon Aug 12 22:14:38 2002
+++ FormTag.new Wed Sep 11 09:41:09 2002
@@ -206,6 +206,12 @@
 
 
     /**
+     * The location hash to append to the url.
+     */
+    protected String locationHash = null;
+
+
+    /**
      * The name of the form bean to (create and) use. This is either the same
      * as the 'name' attribute, if that was specified, or is obtained from the
      * associated <code>ActionMapping</code> otherwise.
@@ -529,6 +535,28 @@
     }
 
 
+    /**
+     * Return the location hash.
+     */
+    public String getLocationHash() {
+
+        return (this.locationHash);
+
+    }
+
+
+    /**
+     * Set the location hash for the url.
+     *
+     * @param type The new location hash
+     */
+    public void setLocationHash(String locationHash) {
+
+        this.locationHash = locationHash;
+
+    }
+
+
     // --------------------------------------------------------- Public Methods
 
 
@@ -553,6 +581,10 @@
         results.append(method == null ? "POST" : method);
         results.append("\" action=\"");
         results.append(response.encodeURL(getActionMappingURL()));
+        if (locationHash != null) {
+            results.append("#");
+            results.append(locationHash);
+        }
         results.append("\"");
         if (styleClass != null) {
             results.append(" class=\"");

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to