Good day, citizens!
I would be very interested to know how you solve a completely classical problem about storing directories in a system that uses Spring MVC 3 + JSP as a view .
Namely:
(1, simple case): there is a certain set of lines that need to be stored, shown and somehow used. Example: the usual directory of cities.
(2, difficult case): there is a certain set of entities, each of which has fields that are used in a similar way; that is, it is not just a reference book, but also an entity that will be used in business logic. Example: a class containing external web service settings: address, passwords, attribute names, etc. There are many such services, the user chooses what to use.
How to organize the display and storage of this in the system?
I see such options:
1) ENUM
convenient to show in JSP:
<form:select path="webservice"> <c:forEach items="${enumList}" var="enum"> <form:option value="${enum.name}"><spring:message code="${enum.label}"/> </form:option> </c:forEach> </form:select> - essentially hardcoded
2) Keep everything in the table and read.
+ easy to change through the interface
- it is not clear how to show in JSP . Where can I get resource names to use as option names in selects? Unless to put in the table the names of spring-resources, but it looks strange.
3) Union: count such entities from the base and inject them into ENUM . Is it too?
Where is the perfect option?
<spring:message code="myparam.name"/>). Do not push thesemyparam.nameinto the table. Although on the other hand than this worse hardcoded parameter names. - KutaBeach