3. Implementation of JSTL Core Tags
First, let’s make a new
Then a new dialog will show up as displayed above. Let’s call it Jstl_Hello_World.jsp. Then click Finish to create the jsp. Now we have 2 JSPs – index.jsp and Jstl_Hello_World.jsp.
We will create a table in index.jsp for the sample of this tutorial. Place these codes inside the tag in index.jsp
| Print out String "Hello World!" |
Now for the Jstl_Hello_World.jsp, we are going to write some JSTL tags to print out the sentence “Hello World”. Do not forget to uncomment the taglib directive for the JSTL library.
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
The above codes simply print the sentence “Hello World” to the JSP.
The tag works in opposite with . In the above codes, the will not print anything out anymore because the variable called “sentence” has been removed.
Press Shift+F11 to build the project and F6 to run. We will see something like this for the index.jsp. We may click the “Hello World” link to see our first JSTL tag in action.
Ok, we have completed our first Hello World JSTL. Now let’s move on to the logical JSTL core tags. We need to create another link in our index.jsp. The link will contain 3 parameters which hold some values which are boolean, string and numeric. We are goint to see a simple demonstration on how we are supposed to use logical JSTL core tags.
Comments
Post a Comment