Small summary of understanding at the beginning of learning j2ee

Source: Internet
Author: User
Tags locale

I always think that j2ee tutorial is well written, but it is scattered, so that beginners are not required.
In this article, I have studied j2ee for a period of time and have written some things in combination.
1. Internationalization
For example, I have a resource package named Messages _ *. properties.
Management client:
Public BankAdmin (Locale currentLocale)
Messages = ResourceBundle. getBundle ("Messages", currentLocale );
Web client:
Extract region information from the request (set by the browser's language preference), open the corresponding resource package, and store the package as a session property:
ResourceBundle messages = (ResourceBundle) session. getAttribute ("messages ");
If (messages = null ){
Locale locale = request. getLocale ();
Messages = ResourceBundle. getBundle ("Messages", locale );
Session. setAttribute ("messages", messages );
}
Note: to display Chinese characters, you must select the specified font for the components in the program. If you use "MS Song" when displaying Chinese characters, there will be a box on the interface.
2. Context is an interface (all naming operations are related to it), and initialContext is a class that directly inherits from the Object
3. RequestDispather
Accept client requests and send them to resources on any server. It can encapsulate servlets, but the servlet container can generate RequestDispatcher to encapsulate any type of resources.
4. Several important tabs in deploytool
Note that all option cards are useful for each component.
1) Env. Enties Environment Portal, set the environment variables (content that is irrelevant to the program logic and frequently changed), call the environment variables through the JNDI Naming method,
Ic. lookup ("java: comp/env/variable name "). stored in the configuration descriptor of the Enterprise Bean, you can customize the business logic of the Enterprise Bean without modifying the name and value pairs of the source code.
2). Enter the application name of the Enterprise Bean in the coded name field of the Ejb Refs. Is the logical name of the Client in the JNDI query. If you look for enterprise Bean applications in the lookup of JNDI, such
:
Java: comp/env/ejb/OtherBean
Enter ejb/OtherBean
3). Resource Refs
Resource reference name is the logical name of the resource searched by JNDI. There are six types:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.