Skip to main content

Posts

Struts 2 Interview question for experienced candiate

1) Explain Struts?            Struts is open source software used to develop java based web page.  Struts takes the help of Model View Controller (MVC) architecture. Where Model is referring to business or database, View is referring to the Page Design Code, and Controller is referring to navigational code. Struts uses Jakarta Packages, Java Servlets, JavaBeans, ResourceBundles, and XML. 2)What is the need of the Struts ? Helps in creation and maintenance of the application.  Make use of Model View Controller (MVC) architecture. Where Model is referring to business or database, View is referring to the Page Design Code, and Controller is referring to navigational code.  Enables developer to make use of Jakarta Packages(Struts 2.0), Java Servlets, JavaBeans, ResourceBundles, and XML. 3)What is Action class?                           An Action class in the st...

Code for Register and Login using hibernate and struts and spring

Code for  the Login Page and the validation: 1)Registration.java    package com.pojo; public class Registration { private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } private String Name; public String getName() { return Name; } public void setName(String name) { Name = name; } private String email; private String password; private String mobile; public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } 2)Registration.hbm <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-mapping PUBLIC           "-//Hibernate/Hibe...

Example for Registration using hibernate integration with struts2 and spring

First create a Pojo class for the Registeration form:     1)User.java                     package com.gklife.pojo; import com.gklife.RegisterDao.RegisterDao; public class User { private int id; private String name; private String Email; private String mobilenumber; private String password; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return Email; } public void setEmail(String email) { Email = email; } public String getMobilenumber() { return mobilenumber; } public void setMobilenumber(String mobilenumber) { this.mobilenumber = mobilenumber; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String execute(){ ...

Commonly asked top 15 Jsp Interview Question and answers

1)what is Jsp?         JSP stands for Java Server Pages. It is a presentation layer technology independent of platform. They are like HTML pages but with Java code pieces embedded in them. They are saved with a .jsp extension. It is used for viewing the page to the user. Jsp is for an dynamic pages. 2)Explain Implicit objects in JSP?         objects are created from the web container. They are              1)response              2)exception              3)application              4)request              5)config              6)out              8)page              9)pagecontex 3) Differentiate between response.sendRedirect(url) and <jsp:forwar...

Commonly asked Hibernate Interviews questions and answers

1) what is Hibernate?          Hibernate is a popular java framework which allows a efficient Object Relation Mapping using configuration files in XML format. It is Handle the database without writing any complex queries. 2) what is ORM?                 Object Relational Mapping is the concepts of Hibernate framework which it used to map object and a database and provides a various API to perform a different types of operations on the database tables.   3 )The usage of Configuration Interface in hibernate?            Configuration interface of hibernate framework is used to configure hibernate. Mapping documents of hibernate are located using this interface 4)How do we create session factory in hibernate?        Configuration config = new Configuration();          SessionFactory sessions = config.buildSessionFa...

Important question in java with answers for Experienced and freshers

1 )Why main method is static? Can we execute a program without main() method? If yes, how?           Yes u can run java without main method , but make sure that your JDK is below 1.7. and   above 1.7 it will not be supported.          *Static means it shared all the instance from the class and belong to the object type and not actual objects.  2)How Weak hashmap Works?      Weak hasmap operates like a normal hashmap but use weak reference for key. suppose if the key object doesn't device any reference then both key/value mapping will become appropriate for a garbage value. 3) how a.hascode() used for? how it is related to a.equals(b)?                       hashcode() methods returns an int hash value corresponding to an object. It is used in hash based based collection classes. eg Hashtable, Hashmap.     ...

Commonly asked programming question

Commonly asked program in the Interview 1)Write a program to sort a array?     package sort; import java.util.Scanner; public class Sortarray  {   public static void main(String args[])   {   int n, temp;   Scanner s = new Scanner(System.in);     System.out.println("Enter no of the elements:");   n =s.nextInt();                                                      //getting input from the user    int a[] = new int[n];   System.out.println("Enter all the elements:");     for(int i=0; i<n;i++)   {    a[i]=s.nextInt();   }     for(int i=0;i<n;i++)   {   for(int j=i+1; j<n; j++)                          ...