You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vineet Bhatia <vi...@mac.com> on 2003/05/07 00:12:21 UTC
Code for AddHiddenParameter()
This is referring to a old post I found in the archives.
http://www.mail-archive.com/struts-dev@jakarta.apache.org/msg01446.html
Basically I am (like any other web developer) trying to solve the universal
problem of maintaining state across pages (actions).
I am looking at the option of passing information in html hidden variables.
I searched the archives and found that someone had created a helper method
to handle this.
>From the old post - posted by roland huss (consol.de)
Hidden Parameters. Our extension of Action has an
"addHiddenParameter()" method which put hidden parameters into
request scope which our subclassed FormTag renders as
HTML-Tags. With this method it is very easy to push parameters around
to several actions (without polluting session scope).
Anyone know if this was contributed to struts?
Thanks in advance.
- vineet
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Code for AddHiddenParameter()
Posted by Vineet Bhatia <vi...@mac.com>.
Nevermind. Found it in scaffold.
Friendly method to render hidden html fields
http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/scaffold/src/java/org/
apache/commons/scaffold/text/ConvertUtils.java?rev=1.8&content-type=text/vnd
.viewcvs-markup
/**
* Returns parameters as a series of hidden HTML fields.
*/
public static String renderHiddenFields(Map parameters) {
if ((null==parameters) || (parameters.isEmpty())) return new
String();
StringBuffer html = new StringBuffer();
Set entries = parameters.entrySet();
for (Iterator i = entries.iterator(); i.hasNext(); ) {
html.append("<input type='hidden' name='");
Entry e = (Entry) i.next();
html.append(e.getKey());
html.append("' value='");
html.append(e.getValue());
html.append("' />");
}
return html.toString();
}
- vineet
On 5/6/03 6:12 PM, "Vineet Bhatia" <vi...@mac.com> wrote:
> This is referring to a old post I found in the archives.
>
> http://www.mail-archive.com/struts-dev@jakarta.apache.org/msg01446.html
>
> Basically I am (like any other web developer) trying to solve the universal
> problem of maintaining state across pages (actions).
>
> I am looking at the option of passing information in html hidden variables.
>
> I searched the archives and found that someone had created a helper method
> to handle this.
>
> From the old post - posted by roland huss (consol.de)
>
> Hidden Parameters. Our extension of Action has an
> "addHiddenParameter()" method which put hidden parameters into
> request scope which our subclassed FormTag renders as
> HTML-Tags. With this method it is very easy to push parameters around
> to several actions (without polluting session scope).
>
> Anyone know if this was contributed to struts?
>
> Thanks in advance.
> - vineet
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org