Donny Wilfri Gultom Weblog

Pengharapan & Doa

Wisuda PI Del 2008 dan Dies Natalis PI Del yang ke-7; 66 lulusan PI Del siap memasuki pasar kerja

Posted by wilfri on September 12, 2008

Posted in PIDEL | Leave a Comment »

Life cycle of Servlet

Posted by wilfri on September 12, 2008

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class CounterPersist extends HttpServlet{
String fileName = “conter.txt”;
int count;
public void init(){
try{
FileReader fileReader = new FileReader (fileName);
BufferedReader bufferedReader = new BufferedReader(fileReader);
String initial = bufferedReader.readLine();
count = Integer.parseInt(initial);
}catch (FileNotFoundException e){count=0;}
catch (IOException e){ count =0;}
catch (NumberFormatException e){ count =0;}
}

public void doGet(HttpServletRequest requet, HttpServletResponse response)
throws IOException, ServletException{
response.setContentType(“text/plain”);
PrintWriter out = response.getWriter();
count++;
out.println(“Since loading, this is servlet has “+”been accessed”+count+”times.”);
out.close();
}

public void destroy(){
try{
FileWriter fileWriter = new FileWriter(fileName);
String countStr = Integer.toString(count);
fileWriter.write(countStr);
fileWriter.close();
}catch(IOException e){
e.printStackTrace();
}
}
};

best regards..

if06013@students.del.ac.id

Posted in JAVA | Leave a Comment »

1. Starting J2EE..

Posted by wilfri on September 12, 2008

For this section we will learn abot J2EE..

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.PrintWriter;
import java.io.IOException;

public class HelloWorld extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
PrintWriter out = response.getWriter();
out.println(“Hello World from servlet..!!”);
out.close();
}
}

if you have any question you can contact me if06013@students.del.ac.id

best regard,

Donny Wilfri Gultom

Posted in JAVA | Tagged: | 1 Comment »

Hello world!

Posted by wilfri on September 7, 2008

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Posted in Uncategorized | Leave a Comment »