Sunteți pe pagina 1din 7

Unit - I

With a neat diagram explain MVC architecture

MVC stands for Model-View-Controller architecture. It divides the functionality of displaying and maintaining of the data
to minimize the degree of coupling between components. It is used to separate core business model functionality from the
presentation and control logic that uses this functionality. It allows multiple views to share the same enterprise data model
and makes supporting multiple clients easier to implement, test, and maintain.
MVC is often used by applications that need the ability to maintain multiple views of the same data. Multiple views and
controllers can interface with the same model and even new types of views and controllers can interface with a model
without forcing a change in the model design.
Model-View-Controller architecture is used mainly for interactive web-applications. This model minimizes the coupling
between business logic and data presentation to web user. This model divides the application into three layers:

Model the application object


View User Interface (screen presentation)
Controller defines the way the UI reacts to user inputs
Each of these aspects of the problem is a separate object and each has its own rules for managing its data. The schematic
diagram below shows the relationship between three layers of MVC.
Model:
Represents application data and the business rules that govern access and modification of this data. Often the model serves
as a software approximation to a real world process. The model notifies views when it changes and provides the ability for
the view to query the model about its state. It also provides the ability for the controller to access application functionality
encapsulated by the model.

View:
A View accesses data from the model and specifies how that data should be presented. View is responsible for
presentation aspect of application according to the model data and also responsible to forward query response to the
controller. When the model changes, it is the views responsibility to maintain consistency in its presentation.
The view forwards user gestures to the controller. In a stand-alone GUI client, these user gestures could be button clicks
or menu selections. In a Web application, they appear as GET and POST HTTP requests to the Web tier.
Based on the user gesture and the outcome of the model commands, the controller selects a view to be rendered as part of
the response to this user request. There is usually one controller for each set of related functionality.
Example: Human resources applications typically have a controller for managing employee interactions and a controller for
human resources personnel.
Controller:
A Controller defines application behavior. Controller can also be depends on the type of clients. . In a stand-alone GUI
client, controller interprets user gestures and maps them into actions to be perform by the model. User interactions in a
Web application appear as GET and POST HTTP requests. Controller accepts and intercepts user requests and controls
the business objects to fulfill these requests. Based on the user interactions and the outcome of the model actions, the
controller responds by selecting an appropriate view. An application has one controller for related functionality.

With a neat schematic diagram explain the Java EE architecture.

The J2EE platform uses a distributed multitiered architecture in which the application logic is divided into components
according to their functions. There are four tiers in j2ee architecture. These are as shown in the diagram below.

Enterprise
Client Tier Presentation Tier Business Logic Tier Information
System Tier
Pure HTML / Java
Applet /
JSP / Servlet EJB
Java Application

Browser / Desktop Web server EJB container


Application
As shown in the figure, various application components that make up a J2EE application are installed on different
machines depending on their functions in the multitiered Java EE environment. The four-tier architecture consists of
Client Tier (Presentation tier or Application tier), Web tier, Enterprise JavaBeans Tier(or Business tier), and the Enterprise
Information Systems Tier. Two or more tiers can physically reside on the same Java Virtual Machine although each tier
provides a specific type of functionality to an application. Some of the APIs of J2EE components can be used on more
than one tier (i.e. XML API), while other APIs (i.e., EJB API) or associated with a particular tier. The specific functions of
various tiers are discussed below.

Client Tier

Client tier consists of programs that interact with the user. It prompts the user for input and then converts the users
response into requests that are forwarded to software on a component that processes the request and returns results to the
client program. J2EE clients can be classified as follows

Web client is a software(usually browser) that accesses resources located on the web tier.
Ejb client can access one or more enterprise javabeans that are located on the EJB tier rather than resources on the
web tier.
EIS clients are the interface between users and resources located on the EIS tier.
Multi-tier clients can access components located on tiers other than the tier where the multi-tier client resides.

Web Tier

Web tier accepts requests from other software that was sent using POST, GET, and PUT operations, which are part of
HTTP transmissions. The two major components of web tier are Servlets and Java Server Pages. A servlet is a java class
that resides on the web tier and is called by a request from a browser client that operates on the client tier. A servlet is
associated with a URL that is mapped by the servlet container. It typically generates an HTML output stream that is
returned to the web server. The web server in turn transmits the data to the client. JSP is different than a servlet depending
on the container that is used. JSP uses custom tags to access the bean.

