Set the JavaBean in the page range
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "<span style =" color: # e53333; "> page </span>" class = "com. javaweb. ch07.UserBean "> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: setProperty name = "user" property = "username" value = "page_username"/>
12
<Jsp: setProperty name = "user" property = "password" value = "page_password"/>
13
<Jsp: forward page = "PageJavaBeanDemo2.jsp"/>
14
</Body>
15
</Html>
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "<span style =" color: # e53333; "> page </span>" class = "com. javaweb. ch07.UserBean "> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: getProperty name = "user" property = "username"/>
12
<Jsp: getProperty name = "user" property = "password"/>
13
</Body>
14
</Html>
Set the JavaBean in the request range
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "<B> <span style =" color: # e53333; "> request </span> </B>" class = "com. javaweb. ch07.UserBean "> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: setProperty name = "user" property = "username" value = "request_username"/>
12
<Jsp: setProperty name = "user" property = "password" value = "request_password"/>
13
<Jsp: forward page = "PageJavaBeanDemo2.jsp"/>
14
</Body>
15
</Html>
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "<span style =" color: # e53333; "> request </span>" class = "com. javaweb. ch07.UserBean "> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: getProperty name = "user" property = "username"/>
12
<Jsp: getProperty name = "user" property = "password"/>
13
</Body>
14
</Html>
Set the session an in the session range
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "session" class = "com. javaweb. ch07.UserBean"> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: setProperty name = "user" property = "username" value = "session_username"/>
12
<Jsp: setProperty name = "user" property = "password" value = "session_password"/>
13
<A href = "PageJavaBeanDemo2.jsp"> jump to PageJavaBeanDemo2.jsp </a>
14
</Body>
15
</Html>
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "session" class = "com. javaweb. ch07.UserBean"> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: getProperty name = "user" property = "username"/>
12
<Jsp: getProperty name = "user" property = "password"/>
13
</Body>
14
</Html>
Set the JavaBean in the application range
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "application" class = "com. javaweb. ch07.UserBean"> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: setProperty name = "user" property = "username" value = "application_username"/>
12
<Jsp: setProperty name = "user" property = "password" value = "application_password"/>
13
<A href = "PageJavaBeanDemo2.jsp"> jump to PageJavaBeanDemo2.jsp </a>
14
</Body>
15
</Html>
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> set the page range </title>
06
</Head>
07
<Body>
08
<% -- Call JavaBean through useBean Action Command -- %>
09
<Jsp: useBean id = "user" scope = "application" class = "com. javaweb. ch07.UserBean"> </jsp: useBean>
10
<% -- Set attributes in JavaBean based on all parameters -- %>
11
<Jsp: getProperty name = "user" property = "username"/>
12
<Jsp: getProperty name = "user" property = "password"/>
13
</Body>
14
</Html>
From Zhang Dapeng's blog