Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Puffin Rock Characters Plush Toy Set
anil1961
Updated:
Saturday at 3:51 PM
Toyota Vitz scp10 For Sale
Lakmal Bandara
Updated:
Nov 4, 2026
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Nov 2, 2026
Windows RDP Only Rs.500 a month
Blogerwiki
Updated:
Nov 1, 2026
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Java Relay Servlet Help
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="heenputha" data-source="post: 9822263" data-attributes="member: 313147"><p>Here is the simple login form..</p><p></p><p>This code goes with index.jsp. YOur jsp page</p><p></p><p><html></p><p> <head></p><p> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></p><p> <title>JSP Page</title></p><p> </head></p><p> <body></p><p> <h2>Hello World!</h2></p><p> <form action="Login"></p><p> <input type="text" name="name"/></p><p> <input type="password" name="pass"/></p><p> <input type="submit" value="Login"/></p><p> </p><p> </form></p><p></body></p><p></html></p><p></p><p></p><p>This is the login.java class. Your loging servlet</p><p></p><p>package src;</p><p></p><p>import java.io.*;</p><p>import java.sql.Connection;</p><p>import java.sql.ResultSet;</p><p>import java.sql.Statement;</p><p>import java.util.logging.Level;</p><p>import java.util.logging.Logger;</p><p>import javax.servlet.*;</p><p>import javax.servlet.http.*;</p><p>public class Login extends HttpServlet {</p><p> protected void processRequest(HttpServletRequest request, HttpServletResponse response)</p><p> throws ServletException, IOException {</p><p> response.setContentType("text/html;charset=UTF-8");</p><p> PrintWriter out = response.getWriter();</p><p> String s=request.getParameter("name");</p><p> String s1=request.getParameter("pass");</p><p> </p><p> try {</p><p></p><p> Connection conn = Md.DB.connect();</p><p> Statement stmt=conn.createStatement();</p><p> ResultSet rs=stmt.executeQuery("select * from log where User='"+s+"' and pass='"+s1+"'");</p><p> if(rs.next()){</p><p> out.print("Hello");</p><p> }else{</p><p> out.print("Error");</p><p> }</p><p> </p><p> </p><p> } catch (Exception ex) {</p><p> </p><p> }</p><p> </p><p> </p><p> </p><p> } </p><p></p><p> </p><p>}</p><p></p><p></p><p>You must create your data base connectivity in a separate class and make an object of it to call it in the loging servlet. Hope you have an idea about simple JDBC. If u need more info pls PM me. I'll send you the code for sessioning.</p></blockquote><p></p>
[QUOTE="heenputha, post: 9822263, member: 313147"] Here is the simple login form.. This code goes with index.jsp. YOur jsp page <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h2>Hello World!</h2> <form action="Login"> <input type="text" name="name"/> <input type="password" name="pass"/> <input type="submit" value="Login"/> </form> </body> </html> This is the login.java class. Your loging servlet package src; import java.io.*; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.*; import javax.servlet.http.*; public class Login extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String s=request.getParameter("name"); String s1=request.getParameter("pass"); try { Connection conn = Md.DB.connect(); Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery("select * from log where User='"+s+"' and pass='"+s1+"'"); if(rs.next()){ out.print("Hello"); }else{ out.print("Error"); } } catch (Exception ex) { } } } You must create your data base connectivity in a separate class and make an object of it to call it in the loging servlet. Hope you have an idea about simple JDBC. If u need more info pls PM me. I'll send you the code for sessioning. [/QUOTE]
Insert quotes…
Verification
Dahaya deken beduwama keeyada?
Post reply
Top
Bottom