struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Audley <>
Subject RE: Request to reserve two hidden field names
Date Tue, 03 Oct 2000 18:49:13 GMT
Setting aside the debate as to whether this is necessary or not, if you
chose to reserve names PLEASE don't try and grab common names like these.  I
guarantee that code out there already uses them.  Pick names with a common
prefix, such as strutsCmd and strutsToken that are far less likely to create
name collisions.


-----Original Message-----
From: Robert Leland []
Sent: Tuesday, October 03, 2000 10:39 AM
Subject: Request to reserve two hidden field names

Over the last week in beginning to work with struts I have found
myself creating hidden fields to pass information on which button
the user has clicked. Then taking alternative "forwarding" actions
in the associated Action class.

So I have been doing:
<struts:input type="submit" value="Button1"
<struts:input type="submit" value="Button2"

I would like to propose a convention of reserving two hidden field names:
"cmd" and "token" as a --first-- step to providing an
of dispatching commands. That way if and when I can cleanly fit
this method into struts it would be available to all.

"cmd" would be the hidden field name to store commands.
"token" would be hidden field to store tokens for commands
            that need to assure transaction integrity which should
            only be performed once. A token can be used only once,
            and is destroyed after its use.

The ultimate goal is to present the user a non changing URL,
provide for transaction integrity when needed,
and provide a standard method for handling multiple commands from
a menu of choices:

as I don't want to reinvent the wheel !!!

The page form tag would ultimetely look like:
<struts:form name="menu" action="" >

For now I plan on staying completely inside the struts framework,
I have a deadline Oct 16. So my apps won't have the common URL
but will have the other attributes and so I use a unique name for each form.

I am providing for the alternate commands inside each page's associated
Action class, probably like everyone else.
Then using the mapping.findForward(cmd) to find the next action.

FYI I am basing my idea's on the techniques presented in
"Web Development with Java Server Pages"

Comments ?


View raw message