Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

JNDI and Web Applications on the WLS 6.0 Certification Test

JNDI and Web Applications on the WLS 6.0 Certification Test

Last month, I talked about signing up to take the BEA WebLogic Server 6.0 Certification test. At that time, I promised I would go into more detail about what you should study, and that's what I'm including for your use.

This article covers two specific topics on the test: the Java Naming and Directory Interface (JNDI) and Web applications.

But before we start, there's one thing I forgot to mention last month: another benefit of the study material is that there is a strong overlap of these topics with the Sun Web Component Developer for J2EE test. So, by studying for this test, you'll be studying for the Web Component Developer test as well.

Now I'm assuming most of you are fairly experienced J2EE developers, so I'll gloss over most of the material, just pointing out the important aspects of the test. I've also provided a set of review questions at the end of this article that will help readers of all skill levels prepare for the test. Let's get started.

The Java Naming and Directory Interface
There isn't too much direct coverage of JNDI on the test, but using JNDI is important and, therefore, requires a little attention. The primary thing to be concerned about is configuring an InitialContxt and knowing the java:comp naming convention to look up objects.

When you're configuring an InitialContext, an Environment object (or HashTable) is used to initialize the InitialContext. The Environment contains several properties that assist in configuring the InitialContext object. The property names, constants, and default values are shown in Table 1.

In addition to the normal naming convention used by WebLogic Server JNDI, the J2EE specification has defined a standard naming convention for the objects stored in a JNDI tree. You can read more about this naming convention at http://java.sun.com/products/jndi/
, but Table 2 summarizes the important names to know.

That's more or less all you need to know about JNDI for the test. I would recommend having a good general knowledge of JNDI though, since it is used in some of the code in the test questions.

Web Applications
Now that I've covered a minor test topic, it's time to look at something a little more substantial. Web applications is one of the core topics of the BEA WebLogic Server 6.0 test. A good understanding of Web applications is extremely important to passing. Apart from the topic of Enterprise JavaBeans (EJBs), this is the most widely covered topic of the test, so be sure to study this area carefully. To make it easier, I'm going to break the Web applications section down into three areas: servlets, Java Server Pages (JSPs), and deployment.

When you prepare for the HTTP servlets portion, be sure to know the basics of creating an HTTP servlet. You should be familiar with servlet methods, how they are used, and when they are called. Table 3 illustrates the methods that are important to understand for the test.

Be sure to refamiliarize yourself with the HttpServletRequest class and its methods, such as getParameter(), which retrieves parameters from the request. In addition, study the HttpServletResponse and its methods, such as setContentType(), which is used to inform the client (browser) of which type of data is being sent back.

The HttpSession class represents the user's session. It is retrieved by the getSession() method of HttpServlet. Objects may be stored and retrieved from the HttpSession by using the putValue() and getValue() methods, respectively.

WebLogic Server exposes information about the servlet container through the ServletContext object. You can obtain the ServletContext by the getServletContext() method of ServletConfig, which is passed into your servlet's init() method. In addition, the ServletContext can be used to store data on the Web application's scope by using the getAttribute() and setAttribute() methods. It's important to note that, unlike data stored in the HttpSession object, data stored in the ServletContext may be used by all of the users of the Web application.

Java Servlet Pages
The next subtopic of Web applications is JSPs. Be sure to know the basics of creating a JSP and how WebLogic Server turns your page into a servlet. Also, be very familiar with the JSP tags used in creating a page (see Table 4). Below, I'll discuss each tag and what you should know about it.

Understanding that a scriptlet is just a piece of Java code that will be placed in the service() method of the generated servlet is critical. The code used in a scriplet has access to built-in objects (see Table 5).

A declaration is very similar to a scriptlet, but its code is placed at the class level of the generated servlet. Because of this, you can use declarations for defining methods or class-level variables. Since this code may be accessed by many users it should be synchronized for thread safety. Declarations have access to the same built-in objects that scriptlets do.

Not much to know here, but you should be aware that an expression returns the result of a single Java expression to the client. Also, realize that the expression must evaluate to a String.

A directive is an instruction to the JSP compiler that affects page compilation. An important fact to remember about directives is that they affect how the page is compiled, not how the page executes. Table 6 shows a list of directives. I'll break each of them down below.

PAGE Directive
Table 7 summarizes some possible values for a page directive.

Include Directive
The include directive textually includes the contents of a file into the JSP. It is important to distinguish between the include directive and the include action (see below). TAGLIB DIRECTIVE

The taglib directive specifies the location and usage of a tag library. There isn't much coverage of tag libraries on the WebLogic Server 6.0 test, but you may want to take some extra time out to review them if you are also looking to take the Sun Web Component Developer for J2EE test.

Generically, an action is a reference from a tag library, but for the purposes of the test, be sure to know the standard set of actions JSP provides (see Table 8).

UseBean Action
The useBean action accesses a JavaBean object. It is not a valid way to use or create an Entity Java Bean. If the referenced JavaBean doesn't exist, it will be created. The useBean action specifies the scope at which the JavaBean exists (see Table 9).

To retrieve a bean programmatically from a different scope, the getAttribute(id) method of the proper scope object.

Include Action
Remember that the include action is different from the include directive. The include action delegates processing from one page to another by having the initial JSP page accept the request, call an included JSP page to perform some function, and then send the response back to the client.

