Sunday, December 12, 2010

Apllets HelloWorld Program.............

import java.applet.Applet;
import java.awt.*;
public class applet extends Applet{
public void paint(Graphics g){
g.drawString("Hello My Java Program",60,100);
}
}

connect to the database by using this code-oracle10g(XE)

import java.sql.*;
class ConnectionDB{
public static void main(String args[])throws Exception{
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver Loaded");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","suman");
System.out.println("Connected");
con.close();
}
}

EmployeeServlet Program.................

package com.nareshit.servlets;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
public class EmployeeServlet extends HttpServlet{
Connection con;
PreparedStatement ps;
public void init(ServletConfig config) throws ServletException{
String driver=config.getInitParameter("driver");
String cs=config.getIntitParameter("url");
String usr=config.getInitParameter("user");
String pwd=config.getInitParameter("pwd");
 try
  {
  Class.forName(driver);
  con=DriverManager.getConnection(cs,usr,pwd);
  ps=con.PrepareStatement("Insert into employee values(?,?,?)");
  }
 catch(ClassNotFoundException e){
 e.printStackTrace();
 }
 catch(SQLException e)
 {
 e.PrintStackTrace();
 }
}//init()
public void destroy(){
try
  {
   if(ps!=null)
     ps.close();
   if(con!=null)
     con.close();
  }
catch(SQLException e)
  {
  e.PrintStackTrace();
  }
  }
public void doPost(HttpServletRequest request,HttpServletResponse response)
 throws ServletException ,IOException
 {
 String a=request.getParameter("empno");
 String b=request.getParameter("name");
 String c=request.getParameter("salary");
 int eno=Integer.parseInt(a);
 float salary=Float.parseFloat(c);
 try
 {
 ps.setInt(1,eno);
 ps.setString(2,name);
 ps.setFloat(3,salary);
 ps.executeUpdate();
 }
 catch(SQLException e)
 {
  e.PrintStackTrace();
 }
 response.sendRedirect("emp.html");
 }//doPost()
}//EmployyeeServlet class

Friday, December 3, 2010

Interiew on Capgemini November-2010

1.Diff. b/w Abstract and Interface?
2.what is the diff. b/w Jsp:forward tag and rd.forward(".jsp")?
3.what is the diff. b/w and <%@JspInclude%> ?
4.how can we handle the Exceptions in Jsp?
5.what are the weblogic[7001], tomcat[8080]
6.websphere[9080]  port no?
7.what is the Latest version of java?
8.what is Wrapper classes?
9.final,finally and finalized?
10.about on ArrayList?
11.Diff. b/w Hashtable and Hashmap?
12.Servlet Lifecycle?
13.tell me about on Custom tag files?
14.what are the Struts Action classes?
15.how to use the Cuistom tags in the Struts?
16.we don't know the which type of collection object will come at Runtime. then it will be take a method to one element and compare and sort that element how can we proceed?
Ans: ArrayList,Vectors,LinkedList,Set?

weblogic:
1.how the cluster will be done?
2.how the session Pool settings are done in weblogic?
3.how Replication done in  weblogic server?
4.how will you write replication code for weblogic in j2ee?
5.how it user enter 3 fields. if server goes down then what happend?
6.if 1000 users access the same page at a time in that case what will happend?
7.write struts validation through programmatic and xml validation?

CVS:
1.if one user modified content and another user also modified. first user modified if the second user save it what happend?
2.First change and submit and second user change what happend? First change and submit and second user not chagged then what happend. what file he get?
3.First will save, Second not saved and not chan ged. if the third user will access what happend?
4.one to many mapping hbm files? Eg: Employee  ------> projects
100
5.Jbuilder version?
6.In Eclipse how to PlugIn CVS or SVN?
Name:------
     ------
Attachments
-----------
-----------
   submit
here Btmp files are not allowed and Zip files are allowed? then how to get it errors will be raised?  

Interiew on IBM Technologies octobet-2010

1.what is the Diff. b/w Servlets and Jsp?
2.what are the implicit objects in jsp?
3.what is the diff. b/w Forward and Include?
4.what is the diff.b/w JspDirective[<%@JspInclude%>] tag and Jsp:include[] tag?
5.Diff. b/w Hashtable and Hashmap?
6.How many types of Ejb?
7.Which is the best performance of interface and abstract?
8.what is the JspLifecycle?

Wipro Interriew Question October-2010

1.overloading and overriding example?
2.Diff. b/w Hashtable and Hashmap?
3.Diff. b/w Vector and ArrayList?
4.Why we will give preference to ArrayList?
5.where we used in vector?
6.What is Thin? Diff. b/w Thin and Thick?
7.How the JspSession Management will done program?
8.How the JDBCConnection will be Produced Program?
9.If it possibe multiple constructors in the same class means different parameters.
10.How can we call with in the same class? Ans: this

11.How the Jsp Form Fields will be submitted.
12.if any error will occur the data fields will be lost
or any where stored? Ans: Bean Or Session
13.Where the field validation will be done?
Ans: Form Bean
14.what is DesignPattern? what are the types of design
patterns?
15.what is the SingleTon DesignPattern?