12 top WebSphere interview questions and answers for freshers and experienced

Latest 12 top WebSphere interview questions and answers PDF for freshers and experienced. JSF objective questions and answers pdf download free

WebSphere Interview Questions and Answers PDF Experienced Freshers

1. How to choose websphere over other application servers?
Selecting application server is part of architechtural process when infrastructure is defined. It depends on several facots:
1. External systems your application will be interacting
2. Type of application you have
3. Target availability of system.
4. Corporate standards
5. Budget.

2. What are deployment descriptors? How many types of Deployment descriptors are available? What are they?
Deployment descriptor is an XML file that describes how to deploy a module or application by specifying configuration and container options. For example, an EJB deployment descriptor passes information to an EJB container about how to manage and control an enterprise bean. There are two types of deployment descriptor in websphere: Web application deployment descriptor and portlet deployemnt descriptor
Portlets are packaged as WAR files with a web application deployment descriptor (web.xml). This defines each portlet as a servlet within the web application, including unique identifiers for each portlet, the portlet class, and initialization parameters.

3. How many ways can you deploy applications in websphere?
1. Directly copy files to deployedapplication folder in websphere- hot deployment.
2. use websphere specific ant tasks and building automated scripts for deploying application.
3. through administration console.

4. What is the difference between web server and application server?
ApplicationServer: takes care of Security, Transaction, Multithreading, Resource pooling, load balancing, clustering, performence, highly availability, scalability, etc. Exposes business logic to client applications through various protocols, possibly including HTTP. Supports deployment of .war and .ear filesApplication server = webserver + EJB container.
Webserver: handles HTTP protocol. Receives HTTP request, it responds with an HTTP response.

5. How to import jaxp package in IBM WSAD?
1. open WSAD
2. go to project
3. click properties
4. select javaBuildPath
5. add any jar file like jaxp select add external jars.

6. How to implement JDBC-ODBC bridge driver (Type 1) in Websphere?
If you use JDBC type (I) driver you dont need to add any driver in websphere. you simply created DSN and use it locally, same we use java class, if you use Type(2) and Type(4) so first go to admin console then go to connection, then add driver there fill other info like conn. size, uname pass, max conn. and connect it to you applications.

7. Is there any difference between weblogic and websphere?
Webpshere tends to focus more on integration, connectivity and web services. it has rich implementation of J2EE, better performance, more extensive integration and transaction management. In terms of trnsaction weblogic is having default transaction attribute as ’supports’, but websphere does not have any default transaction attribute.

8. What are the different application servers and Web Servers supporting J2EE technologys?
JBoss Is an Application Server that supports J2EE
IBM Websphere and BEA WebLogic servers are a combination of Application Server, Web Server & container
Jakarta Tomcat is a Servlet container and a Web server.
Apache Sever is a Web server

9. What Development Environment(s) are available to develop applications for WebSphere?
IBM provides several industrial strength development environments based on Eclipse development framework the current IDE is Rational Developer for Websphere. Applications can also be developed with the Websphere Application Server Toolkit and third party tools like Jbuilder, and Eclipse/ANT etc.

10. What type of files are required to deploy an application into Websphere. How can they be installed?
WAR or EAR files.
Can be installed using Administration Console or scripts.

11. How would use ensure WebSphere server logs are created on a different drive than the installation root?
Change the WebSphere server's server variables using the Administrative Console or use scripts.

12. Are there any differences between Weblogic and Websphere?
Webpshere tends to focus more on integration, connectivity and web services. it has rich implementation of J2EE, better performance, more extensive integration and transaction management. In terms of trnsaction weblogic is having default transaction attribute as ’supports’, but websphere does not have any default transaction attribute.
Websphere is from IBM and Weblogic is from BEA.

40 top Struts interview questions and answers for freshers and experienced

Latest 40 top Struts multiple choice questions and answers PDF for freshers and experienced. JSF objective questions and answers pdf download free

Struts Interview Questions and Answers PDF Experienced Freshers

1. What is Struts?
The core of the Struts framework is a flexible control layer based on standard technologies like Java Servlets, JavaBeans, ResourceBundles, and XML, as well as various Jakarta Commons packages. Struts encourages application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller (MVC) design paradigm.
Struts provides its own Controller component and integrates with other technologies to provide the Model and the View. For the Model, Struts can interact with standard data access technologies, like JDBC and EJB, as well as most any third-party packages, like Hibernate, iBATIS, or Object Relational Bridge. For the View, Struts works well with JavaServer Pages, including JSTL and JSF, as well as Velocity Templates, XSLT, and other presentation systems.
The Struts framework provides the invisible underpinnings every professional web application needs to survive. Struts helps you create an extensible development environment for your application, based on published standards and proven design patterns.

2. What is MVC?
Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data.
? Model : The model contains the core of the application's functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.
? View: The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur.
? Controller:The controller reacts to the user input. It creates and sets the model.

3. What is Jakarta Struts Framework?
Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.

4. What is ActionServlet?
The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.

5. How you will make available any Message Resources Definitions file to the Struts Framework Environment?
T Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through <message-resources /> tag.
Example:
<message-resources parameter=\"MessageResources\" />.