Enterprise Java Beans Tier

Enterprise java bean is a class that contains business logic and callable from a servlet or Jsp. EJB tier contains the
enterprise java beans server that stores and manages enterprise java beans. This tier automatically handles concurrency
issues that assure multiple clients have simultaneous access to the same object and also manages instances of components.
EJB server and EJB container is responsible for low level system services that are essential for implementing business
logic.

Enterprise Information Systems Tier

This tier provides flexibility to developers of J2EE applications since it include variety of resources and support
connectivity to resources. It defines all the elements that are needed to communicate between J2EE application and non-
J2EE software.

The J2EE architecture provides many advantages and benefits. Among other benefits, the J2EE platform offers
developers a simplified development environment that scales easily and can be integrated with existing systems and
applications. It also gives developers the flexibility to choose servers, tools, or other components that best fit their needs,
and to customize the security model for their needs. Vendors and customers alike benefit from the J2EE platform, as
follows:

Enterprise system vendors can implement compliant products that are also customizable.
Corporate information technologists benefit from the advantages of portable component technologythey can focus on
supporting business process requirements rather than handling distributed infrastructure integration problems.

With a neat diagram explain the life cycle of stateful session bean

Write any five differences between CMP and BMP beans

Container Managed Persistence Bean Managed Persistence


Persistence logic is provided by the container Developer is responsible for providing the persistence
logic code.
Persistence requirements are specified in Persistence requirements are hard coded in the source
deployment descriptor file.
Connection of the entity beans fields with the It is programmer responsibility to write JDBC code to
database is handled by the container and there is no connect to Database.
need to write any JDBC code to connect to the
database.
CMP code is simple as the persistence details are BMP code is complicated as it requires additional codes
automatically handled by the container for handling persistence
Since container handles the persistence, CMP is less Since the persistence is handled by the developer, BMP is
flexible more flexible
As platform independent persistence must be In case of a BMP, the application server need not be
provided by the container, The CMP application sophisticated
server must be more sophisticated.
Transaction behaviour in beans is defined in transaction Programmer has to write a code that implements
attributes of the methods Transaction behaviour to the bean class.
Tuned CMP entity bean offer better performance than BMP entity beans offer less performance than Tuned CMP
BMP entity beans entity bean.
CMP based approach provides database independence BMP based approach is bound to database and thus does
since it does not not provide database independence
contain any database storage APIs within it.
Since the container performs Since the database operations are hard coded, it is easier
database operations on behalf of the CMP entity bean, to debug a BMP code.
they are harder to debug.
CMP bean is less flexible to control than a BMP bean. BMP bean offers more control and flexibility that CMP
bean.

What is dependency injection? How does it help in Web application development?

Compare Struts with JSF

Struts framework JavaServer Faces


Matured since Struts has been around for a few JSF is in its early access release and as a result somewhat
years. It has got several successful immature.
implementations.
The heart of Struts framework is the Controller, The heart of JSF framework is the Page Controller Pattern
which uses the Front Controller design pattern where there is a front controller servlet where all the
and the Command design pattern. Struts faces request go through with the UI components and
framework has got only single event handler for then fire off events for each component and render the
the HTTP request. components using a render toolkit. So JSF can have
several event handlers on a page. Also JSF loosely couples
your model, where it can hook into your model (i.e unlike
Struts your model does not have to extend JSF classes).
Struts does not have the vision of Rapid JSF was built with a component model in mind to allow
Application Development (RAD). RAD. JSF can be thought of as a combination of Struts
framework for thin clients and the Java Swing user
interface framework for thick clients.
Has got flexible page navigation using JSF allows for more flexible navigation and a better design
navigation rules inside the struts-config.xml file because the navigation rule (specified in faces-config.xml )
and Action classes using is decoupled from the Action whereas Struts forces you to
maoping.findForward() . hook navigation into your Action classes.
Struts is a sturdy frame work which is JSF is more flexible than Struts because it was able to
extensible and flexible. The existing Struts learn from Struts and also extensible and can integrate
applications can be migrated to use JSF with RAD tools etc. So JSF will be a good choice for new
component tags instead of the original Struts applications.
HTML tags because Struts tags are superseded
and also not undergoing any active
development. You can also use the Struts-Faces
Integration library to migrate your pages one
page at a time to using JSF component tags.

