If you use Swing or AWT within a Java program, then these objects are
displayed on the machine that's running the Java program (if you choose to
display them...). You *can* access Swing and AWT from a servlet or JSP, but
if you use Swing or AWT to show a window (for example), then that window
would appear on the SERVER !!! Not the client...
As other people have suggested, if what you're trying to do is use Java GUI
components in the web browser, you have to make your servlet or JSP page
create and send the necessary HTML to create an Applet.
However, there are two main uses that I can think of for using AWT/Swing
with a servlet or a JSP:
1./
Use some AWT objects to access a Graphics (or Graphics2D) context to
dynamically generate graphics to send to the client. This would not be
within the servlet/jsp that generates HTML, but in a separate servlet/jsp.
For example, your main JSP/servlet could write some HTML like :
<img src="saleschart.jsp?x=100&y=100&month=8" />
(instead of src="saleschart.gif" ...)
Then saleschart.jsp would receive a request, draw an image based on request
parameters, set the correct HTTP content-type header (such as "image/png"),
and send that back to the client. Dynamic graphics!
2./
Display a window on the server for your application, allowing you to modify
the site's configuration in realtime. For example, imagine your web
application has a static class containing, say, database connection
parameters, or paths to some XSLT templates... by providing a server-side
window, the administrator could access the running application via a GUI
instead of a web interface. Think about it, it's VERY useful... ;-)
-Chris Brown
----- Original Message -----
From: "Martin Cooper" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 02, 2001 9:37 AM
Subject: Re: simple question
> I'm confused too. JSP is a server-side technology. AWT and Swing are
> client-side technologies. What is it, exactly, that you want to do?
>
> If you want to use JSP to create web pages that invoke/include applets
that
> use AWT or Swing, then yes, you can do that. If you want something using
AWT
> or Swing to run on the server side, then I guess you've lost me.
>
> --
> Martin Cooper
> Tumbleweed Communications
>
>
> ----- Original Message -----
> From: "Daniel Lynn" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, March 01, 2001 2:47 PM
> Subject: simple question
>
>
> > OK, I'm looking into what JSP can do and I'm a bit confused... I always
> > here that JSP can use all of he Java libraries, but can it do all of the
> > AWT and Swing stuff? and how exactly does that work inside a browser....
> > also, if anyone has any suggestions on books or sites about this, it'd
> > be much appreciated
> >
> > -Danny
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > 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".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> 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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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