I certainly understand and agree with placing all the presentation specifics in a JSP, leaving the fill in the blank info as the responsibility of the Servlet/backend. Suppose you have the situation where the result of an end user's actions is a variable length (in terms of number of rows) HTML table. How can the JSP/Servlet be designed so that the Servlet (or elsewhere in the non-presentation logic) doesn't generate HTML? Seems like in this case the Servlet needs to render the table row, table data, and end table row constructs for each row.
Paul Wetzel
Ranch Hand
Joined: Nov 02, 1999
Posts: 107
posted
0
The jsp can make a call to some class/object that may return a variable length list (lets just say a vector). the jsp code might look like this
so now nobody really needs to know how long the vector is (unless of course the vector is null but lets assume it will always return at size>=1). This is a pretty simple example but the process and reasoning are still valid for more complex examples where what is displayed is a result set from SQL. hope this helps paul
Doug Gschwind
Greenhorn
Joined: Sep 17, 2000
Posts: 27
posted
0
Yes, that does help, and makes good sense. I was wondering if that approach was possible. Thanks for the help.
You could also use the java code in your jsp to test (if lenth > 0 or !null) for the presence of data and the enclose the HTML display portion pertinent to the data in curly braces. This way the code in the table tags only gets seen by the browser when the test is true.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.