I work with templates (only the controls - table, combo, radios, etc
- with no data) and use a helper class named "FormatHtml" to build (put the
data into the template) the HTML.
If I have to load a table into a comboBox named "myCombo" I use the
following code.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++
protected FormatHtml formatHtml ;
public void init(ServletConfig config) throws ServletException {
super.init(config);
formatHtml = new FormatHtml(config.getServletContext());
}
doGetTcu(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException;
// initialize the variables
StringBuffer html ;
String[][] array ;
MyControler myControler = new MyControler() ; // controler
class (MVC model)
// read the template
html = formatHtml.readFileBuffer("MyTemplate.htm");
// create a array Sring[][2] with the table context : [][0]
= cod ; [0][1]=descr
array = myControler.getTableContent() ; // return an
String[][] with the table
// put the array into the combo
formatHtml.loadComboArray(html,"myCombo",array) ;
// response -> html.toString()
....
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++
I dont use JSP, because it looks like ASP ... u have to mix HTML and
Java. No good for me.
The FormatHtml class has a lot of others methods that help to build
the final HTML:
updateTableArray -> load an array String[][] into a table
removeObject -> remove an object (table, combo, div, ..)
from the template
comboSelect -> make an item of the combo the selected one
...
...
bye
jk
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html