In the previous article "Preparing for Struts 2.0", I described in detail the configuration of the Struts 2.0 development environment and the running environment, so the two details are rarely covered in this article. If, after you read "Ready for Struts 2.0", what still do not understand, or can not run the example in this article, please contact me. My e-mail:max.m.yuan@gmail.com.
Before introducing the common logo, I would like to make a general comparison between Struts 1.x and Struts 2.0 's logo library (Tag libraries).
|
Struts 1.x |
Struts 2.0 |
Classification |
Divide the logo library by functionality into HTML, Tiles, logic, and bean parts |
Strictly speaking, there is no classification, all flags are under the URI "/struts-tags" namespace, but we can divide it into two categories from the functional: non-UI flags and UI flags |
Expression language (expression languages) |
Embed language not supported (EL) |
OGNL, JSTL, groovy and velcity |
The above form is a personal summary, if there are some deficiencies or mistakes, please do not hesitate to correct me
Well, I'm going to start by introducing the "common" (here is the so-called "common", refers to the use of struts in the past work often used) logo.
To use the Struts 2.0 flag in a JSP, first indicate the introduction of the flag. This can be done by adding the following code at the top of the JSP's code.
<% @taglib prefix= "s" uri= "/struts-tags"%>
Non-UI flags if, ElseIf, and Else
Describe:
Perform basic conditional flow.
Parameters:
name |
required |
default |
type |
description |
note |
|
|
boolean |
|
ELSE flag does not have this parameter |
id |
|
&NBSP; |
object/string |
|
&NBSP; |