Much appreciated to everyone.

Devon



-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Jim Preston
Sent: Thursday, June 29, 2000 2:19 PM
To: [EMAIL PROTECTED]
Subject: Re: Documentation


The basic problem here is that you're trying to run before you've learned
how to walk (no offense intended, it's just an analogy). The other, related,
problem is that you're trying to understand the concept of JSPs in terms of
a vaguely similar but different concept that you're familiar with, i.e.
ASPs. It sounds like (I don't know ASP, so I'm guessing based on what you
say below) the workings are rather different. For example, a JSP is not a
wrapper around anything; a JSP gets compiled into a servlet. Now this might
be somewhat similar in concept to a wrapper, but if you insist on thinking
of a JSP as a wrapper, you're not really understanding JSPs in their own
right.

Getting back to the basic problem: You absolutely need to fully understand
Java servlets before you can effectively work with JSPs. You yourself said
you're struggling with the larger concepts; servlets are part of that larger
concept. To understand servlets, get the book "Java Servlet Programming" by
Jason Hunter. Read that, write some servlets, understand how it all works.

Only after you understand servlets, get a JSP book. I'm using "JavaServer
Pages" by Larne Pekowsky. There are also at least two other good
introductory books that have been mentioned on this list many times; check
the link to the JSP FAQ that's at the bottom of every message on this list.

>I do have one book on programming servlets, "Java Servlets" by Karl Moss.
>However, I have noticed it makes no mention of response, request, etc.  If
I
>am really writing native Java that is fine but from what I have seen on
this
>list there is a response object that to my knowledge (which is pretty
>limited at this point) is not part of Core Java.

I'm not familiar with that book, but if it's a servlet book, it has to talk
about the response and the request; those are at the core of how servlets
work. The doGet, DoPost, and service methods all take a request and a
response object as parameters. You can't really do anything with a servlet
without making at least some use of those two objects. The classes that
define those objects (HttpServletRequest and HttpServletResponse) are part
of the servlet API which is now a part of the J2EE SDK. In order to use
servlets, you need a web server that has implemented the proper support for
the servlet API. So in that sense, yes it's not a part of "Core Java".

>> I have seen how to write to the page using .output but I am wondering if
>> there is also something akin to ASP's response.write(), etc, etc.
>
>don't you just need out.println("...");

Yes, but if you actually use out.println in  your JSP, you're not really
making use of what makes a JSP a JSP; you might as well just write it as a
servlet. I don't want to get into a JSP lesson here, but as a quick example
consider this snippet from a JSP:

<%
if (task.equals("new")) {
%>
        <FONT face="Arial,Helvetica" size=5 color=green>
        New client "<jsp:getProperty name='clientInfo' property='name'/>"
successfully created.
        </FONT>
<%
} else {
%>
        <FONT face="Arial,Helvetica" size=5 color=green>
        Client "<jsp:getProperty name='clientInfo' property='name'/>"
successfully
updated.
        </FONT>
<%
}
%>

Some people might be tempted to instead write it like the following in order
to the "extra" open and close scriptlet tags:

<%
if (task.equals("new")) {
        out.println("<FONT face=\"Arial,Helvetica\" size=5 color=green>");
        out.println("New client \"<jsp:getProperty name='clientInfo'
property='name'/>\" successfully created.");
        out.println("</FONT>");
} else {
        out.println("<FONT face=\"Arial,Helvetica\" size=5 color=green>");
        out.println("Client \"<jsp:getProperty name='clientInfo'
property='name'/>\" successfully updated.");
        out.println("</FONT>");
}
%>

But if you do that, you've eliminated one of the major reasons for using a
JSP in the first place, namely the option to have an HTML designer able to
change the underlying HTML without having to know anything about the Java,
and to allow WYSIWYG editing of the HTML part of a JSP.

--Jim Preston


-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Devon Manelski
Sent: Thursday, June 29, 2000 8:19 AM
To: [EMAIL PROTECTED]
Subject: Re: Documentation


I think maybe I gave a bad example.  I am still struggling with the larger
concepts.   I am trying to understand if JSP is a wrapper for Java or simply
an additional set of classes that has "webified" functionality.  From an
earlier message, it sounds as if importing the servlets library is really
all I need to do to have a JSP page.  In the case of ASP, ASP is really a
wrapper around objects implemented in the ISAPI library.  However, I don't
need to understand ISAPI's implementation to code ASP.  Is this true of JSP
or is knowing Java (which I hope to do anyway) really necessary to writing
JSP?

On a more specific level, what interface is providing the
response.redirect() methods and where can I find doc's for methods like
this?

Thanks for everyones responses.
Devon Manelski
MCP



-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Matthews,Paul
Sent: Thursday, June 29, 2000 10:56 AM
To: [EMAIL PROTECTED]
Subject: Re: Documentation


> I have seen how to write to the page using .output but I am
> wondering if
> there is also something akin to ASP's response.write(), etc, etc.

don't you just need out.println("...");

paul

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
  • ... B.V.Murali Krishna (by way of G Sreenivasulu Naidu <[EMAIL PROTECTED]>)
    • ... Matthews,Paul
      • ... Devon Manelski
        • ... Jim Preston
          • ... Devon Manelski
    • ... Thomas Preston

Reply via email to