I think doing a "print qq!" in Java will not be that easy. Where exactly
does the output go? In your Perl example, the output went to STDOUT. In
Servlets you are not writing to STDOUT, you are writing to some stream
object. If you put some text to be printed, how does it know which stream
to go to?
At 10:33 AM 8/9/99 -0400, Zhou, Bin, BGM wrote:
>What you are going to do should be included in Java Server Pages which
>allows you to put HTML directly.
>
>Bin
>
>-----Original Message-----
>From: John McDonald [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, August 08, 1999 7:38 PM
>To: [EMAIL PROTECTED]
>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.
>
>
>John D. McDonald
>Phone: 415-703-8800 x 342
>Fax: 415-703-8801
>email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>web: www.InfoSolv.net <http://www.InfoSolv.net>
>InfoSolv, Inc.
>Web Security Consulting
>Integration and Training
>
>___________________________________________________________________________
>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
>
>
___________________________________________________________________________
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