Pierre Thibaudeau wrote:
Is there a way to avoid null-valued (or empty-valued) parameters to be
explicitely mentioned in the URL generated by a form submitted through the
GET method?
For instance, here's a form:
<s:form action="myAction" method="get">
<s:textfield name="param1" />
<s:textfield name="param2" />
<s:submit />
</s:form>
If the user types "FOO" in the first textfield and nothing in the second,
the submitted URL will be something like:
http://myhost.com/myAction.action?param1=FOO¶m2=
Can I get rid of the "param2=" part, which serves no purpose?
(The alternative would be to POST the method to an action that would merely
redirect to the desired action, dropping the undesired parameters along the
way.)
This is expected behabiour; short of doing some JavaScript-fu on form
submit, I don't think you can avoid the empty params. That said, if the
form submit is going to cause any data updates on the server, it really
should be a POST anyway -- and if not, I'm not sure why the 'noise' in
the URL matters.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]