Explain the request processing life cycle of JSF

Unit -II

How do you handle exception in Struts? Explain with example

With a neat diagram explain the architecture of Struts.

What are differences between ActionForm and DynaActionForm?

An ActionForm represents an HTML form that the user interacts with over one or more pages. You will provide
properties to hold the state of the form with getters and setters to access them. Whereas,
using DynaActionForm there is no need of providing properties to hold the state. Instead these properties and
their type are declared in the struts-config.xml
The DynaActionForm bloats up the Struts config file with the xml based definition. This gets annoying as the
Struts Config file grow larger.
The DynaActionForm is not strongly typed as the ActionForm. This means there is no compile time checking for
the form fields. Detecting them at runtime is painful and makes you go through redeployment.
ActionForm can be cleanly organized in packages as against the flat organization in the Struts Config file.
ActionForm were designed to act as a Firewall between HTTP and the Action classes, i.e. isolate and
encapsulate the HTTP request parameters from direct use in Actions. With DynaActionForm, the property
access is no different than using request.getParameter( .. ).
DynaActionForm construction at runtime requires a lot of Java Reflection (Introspection) machinery that can be
avoided.

Explain the role of request dispatcher in Struts framework

How do you build a view component with struts Framework

How do you handle exceptions in Struts? Explain with an example

What is dynaAction form? Explain the steps involved in using DynaActionForm.

Unit - III

Explain five core interfaces of hibernate framework

Explain the important tags of hibernate.cfg.xml

What are the differences between EJB 3.0 & Hibernate?

Hibernate EJB 3.0


SessionCache or collection of loaded objects relating to Persistence Context-Set of entities that can be
a single unit of work managed by a given EntityManager is defined by a
persistence unit
XDoclet Annotations used to support Attribute Oriented Java 5.0 Annotations used to support Attribute
Programming Oriented Programming
Defines HQL for expressing queries to the database Defines EJB QL for expressing queries
Supports Entity Relationships through mapping files and Support Entity Relationships through Java 5.0
annotations in JavaDoc annotations
Provides a Persistence Manager API exposed via the Provides and Entity Manager Interface for managing
Session, Query, Criteria, and Transaction API CRUD operations for an Entity
Provides callback support through lifecycle, interceptor, Provides callback support through Entity Listener and
and validatable interfaces Callback methods
Entity Relationships are unidirectional. Bidirectional Entity Relationships are bidirectional or
relationships are implemented by two unidirectional unidirectional
relationships

What are the advantages of HQL over SQL

Unit - IV

With a neat diagram explain the different modules of Spring Framework

Explain the features of Spring Framework


What are different bean scopes in Spring Framewok

What is IOC? What are the benefits of IOC?

Explain the following terms a) Aspect b) JoinPoint c)Advice. d) Pointcut e)Weaving

Write short note on Spring Web flow framework

Explain the feature of Spring MVC.

Unit - V

Explain the Architecture of Android

Explain the activity life cycle of Android

Explain any five properties of the Linear layout used in Android.

Write five used of Intents in Android.

Programs

Create guest book using JSTL tags. The program must list all the previously submitted comments and allow the
user to insert name and comment to the database

Create a web page that uses JSTL to read employee details(empno, ename dept, design) from an XML document
and display it in a tabular format.

Create a web page that uses JSTL to read Product details [ ProdID, ProdName, UnitPrice] from an XML document
and display it in a tabular format

Create a simple login application in JSF that accepts username and password. If username is equal to password
then the login is successful otherwise login fails.

Create a simple console application that uses hibernate to store the employee details(empno, ename,
department, designation) in a derby database.

Creat a simple console application that uses hibernate to store student details (regno, name, course, semester) in
a derby database.

Demonstrate the one-to-many mapping for a bill and item using hibernate. Entity bill contains many items

Demonstrate the one-to-many mapping between a Student Entity and Test Entity using Hibernate. The criteria
is a student can take many tests.
Demonstrate the use of before advice AOP for a typical Student class. Create a method studying() in student
class and set an advice that prints the time before this method is called.

Write an activity to read username and password from a SQlite database

Write an activity to read UserID aand username form a SQLITe database.

S-ar putea să vă placă și