Misra’s blog

Java EE

Posted by mtwinkle on July 20, 2007

Java EE application model

Portability, security and developer productivity are the key features of this model. This model partitions the work needed to implement a multi-tier service into two parts: the business and presentation logic to be implemented by developer and the standard systme services provided by the Java EE platform.

What is a servlet?

javax.servlet

javax.servlet.http

All Servlets must implement the Servlet interface, which defines life-cycle methods.

GenericServelt class

HttpServlet class – provides methods such as doGet and doPost for handling HTTP-specific services.

Servlet Lifecycle

The lifecycle of a servlet is controlled by the container in which the servlet has been deployed.

1. If an instance of the servlet does not exist, the web container

a. Loads the servlet class.

b. Creates an instance of the servlet class.

c. Initializes the servlet instance by calling the init method.

2. Invokes the service method, passing request and response objects.

If the container needs to remove the servlet, it finalizes by calling the servlet’s destroy method.

What are the different scope objects?

1. Context

2. Session

3. Request

4. Page

What the the different synchronization techniques to control concurrent access to shared resources?

Life cycle of a JSP page

Translation and Compilation

If an error is encountered during this phase, the server will return JasperException and a message.

After the page has been translated and compiled, the JSP page’s servlet follows the servlet lifecycle.

jspInit , _jspService, jspDestroy

Explain include directive

The include directive is processed when the JSP page is translated into a servlet class. The effect of the directive is to insert the text contained in another file– either static content or another JSP page–into the including JSP page. You would probably use the include directive to include banner content, copyright information, or any chunk of content that you might want to reuse in another page. This is a static include.

 

<%@ include file="filename" %>

Explain jsp:include

The jsp:include element is processed when a JSP page is executed. The include action allows you to include either a static or a dynamic resource in a JSP file. The results of including static and dynamic resources are quite different. If the resource is static, its content is inserted into the calling JSP file. If the resource is dynamic, the request is sent to the included resource, the included page is executed, and then the result is included in the response from the calling JSP page. The syntax for the jsp:include element is:

<jsp:include page=”includedPage” />

How is JSF page different from the JSP page?

A JavaServer Faces page is different from a JSP page in that it is represented by a tree of UI components, called a view.

JSF lifecycle

The life cycle handles both kinds of requests: initial requests and postbacks. When a user makes an initial request for a page, he or she is requesting the page for the first time. When a user executes a postback, he or she submits the form contained on a page that was previously loaded into the browser as a result of executing an initial request.

When the life cycle handles an initial request, it only executes the restore view and render response phases because there is no user input or actions to process. Conversely, when the life cycle handles a postback, it executes all of the phases.

Restore View

Apply Request Values

Process Validations

Update Model Values

Invoke Applications

Render Response

What is Message Drive bean?

MDB is an enterprise bean which is used to process messages asynchronously. it normally acts as a JMS message listener.

Difference between MDB and a session bean?

Clients do not access MDB’s through interfaces. ie. Unlike session bean, MDB has only a bean class.

How is message driven bean similar to session bean?

a. MDB’s retain no conversational state for a specific client i.e they are stateless.

b. All instances of a MDB are equivalent, allowing the EJB container to assign a message to any MDB instance. The container can also pool these instances to allow streams of messages to be processed concurrently.

How does a client accesses a MDB?

By sending messages to the message destination for which the MDB class is the MessageListener. You assign a MDB’s destination during deployment.

8 Responses to “Java EE”

  1. This really is how to get your foot inside the door. 683100

  2. Thank you for your extremely great info and feedback from you. san jose used car 307946

  3. Id have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment! 738542

  4. hyperlink said

    Some truly very good content material on this internet internet site , appreciate it for contribution. 331022

  5. I surely did not recognize that. Learnt 1 thing new today! Thanks for that. 526044

  6. website said

    Significant other, this excellent website is fabolous, i merely adore it 318159

  7. My website said

    This douche bag loves his illegal bretheren because hes a itiaen of the world and we ought to be ashamed of ourselves I got news for you Asswipe get your asswiping ass back to the craphole where you came from with all of your illegal beaners 31261

  8. This write-up is dedicated to all those that know what is billiard table; to all those that do not know what is pool table; to all those that want to know what is billiards; 44263

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: