In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "how to create a web client with J2EE". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how J2EE creates a web client".
The web client is included in the JSP web page of examples/src/EJB/converter/index.JSP. JSP web page is a text-based document containing static template data, which is composed of HTML, WML, and XML together with JSP elements, which constitute dynamic content.
Write Web client
The following highlighted statement is used to locate the home interface, create an enterprise bean instance, and then call the business method in almost the same way as the J2EE application client. The only difference is the parameters of the lookup method.
The classes required by the client are imported (contained by characters) in the instruction of JSP. Because locating the home interace and creating the enterprise bean are performed only once, they are displayed in the declaration of the JSP (contained by characters), which contains the initialization method jspInit of the JSP page. This declaration is followed by a standard HTML tag that creates a form with only one input box. Scriptlet (contained by characters) takes a parameter from the Request object and converts it to a string. Finally, JSP (included by characters) calls enterprise bean's business method and adds the result to the data stream and returns it to the client.
Converter
Enter an amount to convert:
0) {Double d = new Double (amount);% > dollars are Yen. Yen are Euro.
Compile Web client
J2EE server automatically compiles the web client.
Package Web client
To package the web component, you need to run deploytool's New Web Component Wizard. During processing, the wizard compiles the client file into a WAR file and adds the WAR file to the application's ConverterApp.ear file.
To start New Web Component Wizard, select File- > New Web Component. The wizard displays the following dialog box.
Introduction dialog box:
Read the explanatory text of the wizard's feature overview.
Click Next.
WAR File dialog box
In Application, select Create New WAR File.
In the combo box, select ConverterApp.
In the WAR Display Name column, enter ConverterWAR.
Click Edit.
In the Available Files directory tree, navigate to the examples/build/ejb/converter directory.
Select index.jsp and click Add.
Click OK.
Click Next.
Choose Component Type dialog box
Select the JSP radio button.
Click Next.
Component General Properties dialog box
In the JSP Filename group box, select index.jsp.
In the Web Component Name column, enter converter.
Click Finish.
Specify the Enterprise Bean Reference of the Web client
When the lookup method is called, the web client refers to an enterprise bean:
Object objref = initial.lookup ("java:comp/env/ejb/TheConverter")
You should specify reference as follows:
In the directory tree, select ConverterWAR.
Select EJB Ref's tab.
Click Add.
Enter ejb/TheConverter. Coded Name in the column.
In the Type column, select Session.
In the Interfaces column, select Remote.
Enter ConverterHome. Home in the column.
Enter Converter. Local/Remote in the column.
At this point, I believe you have a deeper understanding of "how J2EE creates web clients". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.