Upload
benackerman
View
349
Download
4
Embed Size (px)
DESCRIPTION
JSTL and Regular expression lecture slide for company training. Introductory topics placed here.
Citation preview
Lesson X: Advanced Topics
Lesson X: Advanced TopicsJSTL and Regular ExpressionsJSP Standard Library Tags
JSTL
JSTL
JSTL
JSTL
JSTLWhen you want to change the loops behaviour (iterate only over a subset or do counter+=2 ) you use the:begin attributeend attributestep attributeJSTL
JSTL
JSTLWhen you want to set values that arent Bean properties or maps you can utilize the tag.
We need to differentiate between the target and var types. target is for bean properties and maps and var is for variables.JSTL
JSTL
JSTL
JSTL
JSTLIt is impossible to have both target and var in your tag.
The default scope value is page.
When value is null, the value for var will be removed.JSTLWhen target is null, the container throws an exception.
target can only accommodate object values. You cant pass in ids and names that will evaluate to objects.
An exception is thrown when target is neither an object or a Map.Remove Tag
Remove Tag
Import Tag
Import TagNormally when doing imports, you can only fetch pages within the webapp, with the import jstl tag you can go outside of the application and fetch data.Import Tag
Import Tag
The url Tag
The url Tag
Error Pages
Error Pages
Error Pages
The DD tag
The DD tag
The DD tag
The DD tagError pages are basically just jsps than handle exceptions, so they are also given additional implicit objects for us to use.
In this case we are given the exception implicit object to play around with.The DD tag
The DD tag
The DD tag
The DD tag
JSTL Tags
Custom Tag LibrariesNot all custom tag libraries will come well documented as the JSTL core libraries, so well have to discuss on the syntax of tag libraries.
In the tag , c is the prefix and set is the name.
You also have to aware of the library URI
Regular ExpressionsRegular expressions are pattern matching standards for spring parsing and replacement.
Please take note that not all implementations of regular expressions are the same, and there might be different ways to express a certain combination.Example
Quantifiers* - matches any number of whats before, zero to infinity
? matches zero to one
+ - matches at least oneExample
BehaviourAs far as we are concerned, regexs are always greedy taking in as much number of a certain character there is.
The example right after shows us this.Example
Other Representations
Example
Character Classes
Example
Grouping
Example
Sourceshttp://www.aivosto.com/vbtips/regex.html