I always feel that J2EE TUTORIAL is written very well, but it is very zero, so that beginners must not lead. This article develops some things in J2EE for a while and combines this writing. 1. Internationalization, such as I am called Messages_ *. Properties resource package. Management Client: Public BankAdmin (Locale Currentlocale) Messages = ResourceBundle.getBundle ("Messages", CurrentLocale); Web Client: Extract Zone Information from the request (by the browser language preference setting), open the corresponding resource package, then the packet is stored as the attributes of a session up: ResourceBundle messages = (ResourceBundle) session.getAttribute ( "messages"); if (messages == null) {Locale locale = request.getLocale (); messages = ResourceBundle.getBundle ( " Messages ", Locale; session.setttribute (" Messages ", Messages);} Note: To display Chinese, the components need to be selected by the specified font, such as using the" MS Song "when displaying Chinese, there will be a box. 2. Context is the interface (all named operations are related to it), INITIALCONTEXT is class, directly inherited to Object3.RequestDispather Accept client requests and send to any server, can pack servlets but servlet containers can generate RequestDispatcher packages any type of resource . 4. A few important tabs in DeployTool first pay attention to all tabs are useful for each component. 1) .Env. Enties Environment portal, set environment variables (content-independent and frequently changing content), call environment variables through JNDI Naming mode,
Ic.lookup ("Java: Comp / ENV / Variable Name). In the configuration descriptor stored in the enterprise bean, the business logic of the custom enterprise bean does not need to change the name value of the source code. 2) .EJB REFS Enter the application name of the enterprise bean in Coded Name. It is JNDI to find the logical name of the Client. If you find the application like the company bean in JNDI's Lookup
: Java: Comp / Env / Ejb / OtherBean Enter EJB / OtherBean 3) .resource Refs Resource Reference Name is the logical name of the resources found by JNDI. There are six types: DataSource is jdbc / Session mail / URL url / QueueConnectionFactory and TopicConnectionFactory jms / ConnectionFactory env / Note: QueueConnectionFactory and TopicConnectionFactory, ConnectionFactory requires a username and password, please write the user name and password field,
Cloudscape does not require username and password. 4) .resource Environment REFS The JMS / in the code
5. If the component is applied to the local entity bean, you will need to give the name of the reference bean in the Enterprise Bean Name field. 6. Passing Enterprise Bean's object reference, for example, you can make enterprise beans can call another enterprise bean by reference. You can't access this reference because it points to the Bean instance running in the EJB container, only the container can directly call the bean instance method. The client implements the object by remote interface to indirectly call the bean method, through these objects (remote interface implementation objects) referenced enterprise beans can mutually
Access. Session bean calls the getejbobject method defined by the sessionContext interface to get its remote interface object reference. The entity bean calls the getejbobject method defined by the EntityContext interface. These two excuse provide enterprise beans to access the context objects managed by the EJB container. Typically, enterprise beans saves its context objects through the setSessionContext method. The following code snippet explains how the session bean uses these methods: public class wagonbean implements sessionBean {sessionContext context; ... public void setsessionContext (sessionconText sc) {this.context = sc;} ... public void passiton (Basket Basket) {... Basket.copyItems (Context.GetejbObject ()); 7.Meta-INF must be capitalized. 8. Include (Request, Response) Purpose: Add a resource. The response returned from the web component is included, such as copyright information and logging information resources are divided into: Static and Web Components 9.Service Service Method Normal mode Extract information from the request --- Access to external resources - then released based on this information Response Release Response Steps: 1. Response Head 2. From the response to the output stream 3. Write a response body 10 in the output stream 10. Look at his help to a tool that is the most direct means, nothing is more than .