Re: Fast retrieval and display of results to web browser

From: Christophe Vanfleteren (c.v4nfl3t3r3n_at_pandora.be)
Date: 11/20/03


Date: Thu, 20 Nov 2003 15:12:02 GMT

Andre wrote:

> Thanks for your response. Yes, we do a ton of string concatenation.
> There's an uncountable number of lines of code that do something like:
> String html = "<table>";
> if(resultSet.getInt(1) == SOME_FLAG) {
> html += "<tr><td>blah blah</td></tr>";
> }
> html += "</table>";
>
> We actually do use taglibraries for SQL in some of our JSP's, but we
> haven't really found them very good for larger applications. This is
> how Sun feels about them too. I quote from the Java Web Services
> Tutorial:
>
> "The JSTL SQL tags listed in Table 17-7 are designed for quick
> prototyping and simple applications. For production applications,
> database operations are normally encapsulated in JavaBeans
> components."

Yes I know. But they also tell you not to generate your html inside the
classes itself :) That's why jsp was invented, because using plain servlets
was too tedious for html generation.

But if I were you, I'd definetly look for a better way of generating your
HTML. The way you're doing it now is very inflexible
Even just using scriplets inside a jsp where you process the resultset would
make your job a lot easier.

> Your point about String concatenation it well taken though. Thanks
> again for the response.

Replacing it with a StringBuffer should help a lot and will be the fastest
way you can improve performance.

-- 
Regards,
Christophe Vanfleteren


Relevant Pages

  • Re: =?iso-8859-1?Q?Kompatibilit=E4t?= von Konzepten von PHP zu Java
    ... Reine Servlets sind nicht so prickelnd. ... JSP sagen mir wenig zu, genau wie bei PHP ein Gemisch ... aus PHP und HTML. ...
    (de.comp.lang.java)
  • Re: JSP, Servlets & AJAX username validation, Image verification
    ... It's got scriptlet in the JSP and HTML in the Java source code. ... Most DB connection pools do not require the code to explicitly know of the pooled nature of the connections, but just have the connection call its closemethod. ...
    (comp.lang.java.programmer)
  • Re: How to open the jsp pages by click on the APPLET
    ... I want to know is there is any way to open the new window of jsp ... By this i get only html tags nothing beyond that.That is not my ... requirement.Will give syntax for getting jsp page on applet. ... only load URLs from the same server as the containing page ...
    (comp.lang.java.advocacy)
  • Re: Deck of cards
    ... Another application that you can try for free (for a limited time) is ... applications for sprucing up HTML and they are all pretty good. ... >> I have a jpg of a complete deck of cards laid out on a table, ...
    (microsoft.public.frontpage.client)
  • Re: Netbeans File Organization - Web Project
    ... I'm spending way more time in .jsp ... copies of all of my .jsp, html and css files. ... That is the deployment folder. ...
    (comp.lang.java.programmer)