|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
CodeTableUtil | Fetches code tables from the database upon startup. |
Enum Summary | |
---|---|
CodeTable | All code tables used in this application. |
Code Tables for the application.
The general approach in this implementation is to treat the underlying
id (the primary key) of the Code
as being most important, and all
other items as secondary aliases for the id - the text, short form, and long form.
(Some would object to this style, since it makes underlying database identifiers more visible
than usually desired. In practice, however, this does not seem to be a significant issue.)
StartupTasks
will call
CodeTableUtil.init(ServletContext)
to initialize all items
related to Code Tables. This same method must also be called if any code table changes content.
CodeTable.getTableName()
as key.
Typically, two aspects of a Code are referenced in a form : one of the code's textual aliases is
made visible to the user, while its underlying id is always used as the value actually POSTed during form submission.
Here is an example which references a code table named 'dispositions' :
<select name="Disposition"> <c:forEach var="item" items="${dispositions}"> <option value="${item.id}">${item}</option> </c:forEach> </select>
<w:txtFlow> ... <select name="Disposition"> <c:forEach var="item" items="${dispositions}"> <option value="${item.id}">${item.text.rawString}</option> </c:forEach> </select> ... </w:txtFlow>This will avoid double-escaping of special characters, which is always undesirable.It is easy to forget to perform the above, especially when special characters appear infrequently. This is a pitfall of using the Code class. This pitfall appears only with multilingual apps, and when your codes includes special characters. See EscapeChars.forHTML() for the list of escaped characters.
Id
for the
code - not the full Code
object. Inside the constructor, the Id is 'expanded' into a
full Code object, using CodeTable.codeFor(Id, CodeTable)
.
This style has these consequences :
Code
are always available, if needed.
|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |