Hi frnds iam new to Java Kindy any one can provide or me
Servlets Example code and can explain to me flow of servlets
and as Jsp and Struts and provide to me some sample example
on these 3 topic flow,code example,and tutorials,and related
websites which i can refer....thanks in advance..........

Answers were Sorted based on User's Feedback



Hi frnds iam new to Java Kindy any one can provide or me Servlets Example code and can explain to ..

Answer / tej kumar

Hai Friend...
As you are new to Java World.
For tutorials on Java, go through roseindia.net.
Good Luck..Bye

Is This Answer Correct ?    7 Yes 1 No

Hi frnds iam new to Java Kindy any one can provide or me Servlets Example code and can explain to ..

Answer / sarang

hi friend,this is sarang
following is the code for sevlet,i used net beans editor....

package javas;

import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class emp extends HttpServlet
{
public void init(ServletConfig config)throws
ServletException
{
super.config();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
}
catch(Exception e)
{
throw Exception(e.gerMessage())
}
}
public void doGet(HttpServletRequst
req,HttpServletResponse res)
throws IOException,ServletException
{
String pass=req.getParameter("password");
res.setContentType("text/html");
PrintWriter out=res.getWriter();

out.println("<html>");
out.println("<head>");
out.println("</head>");
out.println("<body>");
Connection con=null;
try
{
con=DriverManager.getConnection();
}
catch(SQL Exception e)
{
throw Exception("SQL Exception"+e.getMessage());
}
Statement stmt=null;
ResultSet rs=null;

try{
stmt=con.CreateStatement();
rs=stmt.executeQuery("select password,uname from t1
where pass=admin");

if(pass=="admin");
pw.println("welcome");
else
pw.println("try again!!!");


pw.println("</body>");
pw.println("</html>");
}
catch(Exception e)
{
out.println("Exception is"+e.gerMessage());
}
out.close();
}

Is This Answer Correct ?    2 Yes 0 No

Hi frnds iam new to Java Kindy any one can provide or me Servlets Example code and can explain to ..

Answer / praveen

hi please follow roseindia.net and if possible follow all lectures in youtube there are many IITKGP and many...all the best

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Servlets Interview Questions

Explain the role of dispatcherservlet and contextloaderlistener.

0 Answers  


What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext?

2 Answers  


waht is the main diference b/w servelts and JSP ?

8 Answers   CAP, HCL,


What is the disadvantage of cookies?

0 Answers  


How many ways to remove the session object in the container

6 Answers   Bosch,


What are different Authentication options available in Servlets.

0 Answers  


how can we execute servelt? what the use ".war" or ".jar" file creation

3 Answers   CTS,


What is the effective way to make sure all the servlets are accessible only when user has a valid session?

0 Answers  


What is the difference between Servlets and Applets?

0 Answers  


I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?

0 Answers   IBM,


hi.... i have problem in running of servlet. i am using Tomcat server in my pc.. The problem is when i am click on strat it will display like below FAIL - Application at context path /first could not be started.. How i can slove the problem.. help plz

3 Answers  


What are the key methods that are involved in processing of http servlets?

0 Answers  


Categories