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
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 |
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 |
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 |
What is called Session Tracking?
What is the use of servletconfig interface?
Where do you define dispatcherservlet?
What is URL Rewriting ?
When to use doget() and when dopost()?
What is Single Threaded Model in Servlets? Explain this with an example?
Whether thread can be used in servlets?
request parameter how to find whether a parameter exists in the request object?
Explain request dispatcher and its methods.
How do u authorize and authenticate without <auth> of web.xml
What is httpservlet and how it is different from genericservlet?
How can you push data from an Applet to a Servlet?