Js
Although you can add a lot of code blocks to Java code (scriptlets), the fact is that most Java codes should be used in reusable components called JavaBeans. JavaBeans are like ActiveX controls: They provide the familiar features of functionality and reuse.
JavaBean values are available through the definition of a set of properties that provide access to JavaBean settings. To use a person as a javabean, the person's name, social security number, and address are his attributes. In the JSP site, you are mainly through the implementation of connection beans to dynamically access your site.
Assuming that JavaBeans has been constructed before the site is created, you first have to let your JSP page know that you want to use a bean. This step is done by the <jsp:useBean> tag:
<jsp:usebean id= "LocalName" class= "Com.jguru.Person" scope= "Application"/>.
<jsp:useBean> tags require you to use the attributes of the ID to determine the bean. Here you need to provide a name in the static JSP page to identify the bean. In addition, you must tell this page where to find the name of the Bean or Java class, and the attributes of the class provide this information in a few other places. One of the last necessary elements is the scope property. With its help, you can use beans for a page (the default) [scope= "page"], request [scope= "request"], lifetime [scope= "session"], or the entire application [scope=] Application "] Provides information that, by using session scope, you can add other items, such as shopping cards, to your JSP pages.
Once you have defined a JavaBean, you have the right to use its properties to define it. To get an appropriate value, use the <jsp:getProperty> tag, which allows you to define a bean in detail. Its actual metrics will be placed in the output:
<jsp:getproperty id= "LocalName" property= "name"/>.
If you want to change the properties of JavaBean, you need to use the <jsp:setProperty> tag, which allows you to redefine your bean and properties and provide new values. If you want to change the named property, these can be obtained directly from the following form:
<jsp:setproperty id= "LocalName" property= "*"/>;
You can name the properties and parameters directly from the following form:
<jsp:setproperty id= "LocalName" property= "Address" param= "parametername"/>;
or set the name and value directly:
<jsp:setproperty id= "LocalName" property= "SerialNumber" value= "string"/> or <jsp:setproperty id= "LocalName" Property= "serialnumber" value= <%= expression%>/>.
The final step is: to get the Web server to find JavaBeans, you need to place their class files in a special location. The most obvious place to use JSWDK is to create a class directory under the installation directory, such as \jswdk\-1.0.1\classes.