Forward Action
Similar to the include action, the forward action also delegates processing from one page to another. However, the forward action works by having the initial JSP page accept the request and forward it to the next page. The last JSP page in the "chain" of pages sends the response back to the client. Multiple forwards may occur, but only the last page is allowed to send a response to the client.

We're just about finished with the Web applications section. The last topic to cover here is deployment. Web application deployment is a mixed bag of information.

First, you should be familiar with the Web application directory structure and what each directory is used for (see Table 10).

There is quite a bit on deployment descriptors on the test, but most of the coverage relates to EJB. You should, however, be familiar enough with the descriptors to deploy a servlet and a JSP page. These go in the web.xml file. Examples of servlet and JSP deployment descriptors are shown in Listings 1 and 2.

Along with the deployment information, the web.xml configuration file also defines some security attributes. These security attributes specify how WebLogic Server handles security in a Web application (see Table 11).

And finally, although this really isn't deployment-related, it merits mention: you should know that WebLogic Server provides several servlets to handle incoming requests (see Table 12).

As promised, I've prepared a short study test for you. The answers are provided at the end of the test questions. I'd advise taking the whole test at once and then checking your answers; this way, you'll see how well you'd have done on the real test.

Next time, we'll cover JDBC and EJB. Have fun studying!

1. What property of the InitialContext Environment affects how the InitialContext is created?

    a) weblogic.jndi.WLInitialContextFactory
    b) java.naming.factory.initial
    c) java.naming.provider.url
    d) java.naming.security.principal
2. What method of an InitialContext do you call to retrieve an object from the JNDI tree?
    a) lookup()
    b) find()
    c) bind()
    d) get()
3. Which servlet allows you to execute any other servlet in the classpath?
    a) FileServlet
    b) JspServlet
    c) ServletServlet
    d) CgiServlet
4. What method of the response should you call before you send any content back to the browser?
    a) setMIMEType()
    b) setContentType()
    c) setResponse()
    d) setContent()
5. What class can be used by a Servlet to store attributes at Web application scope?
    a) AppContext
    b) ServerScope
    c) SessionContext
    d) ServletContext
6. Which JSP tag includes a JSP page for executing at run-time?
    a)<%@ include file="somepage.jsp" %>
    b) <jsp:include page="somepage.jsp">
    c) <jsp:forward page="somepage.jsp">
    d) None of the above
7. If a JSP page has the isErrorPage directive set to true, which of the following is true?
    a) An intrinsic exception object is defined
    b) All exceptions raised by any page in the
    Web application are redirected to this page
    c) This page is displayed when the generate-
    method is called
    d) All of the above
8. Select a valid way to call an EJB from a JSP page:
    a) Utilize a standard JSP directive
    b) EJB Creation code in scriptlet
    c) action
    d) All of the above
9. Which deployment descriptor contains the url-pattern used to map a servlet or a JSP to a URL?
10. Which Web application directory houses the deployment descriptor file weblogic.xml?
    a) The Web application root
    b) META-INF
    c) WEB-INF
    d) There is no deployment descriptor file
    named weblogic.xml.
Answer Key
    1. b 2. a 3. c 4. b 5. d 6. b 7. a 8. b 9. c 10. c

More Stories By Dave Cooke

David Cooke is an experienced software developer, currently working for Ness Technologies, Inc. a consulting firm located in Dulles, VA. In his current position, Mr. Cooke utilizes Java and BEA WebLogic Server 6.0 to build J2EE-compliant e-commerce systems for a variety of clients. Mr. Cooke has a bachelor's degree in Computer Science from George Mason University and maintains Microsoft, Java and BEA developer certifications.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

@ThingsExpo Stories
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
Predicting the future has never been more challenging - not because of the lack of data but because of the flood of ungoverned and risk laden information. Microsoft states that 2.5 exabytes of data are created every day. Expectations and reliance on data are being pushed to the limits, as demands around hybrid options continue to grow.
Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
As IoT continues to increase momentum, so does the associated risk. Secure Device Lifecycle Management (DLM) is ranked as one of the most important technology areas of IoT. Driving this trend is the realization that secure support for IoT devices provides companies the ability to deliver high-quality, reliable, secure offerings faster, create new revenue streams, and reduce support costs, all while building a competitive advantage in their markets. In this session, we will use customer use cases...
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
The IoT Will Grow: In what might be the most obvious prediction of the decade, the IoT will continue to expand next year, with more and more devices coming online every single day. What isn’t so obvious about this prediction: where that growth will occur. The retail, healthcare, and industrial/supply chain industries will likely see the greatest growth. Forrester Research has predicted the IoT will become “the backbone” of customer value as it continues to grow. It is no surprise that retail is ...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of bus...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
DXWorldEXPO LLC announced today that "Miami Blockchain Event by FinTechEXPO" has announced that its Call for Papers is now open. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Financial enterprises in New York City, London, Singapore, and other world financial capitals are embracing a new generation of smart, automated FinTech that eliminates many cumbersome, slow, and expe...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
DXWorldEXPO LLC announced today that ICOHOLDER named "Media Sponsor" of Miami Blockchain Event by FinTechEXPO. ICOHOLDER give you detailed information and help the community to invest in the trusty projects. Miami Blockchain Event by FinTechEXPO has opened its Call for Papers. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Miami Blockchain Event by FinTechEXPO also offers s...