portal - Using static strings to define input field names in JSPs - good idea or not? -


I'm just asked to work on a large portal project and looking through the code it's installed. I find it in JSPS:

  & lt; Input class = "portlet-form-button" name = "& lt;% = ModifyUserProfile.FORM_FIRST_TIME_LOGIN_SUBMIT%>" Type = "submit" ...  

To define the names of input fields and buttons in JSP forms, the author is using a static string defined in the classes.

I have never seen such a thing before and thinking that this is a common thing. I do not want to think, but I am asking because, besides centralizing the names, I have thought that they can not make changes, I can not see the reason.

Any thoughts on this? As you have determined, the advantage of this approach is that the compiler ensures that identifier as

Process action method that reads the submitted field) Changing the value of string continuous updates the Auto view automatically. It can also help to identify the use of string constants.

The downside is that it creates a very ugly visual code and I would like to avoid scriptlet-style code wherever possible.

This will probably depend on code cleanliness. If string identifiers have been mixed with another constraint of other constants and thousands of lines of script are the thoughts of forests, then I will leave them alone.

Since it is portable, if I feel completely anal about code hygiene, I keep that name of the input name with that e-mail function.


Comments