±Û¾´ÀÌ :±èÅÂÈÆ 1998³â 5¿ù 29ÀÏ 11:11:50
In Reply to: ´ÙÀ½ ¸µÅ© ÂüÁ¶ posted by À±°æ±¸ on 1998³â 5¿ù 20ÀÏ 09:10:49:
°æ±¸ ¾ÆÀú¾¾ °¨»çÇÕ´Ï´Ù.
°á±¹ urlÀ» ÀÌ¿ëÇÏ¿© ¾ÖÇø´°ú ¼ºí¸´ Åë½Å¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.
Àúµµ ´Ù¸¥ »ç¶÷µéÀ» À§ÇØ º°°Å ¾Æ´ÏÁö¸¸ ¼Ò½º¸¦ °ø°³ÇÏ°Ú½À´Ï´Ù.
// Ŭ¶óÀ̾ðÆ® ºÎºÐ
// ¹öÆ°À» ´©¸£¸é À̺κÐÀÌ ½ÇÇàµÇ¾î¼ ¼¹ö·Î ¹ÞÀº stringÀ» µ¹·ÁÁÝ´Ï´Ù.
public String getTimeTable()
{
String startStation="start";
String endStation="end";
URL serverURL;
URLConnection connect;
String temp=null;
String urlString = "http://203.238.4.183:8080/servlet/timeServlet.class";
String queryString="?startStation="+startStation+"&endStation="+endStation;
try{
connect = (new URL(urlString+queryString)).openConnection();
connect.connect();
DataInputStream in = new DataInputStream(connect.getInputStream());
temp = in.readLine();
}catch(MalformedURLException e1){
System.out.println("MalformedURLException");
}catch (IOException e2){
System.out.println("IOException");
}
return temp;
}
// ¼ºí¸´ºÎºÐ
import javax.servlet.http.*;
import java.io.*;
import javax.servlet.*;
import java.lang.*;
import java.net.*;
public class timeServlet extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
String start,end;
start=req.getParameter("startStation");
end=req.getParameter("endStation");
System.out.println(start);
System.out.println(end);
res.setContentType("text/plain");
PrintWriter ops= res.getWriter();
String rr= new String("Thanks a lot");
//String ra=new String();
//ra=URLEncoder.encode(rr);
ops.println(rr);
}//service()
}//class
´Ù¸¥ »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÁÁ°Ú´Âµ¥....
¾È³çÈ÷ °è¼¼¿ä..