Introduction to JSP development (III) -- JSP and JavaBean_MySQL
Source: Internet
Author: User
Although you can put a large piece of program code in a small instruction file, most Java program code is a reusable component called JavaBean. Like ActiveX controls, JavaBean provides known functions and is designed for reuse at any time. The value of JavaBean is that it can be used through a set of features, although you can put a large piece of program code in a small instruction file, however, most Java program code is a reusable component called JavaBean. Like ActiveX controls, JavaBean provides known functions and is designed for reuse at any time.
The value of JavaBean is that it can be used through a set of features that provide access to the JavaBean settings. For example, this person is a JavaBean, and his name, social welfare security number, and address can be characteristic. For JSP websites, you basically dynamically connect 'Java' to your website.
Suppose that JavaBean is created before the website is created. The first thing you need to do is to tell the JSP page that it needs to use JavaBean. this work can be used. To complete: .
You must use the id attribute to identify beans. here, you provide a name for the JSP webpage to identify beans. in addition to the id attribute, you must also tell the webpage where to find the beans, or its Java category name. The category attribute provides how to locate it in various methods. the last required component is the scope attribute. with the help of the range attribute, you can tell beans to ask for a single webpage (preset) [scope = "page"]; for a requested webpage [scope = "request"]; for the call period [scope = "session"]; or [scope = "application"] for the entire application to maintain its own information. for the call period range, you can easily maintain items on the JSP page, such as the shopping cart.
Once you declare a JavaBean, you can access its features to define it. To obtain a specific value, use Volume label. With You can specify the name of the bean to be used (from the id field of useBean) and the value acquisition feature. Then, the real value will be placed in the output: .
You need to use For this label, you also need to identify beans and the features to be corrected. In addition, you also need to provide new values. if the name is correct, these can be obtained directly in the specified format: ;
To get this from a parameter, you must directly name this feature and the parameter: ;
Or directly set it by name and value: Or />.
Last point about JavaBean: to enable the network server to find JavaBean, you need to put their category files in a special location. For JSWDK, the simplest thing is the class directory in the installation directory, such as \ jswdk-1.0.1 \ classes.
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