----- Original Message -----
Sent: Monday, August 09, 1999 1:37 AM
Subject: out.println(".....");? Theres a better way!

Why is it that no one has come up with a way to integrate HTML and Java efficiently? I know there is framework API's out there, such as Webmacro, but I've used web macro, and it, in itself, is quite complex.

I know CGI's are probably forbidden on this list, but, if your familiar with CGI's, then you are surly familiar with the "print qq|" command. If you’re not familiar with this command, than I'll explain briefly. A good way to explain is by example.

--------Perl CGI script-----------

Some script code here

# now I want to print some HTML to a web page(dynamic web pages).

print qq|

<HTML>

<head>

<Body>

<table width="100%" cellspacing="0" cellpadding="0" border="1">

|;

for (0 .. $numhits - 1) {

#print "<p>";

&html_record (&array_to_hash($_, @hits));

}

print qq||

</table>

</body>

</HTML>

|;

---------------END Perl CGI------------------------

Notice that we can write HTML directly into the script without having to perform a "out.println( ) for EVERY LINE. Basically everything between the "print qq|" and "|;" is considered to be one printer writer. This makes it VERY simple to write large amounts of HTML into your software.

I believe that it is for this reason that servlets have not gone widely main stream yet. So why hasn't someone come up with a "print qq|" for Java. Is it really that difficult to do? Are there some underlying factors that I do not understand?

If someone know why it CAN'T be done, please let me know. Other wise, I am going to begin work on it this week.

Who wants to buy a Java "print qq|" class for $5? I’m will to bet thousands of people are.

 
 
Why not use JSP's John?
 
You embed your HTML directly into them so you don't even need to use this print qq|| whatsit
 
Your HTML is separated from your Java code by <% %> tags for the most part and there are some
very good HTML Editors like Homesite 4 from Allaire which support JSP too.
 
Added the code separation is the ability to use Java Bean instances within a JSP which means all the clever stuff
can be hidden away from the HTML designer and your friendly neighbourhood web site hacker too.
 
Not only that but JSP's are transformed into servlets so your other servlets can talk to them as well
 
HttpServlets are a means to an end. If you want to produce things that are more presentation oriented rather than
service oriented then use a JSP. Vice versa use a servlet directly.
 
I use both JSP and Servlet technology seamlessly (because they are in fact one and the same thing in the end)
with no problems at all.
 
Main stream acceptance will come when more and more web servers support Servlet and JSP technology
sufficiently. As for it not being so there are more and more web services using the technology, especially
JSP. Apache JSERV is one of the reasons why. The most common web server on the internet now supports
the most flexible web server technology.
 
Yeah, I could write you a print qq|| jobby and I would charge you for it as well but there is no need.
 
Andy Bailey

Reply via email to