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

Posted by Derek Clarkson on Stack Overflow See other posts from Stack Overflow or by Derek Clarkson
Published on 2010-05-17T08:00:23Z Indexed on 2010/05/17 8:30 UTC
Read the original article Hit count: 226

Filed under:
|
|

Hi all,

I've just be asked to work on a large portal project and have been looking through the established code. I keep finding this in the jsps:

<input class="portlet-form-button"
    name="<%=ModifyUserProfile.FORM_FIRST_TIME_LOGIN_SUBMIT%>" type="submit" ...

The authors are using static strings defined in classes to define the names of input fields and buttons in jsp forms.

I've never seen this done before and was wondering if this is common practice. I'm inclined to think not, but I'm asking because, apart from centralising names which I would have thought are not likely to change, I can't see the reason why.

Any thoughts on this?

© Stack Overflow or respective owner

Related posts about jsp

Related posts about portal