Hi, Luciano and Michael
thanks for your reply. Actually I want to get a text reply from a URL.
Finally I found I can directly put the query text in the URL and open an
connection with URL url = new URL(http://url/querytext), then use
bufferedreader to read it in.
But now I have a new problem. I used JSDK2.0 before. Today I installed
JSWDK1.0.1 which includes JSDK2.1 and JSP1.0. But when I start server, I got
following err:
stella@lewis:~/java/JSWDK/jswdk-1.0.1 > startserver
Using classpath:
./webserver.jar:./lib/jakarta.jar:./lib/servlet.jar:./lib/jsp.jar:./lib/jspengine.jar:./examples/WEB-INF/jsp/beans:./webpages/WEB-INF/jsp/beans:./webpages/WEB-INF/servlets:./lib/xml.jar:/lib/tools.jar
stella@lewis:~/java/JSWDK/jswdk-1.0.1 > JSWDK WebServer Version 1.0.1
Loaded configuration from:
file:/home/stella/java/JSWDK/jswdk-1.0.1/webserver.xml
Can not start endpoint on localhost/127.0.0.1:8080 due to exception
java.net.BindException: Address already in use
do u have any idear about this?
cheers
Stella
>From: Luciano da Silva Coelho <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: [servlet] talk to a URL!!
>Date: Fri, 14 Jan 2000 08:31:43 -0200
>
>When you connect to this address. you receive um http command (302) to
>redirect to www.yahoo.com. I don't know what does the URL implementantion
>do
>in this case but, I think that the problem is in this feature. Try to
>connect to www.yahoo.com.
>
>Let me know the results. OK!
>
>[]'s
>Luciano da Silva Coelho
>Sun Certified Programmer for the JAVA2
>e-Sec Data Security Technology
>[EMAIL PROTECTED]
>
> > ----------
> > De: Yang XIAO[SMTP:[EMAIL PROTECTED]]
> > Responder: A mailing list for discussion about Sun Microsystem's Java
> > Servlet API Technology.
> > Enviada: Quinta-feira, 13 de Janeiro de 2000 08:28
> > Para: [EMAIL PROTECTED]
> > Assunto: [servlet] talk to a URL!!
> >
> > Hi, there
> >
> > I wrote a servlet to talk to a URL, but I just got null from the URL.
> > Appreciate it if anyone can tell me why?
> >
> >
> > thanks!!
> > Stella
> > public class GetData extends HttpServlet {
> > URLConnection connection;
> >
> > public void init() throws ServletException{
> > try {
> > URL url = new URL("http://yahoo.com");
> > connection = url.openConnection();
> > connection.setDoOutput(true);
> > }catch(MalformedURLException me)
> > {System.out.println("Could not find URL "+ me);}
> > catch(IOException ie) {}
> > }
> >
> > public void doGet (HttpServletRequest request,
> > HttpServletResponse response)
> > throws ServletException, IOException
> > {
> > // set content type and other response header fields first
> > response.setContentType("text/html");
> > PrintWriter out = response.getWriter();
> >
> > String pegReturn = request.getQueryString();
> >
> > // then write the response
> > out.println("<html>" +
> > "<head><title>Get Data Servlet</title></head>" +
> > "<body bgcolor=\"#FFFFFF\">" +
> > "<center>" +
> > "<hr> <br> " +
> > "<h1>" +
> > "<font size=\"+3\" color=\"red\">Get Data </font>" +
> > "<font size=\"+3\" color=\"purple\">Servlet</font>" +
> > "</h1>" +
> > "</center>");
> >
> > //Print out the information obtained
> > out.println("<center>" +
> > "<hr> <br> " +
> > "<h2>pegreturn: " + pegReturn + "</h2>" +
> > "</center>");
> > out.println("</body></html>");
> > out.close();
> > }
> > ...
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ______________________________________________________
> > Get Your Private, Free Email at http://www.hotmail.com
> >
> >
>__________________________________________________________________________
> > _
> > 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
> >
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
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