6. What is Action Class?
The Action Class is part of the Model and is a wrapper around the business logic. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the execute() method. In the Action Class all the database/business processing are done. It is advisable to perform all the database related stuffs in the Action Class. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. The return type of the execute method is ActionForward which is used by the Struts Framework to forward the request to the file as per the value of the returned ActionForward object.

7. What is ActionForm?
An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from a form on the client side.

8. What is Struts Validator Framework?
Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class.
The Validator framework was developed by David Winterfeldt as third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.

9. Give the Details of XML files used in Validator Framework?
The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean.

10. How you will display validation fail errors on jsp page?
Following tag displays all the errors:
<html:errors/>

11. How you will enable front-end validation based on the xml in validation.xml?
The <html:javascript> tag to allow front-end validation based on the xml in validation.xml. For example the code: <html:javascript formName=\"logonForm\" dynamicJavascript=\"true\" staticJavascript=\"true\" /> generates the client side java script for the form \"logonForm\" as defined in the validation.xml file. The <html:javascript> when added in the jsp file generates the client site validation script.

12. How to get data from the velocity page in a action class?
We can get the values in the action classes by using data.getParameter(\"variable name defined in the velocity page\");

13. What is a framework?
A framework is made up of the set of classes which allow us to use a library in a best possible way for a specific requirement.

14. What is Struts framework?
Struts framework is an open-source framework for developing the web applications in Java EE, based on MVC-2 architecture. It uses and extends the Java Servlet API. Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.

15. What are the components of Struts?
Struts components can be categorize into Model, View and Controller:
? Model: Components like business logic /business processes and data are the part of model.
? View: HTML, JSP are the view components.
? Controller: Action Servlet of Struts is part of Controller components which works as front controller to handle all the requests.

16. What are the core classes of the Struts Framework?
Struts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design.
? JavaBeans components for managing application state and behavior.
? Event-driven development (via listeners as in traditional GUI development).
? Pages that represent MVC-style views; pages reference view roots via the JSF component tree.

17. What is role of ActionServlet?
ActionServlet performs the role of Controller:
? Process user requests
? Determine what the user is trying to achieve according to the request
? Pull data from the model (if necessary) to be given to the appropriate view,
? Select the proper view to respond to the user
? Delegates most of this grunt work to Action classes
? Is responsible for initialization and clean-up of resources

18. What is the ActionForm?
ActionForm is javabean which represents the form inputs containing the request parameters from the View referencing the Action bean.

19. What are the important methods of ActionForm?
The important methods of ActionForm are : validate() & reset().

20. Describe validate() and reset() methods?
validate() : Used to validate properties after they have been populated; Called before FormBean is handed to Action. Returns a collection of ActionError as ActionErrors. Following is the method signature for the validate() method.
reset(): reset() method is called by Struts Framework with each request that uses the defined ActionForm. The purpose of this method is to reset all of the ActionForm's data members prior to the new request values being set.

21. What is ActionMapping?
Action mapping contains all the deployment information for a particular Action bean. This class is to determine where the results of the Action will be sent once its processing is complete.

22. How is the Action Mapping specified?
We can specify the action mapping in the configuration file called struts-config.xml. Struts framework creates ActionMapping object from <ActionMapping> configuration element of struts-config.xml file
<action-mappings>
<action path="/submit"
type="submit.SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="request"
validate="true">
<forward name="success" path="/success.jsp"/>
<forward name="failure" path="/error.jsp"/>
</action>
</action-mappings>

23. What is role of Action Class?
An Action Class performs a role of an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request.

24. In which method of Action class the business logic is executed?
In the execute() method of Action class the business logic is executed.
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception ;
execute() method of Action class:
? Perform the processing required to deal with this request
? Update the server-side objects (Scope variables) that will be used to create the next page of the user interface
? Return an appropriate ActionForward object

25. What design patterns are used in Struts?
Struts is based on model 2 MVC (Model-View-Controller) architecture. Struts controller uses the command design pattern and the action classes use the adapter design pattern. The process() method of the RequestProcessor uses the template method design pattern. Struts also implement the following J2EE design patterns.
? Service to Worker
? Dispatcher View
? Composite View (Struts Tiles)
? Front Controller
? View Helper
? Synchronizer Token

26. Can we have more than one struts-config.xml file for a single Struts application?
Yes, we can have more than one struts-config.xml for a single Struts application. They can be configured as follows:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config.xml,
/WEB-INF/struts-admin.xml,
/WEB-INF/struts-config-forms.xml
</param-value>
</init-param>
.....
<servlet>

27. What is the difference between session scope and request scope when saving formbean?
when the scope is request,the values of formbean would be available for the current request.
when the scope is session,the values of formbean would be available throughout the session.

28. What are the different kinds of actions in Struts?
The different kinds of actions in Struts are:
? ForwardAction
? IncludeAction
? DispatchAction
? LookupDispatchAction
? SwitchAction

29. What is DispatchAction?
The DispatchAction class is used to group related actions into one class. Using this class, you can have a method for each logical action compared than a single execute method. The DispatchAction dispatches to one of the logical actions represented by the methods. It picks a method to invoke based on an incoming request parameter. The value of the incoming parameter is the name of the method that the DispatchAction will invoke.

30. How to use DispatchAction?
To use the DispatchAction, follow these steps :
? Create a class that extends DispatchAction (instead of Action)
? In a new class, add a method for every function you need to perform on the service – The method has the same signature as the execute() method of an Action class.
? Do not override execute() method – Because DispatchAction class itself provides execute() method.
? Add an entry to struts-config.xml

31. What is the use of ForwardAction?
The ForwardAction class is useful when you’re trying to integrate Struts into an existing application that uses Servlets to perform business logic functions. You can use this class to take advantage of the Struts controller and its functionality, without having to rewrite the existing Servlets. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page. By using this predefined action, you don’t have to write your own Action class. You just have to set up the struts-config file properly to use ForwardAction.

32. What is IncludeAction?
The IncludeAction class is useful when you want to integrate Struts into an application that uses Servlets. Use the IncludeAction class to include another resource in the response to the request being processed.

33. What is the difference between ForwardAction and IncludeAction?
The difference is that you need to use the IncludeAction only if the action is going to be included by another action or jsp. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page.

34. What is LookupDispatchAction?
The LookupDispatchAction is a subclass of DispatchAction. It does a reverse lookup on the resource bundle to get the key and then gets the method whose name is associated with the key into the Resource Bundle.

35. What is the use of LookupDispatchAction?
LookupDispatchAction is useful if the method name in the Action is not driven by its name in the front end, but by the Locale independent key into the resource bundle. Since the key is always the same, the LookupDispatchAction shields your application from the side effects of I18N.

36. What is difference between LookupDispatchAction and DispatchAction?
The difference between LookupDispatchAction and DispatchAction is that the actual method that gets called in LookupDispatchAction is based on a lookup of a key value instead of specifying the method name directly.

37. What is SwitchAction?
The SwitchAction class provides a means to switch from a resource in one module to another resource in a different module. SwitchAction is useful only if you have multiple modules in your Struts application. The SwitchAction class can be used as is, without extending.

38. What is DynaActionForm?
A specialized subclass of ActionForm that allows the creation of form beans with dynamic sets of properties (configured in configuration file), without requiring the developer to create a Java class for each type of form bean.

39. How to display validation errors on jsp page?
<html:errors/> tag displays all the errors. <html:errors/> iterates over ActionErrors request attribute.

40. What are the various Struts tag libraries?
The various Struts tag libraries are:
? HTML Tags
? Bean Tags
? Logic Tags
? Template Tags
? Nested Tags
? Tiles Tags 

40 top Spring Framework interview questions and answers for freshers and experienced

Read the most frequently asked 40 top Spring Framework interview questions and answers for freshers and experienced

Spring Framework Interview Questions and Answers PDF Experienced Freshers

1. What is Spring? 
Spring is an open source framework created to address the complexity of enterprise application development. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development. 

2. What are the advantages of Spring framework? 
The advantages of Spring are as follows:
? Spring has layered architecture. Use what you need and leave you don't need now.
? Spring Enables POJO Programming. There is no behind the scene magic here. POJO programming enables continuous integration and testability.
? Dependency Injection and Inversion of Control Simplifies JDBC
? Open source and no vendor lock-in. 

3. What are features of Spring? 
? Lightweight:
spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 1MB. And the processing overhead is also very negligible.
? Inversion of control (IOC):
Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects.
? Aspect oriented (AOP):
Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services.
? Container:
Spring contains and manages the life cycle and configuration of application objects.
? MVC Framework:
Spring comes with MVC web application framework, built on core Spring functionality. This framework is highly configurable via strategy interfaces, and accommodates multiple view technologies like JSP, Velocity, Tiles, iText, and POI. But other frameworks can be easily used instead of Spring MVC Framework.
? Transaction Management:
Spring framework provides a generic abstraction layer for transaction management. This allowing the developer to add the pluggable transaction managers, and making it easy to demarcate transactions without dealing with low-level issues. Spring's transaction support is not tied to J2EE environments and it can be also used in container less environments.
? JDBC Exception Handling:
The JDBC abstraction layer of the Spring offers a meaningful exception hierarchy, which simplifies the error handling 

4. How many modules are there in Spring? What are they? 
Spring comprises of seven modules. They are..
? The core container:
The core container provides the essential functionality of the Spring framework. A primary component of the core container is the BeanFactory, an implementation of the Factory pattern. The BeanFactory applies the Inversion of Control (IOC) pattern to separate an application's configuration and dependency specification from the actual application code.
? Spring context:
The Spring context is a configuration file that provides context information to the Spring framework. The Spring context includes enterprise services such as JNDI, EJB, e-mail, internalization, validation, and scheduling functionality.
? Spring AOP:
The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, through its configuration management feature. As a result you can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. With Spring AOP you can incorporate declarative transaction management into your applications without relying on EJB components. 

5. What are the types of Dependency Injection Spring supports? 
? Setter Injection:
Setter-based DI is realized by calling setter methods on your beans after invoking a no-argument constructor or no-argument static factory method to instantiate your bean.
? Constructor Injection:
Constructor-based DI is realized by invoking a constructor with a number of arguments, each representing a collaborator. 

6. What is Bean Factory? 
A BeanFactory is like a factory class that contains a collection of beans. The BeanFactory holds Bean Definitions of multiple beans within itself and then instantiates the bean whenever asked for by clients.
? BeanFactory is able to create associations between collaborating objects as they are instantiated. This removes the burden of configuration from bean itself and the beans client.
? BeanFactory also takes part in the life cycle of a bean, making calls to custom initialization and destruction methods. 

7. What is Application Context? 
A bean factory is fine to simple applications, but to take advantage of the full power of the Spring framework, you may want to move up to Springs more advanced container, the application context. On the surface, an application context is same as a bean factory.Both load bean definitions, wire beans together, and dispense beans upon request. But it also provides:
? A means for resolving text messages, including support for internationalization.
? A generic way to load file resources.
? Events to beans that are registered as listeners. 

8. What is the difference between Bean Factory and Application Context? 
On the surface, an application context is same as a bean factory. But application context offers much more..
? Application contexts provide a means for resolving text messages, including support for i18n of those messages.
? Application contexts provide a generic way to load file resources, such as images.
? Application contexts can publish events to beans that are registered as listeners.
? Certain operations on the container or beans in the container, which have to be handled in a programmatic fashion with a bean factory, can be handled declaratively in an application context.
? ResourceLoader support: Spring’s Resource interface us a flexible generic abstraction for handling low-level resources. An application context itself is a ResourceLoader, Hence provides an application with access to deployment-specific Resource instances.
? MessageSource support: The application context implements MessageSource, an interface used to obtain localized messages, with the actual implementation being pluggable 

9. How is a typical spring implementation look like? 
For a typical Spring Application we need the following files:
? An interface that defines the functions.
? An Implementation that contains properties, its setter and getter methods, functions etc.,
? Spring AOP (Aspect Oriented Programming)
? A XML file called Spring configuration file.
? Client program that uses the function. 

10. What is the typical Bean life cycle in Spring Bean Factory Container? 
Bean life cycle in Spring Bean Factory Container is as follows:
? The spring container finds the bean’s definition from the XML file and instantiates the bean.
? Using the dependency injection, spring populates all of the properties as specified in the bean definition
? If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the bean’s ID.
? If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.
? If there are any BeanPostProcessors associated with the bean, their post- ProcessBeforeInitialization() methods will be called.
? If an init-method is specified for the bean, it will be called.
? Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called. 

11. What do you mean by Bean wiring? 
The act of creating associations between application components (beans) within the Spring container is reffered to as Bean wiring. 

12. What do you mean by Auto Wiring? 
The Spring container is able to autowire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory. The autowiring functionality has five modes.
? no
? byName
? byType
? constructor
? autodirect 

13. What is DelegatingVariableResolver? 
Spring provides a custom JavaServer Faces VariableResolver implementation that extends the standard Java Server Faces managed beans mechanism which lets you use JSF and Spring together. This variable resolver is called as DelegatingVariableResolver 

14. What are the different modules in Spring framework? 
? The Core container module
? Application context module
? AOP module (Aspect Oriented Programming)
? JDBC abstraction and DAO module
? O/R mapping integration module (Object/Relational)
? Web module
? MVC framework module 

15. What is the Core container module? 
This module is provides the fundamental functionality of the spring framework. In this module BeanFactory is the heart of any spring-based application. The entire framework was built on the top of this module. This module makes the Spring container. 

16. What is Application context module? 
The Application context module makes spring a framework. This module extends the concept of BeanFactory, providing support for internationalization (I18N) messages, application lifecycle events, and validation. This module also supplies many enterprise services such JNDI access, EJB integration, remoting, and scheduling. It also provides support to other framework. 

17. What is AOP module? 
The AOP module is used for developing aspects for our Spring-enabled application. Much of the support has been provided by the AOP Alliance in order to ensure the interoperability between Spring and other AOP frameworks. This module also introduces metadata programming to Spring. Using Spring’s metadata support, we will be able to add annotations to our source code that instruct Spring on where and how to apply aspects. 

18. What is JDBC abstraction and DAO module? 
Using this module we can keep up the database code clean and simple, and prevent problems that result from a failure to close database resources. A new layer of meaningful exceptions on top of the error messages given by several database servers is bought in this module. In addition, this module uses Spring’s AOP module to provide transaction management services for objects in a Spring application. 

19. What are object/relational mapping integration module? 
Spring also supports for using of an object/relational mapping (ORM) tool over straight JDBC by providing the ORM module. Spring provide support to tie into several popular ORM frameworks, including Hibernate, JDO, and iBATIS SQL Maps. Spring’s transaction management supports each of these ORM frameworks as well as JDBC. 

20. What is web module? 
This module is built on the application context module, providing a context that is appropriate for web-based applications. This module also contains support for several web-oriented tasks such as transparently handling multipart requests for file uploads and programmatic binding of request parameters to your business objects. It also contains integration support with Jakarta Struts. 

21. What is AOP Alliance? 
AOP Alliance is an open-source project whose goal is to promote adoption of AOP and interoperability among different AOP implementations by defining a common set of interfaces and components. 

22. What is Spring configuration file? 
Spring configuration file is an XML file. This file contains the classes information and describes how these classes are configured and introduced to each other. 

23. What does a simple spring application contain? 
These applications are like any Java application. They are made up of several classes, each performing a specific purpose within the application. But these classes are configured and introduced to each other through an XML file. This XML file describes how to configure the classes, known as theSpring configuration file. 

24. What is XMLBeanFactory? 
BeanFactory has many implementations in Spring. But one of the most useful one is org.springframework.beans.factory.xml.XmlBeanFactory, which loads its beans based on the definitions contained in an XML file. To create an XmlBeanFactory, pass a java.io.InputStream to the constructor. The InputStream will provide the XML to the factory. For example, the following code snippet uses a java.io.FileInputStream to provide a bean definition XML file to XmlBeanFactory. 

25. Explain Bean lifecycle in Spring framework? 
1. The spring container finds the bean’s definition from the XML file and instantiates the bean.
2. Using the dependency injection, spring populates all of the properties as specified in the bean definition.
3. If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the bean’s ID.
4. If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.
5. If there are any BeanPostProcessors associated with the bean, their post- ProcessBeforeInitialization() methods will be called.
6. If an init-method is specified for the bean, it will be called.
7. Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called. 

26. What is Significance of JSF- Spring integration? 
Spring - JSF integration is useful when an event handler wishes to explicitly invoke the bean factory to create beans on demand, such as a bean that encapsulates the business logic to be performed when a submit button is pressed. 

27. How to integrate your Struts application with Spring? 
To integrate your Struts application with Spring, we have two options:
? Configure Spring to manage your Actions as beans, using the ContextLoaderPlugin, and set their dependencies in a Spring context file.
? Subclass Spring's ActionSupport classes and grab your Spring-managed beans explicitly using a getWebApplicationContext() method. 

28. What are the important beans lifecycle methods? 
There are two important bean lifecycle methods. The first one is setup which is called when the bean is loaded in to the container. The second method is the teardown method which is called when the bean is unloaded from the container. 

29. What are Inner Beans? 
When wiring beans, if a bean element is embedded to a property tag directly, then that bean is said to the Inner Bean. The drawback of this bean is that it cannot be reused anywhere else. 

30. What are the different types of bean injections? 
There are two types of bean injections.
1. By setter
2. By constructor 

31. What are different types of Autowire types? 
There are four different types by which autowiring can be done.
? byName
? byType
? constructor
? autodetect 

32. What is an Aspect? 
An aspect is the cross-cutting functionality that you are implementing. It is the aspect of your application you are modularizing. An example of an aspect is logging. Logging is something that is required throughout an application. However, because applications tend to be broken down into layers based on functionality, reusing a logging module through inheritance does not make sense. However, you can create a logging aspect and apply it throughout your application using AOP. 

33. What is a Jointpoint? 
A joinpoint is a point in the execution of the application where an aspect can be plugged in. This point could be a method being called, an exception being thrown, or even a field being modified. These are the points where your aspect’s code can be inserted into the normal flow of your application to add new behavior. 

34. What is an Advice? 
Advice is the implementation of an aspect. It is something like telling your application of a new behavior. Generally, and advice is inserted into an application at joinpoints. 

35. What is a Pointcut? 
A pointcut is something that defines at what joinpoints an advice should be applied. Advices can be applied at any joinpoint that is supported by the AOP framework. These Pointcuts allow you to specify where theadvice can be applied. 

36. What is an Introduction in AOP? 
An introduction allows the user to add new methods or attributes to an existing class. This can then be introduced to an existing class without having to change the structure of the class, but give them the new behavior and state. 

37. What is a Target? 
A target is the class that is being advised. The class can be a third party class or your own class to which you want to add your own custom behavior. By using the concepts of AOP, the target class is free to center on its major concern, unaware to anyadvice that is being applied. 

38. What is a Proxy? 
A proxy is an object that is created after applying advice to a target object. When you think of client objects the target object and the proxy object are the same. 

39. What is meant by Weaving? 
The process of applying aspects to a target object to create a new proxy object is called as Weaving. The aspects are woven into the target object at the specified joinpoints. 

40. What are the different points where weaving can be applied? 
? Compile Time
? Classload Time
? Runtime 

TOP 20 RMI multiple choice questions and answers freshers and experienced pdf

Read the most frequently asked 20 top RMI interview questions and answers for freshers and experienced

RMI Interview Questions and Answers PDF Experienced Freshers List


1. What is Java RMI?
Remote Method Invocation (RMI) is the process of activating a method on a remotely running object. RMI offers location transparency in the sense that it gives the feel that a method is executed on a locally running object.

2. What are the layers of RMI Architecture?
The RMI is built on three layers.
a. Stub and Skeleton layer
This layer lies just beneath the view of the developer. This layer intercepts method calls made by the client to the interface reference variable and redirects these calls to a remote RMI service.
b. Remote Reference Layer.
This layer understands how to interpret and manage references made from clients to the remote service objects. The connection is a one-to-one (unicast) link.
c. Transport layer
This layer is based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies.

3. What is the basic principle of RMI architecture?
The RMI architecture is based on one important principle: the definition of behavior and the implementation of that behavior are separate concepts. RMI allows the code that defines the behavior and the code that implements the behavior to remain separate and to run on separate JVMs.

4. How many types of protocol implementations does RMI have?
RMI has at least three protocol implementations:
Java Remote Method Protocol(JRMP), Internet Inter ORB Protocol(IIOP), and Jini Extensible Remote Invocation(JERI). These are alternatives, not part of the same thing, All three are indeed layer 6 protocols for those who are still speaking OSI reference model.

5. Does RMI-IIOP support dynamic downloading of classes?
No, RMI-IIOP doesn't support dynamic downloading of the classes as it is done with CORBA in DII (Dynamic Interface Invocation).Actually RMI-IIOP combines the usability of Java Remote Method Invocation (RMI) with the interoperability of the Internet Inter-ORB Protocol (IIOP).So in order to attain this interoperability between RMI and CORBA,some of the features that are supported by RMI but not CORBA and vice versa are eliminated from the RMI-IIOP specification.

6. Does RMI-IIOP support code downloading for Java objects sent by value across an IIOP connection in the same way as RMI does across a JRMP connection?
Yes. The JDK 1.2 support the dynamic class loading.

7. What is the role of Remote Interface in RMI?
The Remote interface serves to identify interfaces whose methods may be invoked from a non-local virtual machine. Any object that is a remote object must directly or indirectly implement this interface. Methods that are to be invoked remotely must be identified in Remote Interface. All Remote methods should throw RemoteException.

8. What is the role java.rmi.Naming Class?
The Naming class provides methods for storing and obtaining references to remote objects in the remote object registry.

9. What is the default port used by RMI Registry?
1099

10. What is meant by binding in RMI?
Binding is a process of associating or registering a name for a remote object that can be used at a later time to look up that remote object. A remote object can be associated with a name using the Naming class's bind or rebind methods.

11. What is the difference between using bind() and rebind() methods of Naming Class?
bind method(String name) binds the specified name to a remote object while rebind(String name) method rebinds the specified name to a new remote object,any existing binding for the name is replaced.

12. When is AlreadyBoundException thrown and by which method?
AlreadyBoundException is thrown by bind(String name) method when a remote object is already registered with the registry with the same name.
Note: rebind method doesn't throw AlreadyBoundException because it replaces the existing binding with same name.

13. How to get all the registered objects in a rmiregistry?
Using list method of Naming Class.

14. Can a class implementing a Remote interface have non remote methods?
Yes. Those methods behave as normal java methods operating within the JVM.

15. What is the protocol used by RMI?
JRMP(java remote method protocol)

16. What is the use of UnicastRemoteObject in RMI?
The UnicastRemoteObject class provides support for point-to-point active object references using TCP streams. Objects that require remote behavior should extend UnicastRemoteObject.

17. What does the exportObject of UnicastRemoteObject do?
Exports the remote object to make it available to receive incoming calls, using the particular supplied port. If port not specified receives calls from any anonymous port.

18. What is PortableRemoteObject.narrow() method and what is used for?
Java RMI-IIOP provides a mechanism to narrow the the Object you have received from from your lookup, to the appropriate type. This is done through the javax.rmi.PortableRemoteObject class and, more specifically, using the narrow() method.

19. In a RMI Client Program, what are the excpetions which might have to handled?
a. MalFormedURLException
b. NotBoundException
c. RemoteException

20. Explain RMI Architecture?
RMI uses a layered architecture, each of the layers could be enhanced or replaced without affecting the rest of the system. The details of layers can be summarised as follows:
1. Application Layer: The client and server program
2. Stub & Skeleton Layer: Intercepts method calls made by the client/redirects these calls to a remote RMI service.
3.Remote Reference Layer: Understands how to interpret and manage references made from clients to the remote service objects.
4.Transport layer: Based on TCP/IP connections between machines in a network. It provides basic connectivity, as well as some firewall penetration strategies. 

TOP 13 JAVA Server Faces(JSF) Interview Questions and Answers for freshers and experienced pdf

Read the most frequently asked 13 top JSF interview questions and answers for freshers and experienced

JSF Interview Questions and Answers PDF Experienced Freshers

1. What is the JSF?
JavaServer Faces(JSF) is a framework for building web-based user interface in Java. Unlike Swing, JSF provides widgets like buttons, hyperlinks, checkboxes, etc. in different ways. It has extensible facilities for validating inputs and converting objects to and from strings for display.
JSF is the Java answer to Microsoft ASP.NET's Web Forms. ASP.Net is roughly equivalent to the Servlet and JSP

2. What is JavaServer Faces event and listener model?
A mechanism for determining how events emitted by JavaServer Faces UI components are handled. This model is based on the JavaBeans component event and listener model.

3. What is JavaServer Faces conversion model?
A mechanism for converting between string-based markup generated by JavaServer Faces UI components and server-side Java objects.

4. What is JavaServer Faces UI component class?
A JavaServer Faces class that defines the behavior and properties of a JavaServer Faces UI component.

5. What is JavaServer Faces expression language?
A simple expression language used by a JavaServer Faces UI component tag attributes to bind the associated component to a bean property or to bind the associated component's value to a method or an external data source, such as a bean property. Unlike JSP EL expressions, JavaServer Faces EL expressions are evaluated by the JavaServer Faces implementation rather than by the Web container.

6. What is JavaServer Faces navigation model?
A mechanism for defining the sequence in which pages in a JavaServer Faces application are displayed.

7. What is JavaServer Faces Technology?
A framework for building server-side user interfaces for Web applications written in the Java programming language.

8. What is JavaServer Faces UI component?
A user interface control that outputs data to a client or allows a user to input data to a JavaServer Faces application.

9. What is JavaServer Faces validation model?
A mechanism for validating the data a user inputs to a JavaServer Faces UI component.

10. What is the difference between JSP and JSF?
JSP simply provides a Page which may contain markup, embedded Java code, and tags which encapsulate more complicated logic / html. JSF may use JSP as its template, but provides much more. This includes validation, rich component model and lifecycle, more sophisticated EL, separation of data, navigation handling, different view technologies (instead of JSP), ability to provide more advanced features such as AJAX, etc.

11. What are tags in JSF?
JSF application typically uses JSP pages to represent views. JSF provides useful special tags to enhance these views. Each tag gives rise to an associated component. JSF (Sun Implementation) provides 43 tags in two standard JSF tag libraries: 1. JSF Core Tags Library 2. JSF Html Tags Library Even a very simple page uses tags from both libraries. These tags can be used adding the following lines of code at the head of the page. <%@ taglib uri=”http://java.sun.com/jsf/core “ prefix=”f” %> (For Core Tags) <%@ taglib uri=”http://java.sun.com/jsf/html “ prefix=”h” %> (For Html Tags)

12. What is JSF life cycle and its phases?
he series of steps followed by an application is called its life cycle. A JSF application typically follows six steps in its life.
1. Restore view phase
2. Apply request values phase
3. Process validations phase
4. Update model values phase
5. Invoke application phase
6. Render response phase

13. What is Render Kit in JSF?
Component classes generally transfer the task of generating output to the renderer. All JSF components follow it. Render kit is a set of related renderers. javax.faces.render.RenderKit is the class which represents the render kit. The default render kit contains renderers for html but it’s up to you to make it for other markup languages. Render kit can implement a skin (a look & feel). Render kit can target a specific device like phone, PC or markup language like HTML, WML, SVG. This is one of the best benefit of JSF because JSF doesn't limit to any device or markup.

Read More => JSF Multiple Choice Questions and Answers

TOP 17 JMS Interview Questions and Answers pdf fresher and experienced

Read the most frequently asked 17 top JMS interview questions and answers for freshers and experienced.....

JMS Interview Questions and Answers PDF Experienced Freshers
1. What is JMS (Java Messaging Service)?
JMS is an acronym used for Java Messaging Service. It is Java's answer to creating software using asynchronous messaging. It is one of the official specifications of the J2EE technologies and is a key technology.

2. How the JMS is different from RPC?
In RPC the method invoker waits for the method to finish execution and return the control back to the invoker. Thus it is completely synchronous in nature. While in JMS the message sender just sends the message to the destination and continues it's own processing. The sender does not wait for the receiver to respond. This is asynchronous behavior.

3. What are the basic advantages of JMS?
JMS is asynchronous in nature. Thus not all the pieces need to be up all the time for the application to function as a whole. Even if the receiver is down the MOM will store the messages on it's behalf and will send them once it comes back up. Thus at least a part of application can still function as there is no blocking.

4. What are the different types of messages available in the JMS API?
Message, TextMessage, BytesMessage, StreamMessage, ObjectMessage, MapMessage are the different messages available in the JMS API.

5. What are the different messaging paradigms JMS supports?
Publish and Subscribe i.e. pub/suc and Point to Point i.e. p2p.

6. What is the difference between topic and queue?
A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for one-to-one messaging i.e. it supports Point to Point Messaging.

7. What is the use of Message object?
Message is a light weight message having only header and properties and no payload. Thus if theIf the receivers are to be notified abt an event, and no data needs to be exchanged then using Message can be very efficient.

8. What is the basic difference between Publish Subscribe model and P2P model?
Publish Subscribe model is typically used in one-to-many situation. It is unreliable but very fast. P2P model is used in one-to-one situation. It is highly reliable.

9. What is the use of TextMessage?
TextMessage contains instance of java.lang.String as it's payload. Thus it is very useful for exchanging textual data. It can also be used for exchanging complex character data such as an XML document.

10. What is the use of MapMessage?
A MapMessage carries name-value pair as it's payload. Thus it's payload is similar to the java.util.Properties object of Java. The values can be Java primitives or their wrappers

11. What is JMS provider?
An implementation of the JMS interface for a Message Oriented Middleware (MOM). Providers are implemented as either a Java JMS implementation or an adapter to a non-Java MOM.

12. Wat is JMS client?
An application or process that produces and/or receives messages.

13. What is JMS producer?
A JMS client that creates and sends messages.

14. What is JMS consumer?
A JMS client that receives messages.

15. What is JMS message?
An object that contains the data being transferred between JMS clients.

16. What is JMS queue?
A staging area that contains messages that have been sent and are waiting to be read. Note that, contrary to what the name queue suggests, messages don't have to be delivered in the order sent. If the message driven bean pool contains more than one instance then messages can be processed concurrently and thus it is possible that a later message is processed sooner than an earlier one. A JMS queue guarantees only that each message is processed only once.

17. What is JMS topic?
A distribution mechanism for publishing messages that are delivered to multiple subscribers.

TOP 19 JDBC Interview Questions and Answers pdf fresher and experienced

Read the most frequently asked 19 top JDBC interview questions and answers for freshers and experienced.....

JDBC Interview Questions and Answers PDF Experienced Freshers
1. What is JDBC? 
JDBC is a layer of abstraction that allows users to choose between databases. It allows you to change to a different database engine and to write to a single API. JDBC allows you to write database applications in Java without having to concern yourself with the underlying details of a particular database.

2. What are the two major components of JDBC?
One implementation interface for database manufacturers, the other implementation interface for application and applet writers.

3. What is JDBC Driver interface?
The JDBC Driver interface provides vendor-specific implementations of the abstract classes provided by the JDBC API. Each vendors driver must provide implementations of the java.sql.Connection,Statement,PreparedStatement, CallableStatement, ResultSet and Driver.

4. What are the common tasks of JDBC?
1.Create an instance of a JDBC driver or load JDBC drivers through jdbc.drivers;
2. Register a driver;
3. Specify a database;
4. Open a database connection;
5. Submit a query;
6. Receive results.

5. What packages are used by JDBC?
There are 8 packages: java.sql.Driver, Connection,Statement, PreparedStatement, CallableStatement, ResultSet, ResultSetMetaData, DatabaseMetaData.

6. What are the flow statements of JDBC?
A URL string
–>getConnection
–>DriverManager
–>Driver
–>Connection
–>Statement
–>executeQuery
–>ResultSet.

7. What are the steps involved in establishing a connection using JDBC in JAVA?
This involves two steps:
(1) loading the driver and
(2) making the connection.

8. How can you load the drivers in JDBC?
Loading the driver or drivers you want to use is very simple and involves just one line of code. If, for example, you want to use the JDBC-ODBC Bridge driver, the following code will load it:
Eg.
Class.forName(”sun.jdbc.odbc.JdbcOdbcDriver”);
Your driver documentation will give you the class name to use. For instance, if the class name is jdbc.DriverXYZ , you would load the driver with the following line of code:
E.g.
Class.forName(”jdbc.DriverXYZ”);

9. What Class.forName will do while loading drivers of JDBC?
It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.

10. How can you make the connection using JDBC?
In establishing a connection is to have the appropriate driver connect to the DBMS. The following line of code illustrates the general idea:
E.g.
String url = “jdbc:odbc:Fred”;
Connection con = DriverManager.getConnection(url, “Fernanda”, “J8”);

11. How can you create JDBC statements?
A Statement object is what sends your SQL statement to the DBMS. You simply create a Statement object and then execute it, supplying the appropriate execute method with the SQL statement you want to send. For a SELECT statement, the method to use is executeQuery. For statements that create or modify tables, the method to use is executeUpdate. E.g. It takes an instance of an active connection to create a Statement object. In the following example, we use our Connection object con to create the Statement object stmt :
Statement stmt = con.createStatement();

12. How can you retrieve data from the ResultSet using JDBC?
First JDBC returns results in a ResultSet object, so we need to declare an instance of the class ResultSet to hold our results. The following code demonstrates declaring the ResultSet object rs.
E.g.
ResultSet rs = stmt.executeQuery(”SELECT COF_NAME, PRICE FROM COFFEES”);
Second:
String s = rs.getString(”COF_NAME”);
The method getString is invoked on the ResultSet object rs , so getString will retrieve (get) the value stored in the column COF_NAME in the current row of rs

13. What are the different types of Statements in JDBC?
1.Statement (use createStatement method)
2. Prepared Statement (Use prepareStatement method) and
3. Callable Statement (Use prepareCall)

14. How can you use PreparedStatement in JDBC?
This special type of statement is derived from the more general class, Statement. If you want to execute a Statement object many times, it will normally reduce execution time to use a PreparedStatement object instead. The advantage to this is that in most cases, this SQL statement will be sent to the DBMS right away, where it will be compiled. As a result, the PreparedStatement object contains not just an SQL statement, but an SQL statement that has been precompiled. This means that when the PreparedStatement is executed, the DBMS can just run the PreparedStatement ’s SQL statement without having to compile it first.

E.g.
PreparedStatement updateSales = con.prepareStatement(”UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ?”);

15. How to call a Stored Procedure from JDBC?
The first step is to create a CallableStatement object. As with Statement an and PreparedStatement objects, this is done with an open Connection object. A CallableStatement object contains a call to a stored procedure;
E.g.
CallableStatement cs = con.prepareCall(”{call SHOW_SUPPLIERS}”);
ResultSet rs = cs.executeQuery();

16. How to Retrieve Warnings in JDBC?
SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
E.g.
SQLWarning warning = stmt.getWarnings();
if (warning != null) {
while (warning != null) {
System.out.println(”Message: ” + warning.getMessage());
System.out.println(”SQLState: ” + warning.getSQLState());
System.out.print(”Vendor error code: “);
System.out.println(warning.getErrorCode());
warning = warning.getNextWarning();
}
}

17. How to Make Updates to Updatable Result Sets in JDBC?
Another new feature in the JDBC 2.0 API is the ability to update rows in a result set using methods in the Java programming language rather than having to send an SQL command. But before you can take advantage of this capability, you need to create a ResultSet object that is updatable. In order to do this, you supply the ResultSet constant CONCUR_UPDATABLE to the createStatement method.
E.g.
Connection con = DriverManager.getConnection(”jdbc:mySubprotocol:mySubName”);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet uprs = (”SELECT COF_NAME, PRICE FROM COFFEES”);

18. What is Serialization and deserialization in JAVA Programming?
Serialization is the process of writing the state of an object to a byte stream.
Deserialization is the process of restoring these objects.

19. How you restrict a user to cut and paste from the html page using JAVA Programing?
Using JavaScript to lock keyboard keys. It is one of easiest solutions.