Posts

Showing posts from December, 2013

How to use Url-rewriting using Java in NetBeansIDE

Image
URL Rewriting format - (  url?paramName=paramValue   )   1. In your web project make web page (say index.jsp) having a link as:    <a href="FetchDataServlet">Fetch Data from DB...</a> 2. Make a Servlet (say 'FetchDataServlet') and write code to fetch all the record on web         page.         try {                        Class.forName("com.mysql.jdbc.Driver");             Connection con = DriverManager.getConnection("jdbc:mysql://localhost/testdb", "root", "root");             PreparedStatement ps = con.prepareStatement("select * from test2");             ResultSet rs = ps.executeQuery();             out.print("<table border='1'>");             out.print("<tr><th>Serial No.</th><th>name</th><th>Delete</th></tr>");             while(rs.next()){                 out.println("<tr>");                 out.pr