MY mENU


Sunday 27 May 2012

Working with URL-Related Actions


In web application developmentweb developers usually have to deal with URL manipulation such as importing URL, redirect to another URL...JSTL provides several useful URL-relatedactions to simplify URL manipulation.

The Action

The action is used to define a parameter. It is used inside the body of other actions such as import>. and  actions. the syntax of the action is simple as follows:
You specify the parameter name in the name attribute and its value in the value attribute.

The Action

The action enables you to retrieve the content of an URL and then you canprocess it within JSP page. The syntax of the action is as follows:
The only attribute url is mandatory. The URL could be in absolute or relative form. If it is in relative form, the resource you refer must be inside the web application. Inside the body of the action, you can also has parameter which specify by the action. Let's take a look at an example of using the action:
In the example, we use the action to retrieve the content of an XML file resided in the web application. Then we output the content of the XML file into the textarea. Later on if you learn how to process XML, you can parse this XML content to extract data inside it.

The  Action

 The  simply to redirect the current page to another page or URL. The syntax of the is as follows:
You can put any URL in the url attribute of the action. Let's take a look at an example of using the action:
In the above example, you choose a search engine and click Go button, the page will beredirect to the corresponding URL.
JSTL c:redirect Action Demo

The Action

The  action enables you to format an URL correctly. Inside the action, you can put multiple to construct URL. Here is an example of using the action: 
In the above example, we construct a link:  http://localhost/JSTLDemo/curl.jsp?mode=demo by using c:url action. We use the to define the query string which is mode with the value demo.

No comments:

Post a Comment