Services | Updates | Contact
Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
Search All Tutorials
Top Search: Loan Struts Open Source
Check Even-Odd:-Example
Now, you have to learn about the syntax of If-Else construct.
 
Image Size
This Java awt (Abstract Windowing Toolkit) tutorial describes about the image size. This is an actual representation of
 
More Tutorials...

Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

 
 
Struts
Comments
 
 

 

Rewrite Tag<html:rewrite>:

                         

html:rewrite Tag - This tag renders a request URI  based on exactly the same rules as the link tag does, but without creating the  hyperlink.
   
Note :

  1. This request URI value is useful when required to generate a string constant for use by a JavaScript procedure.
  2. This tag will automatically apply URL rewriting, to maintain session state in the absence of cookies.
  3. The content displayed for the hyperlink will be taken from the body of the tag. The base URL for the hyperlink
     is calculated based on properties given with the tag.

 

 

 

Name Description
action

This attribute specifies the logical name of a Action that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description.
You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. 
You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

href

The "href" attribute specifies URL to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

page

The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

Example Illustrating the use of the Rewrite<html:rewrite> tag.
Here you will learn to use the Struts Html<html:rewrite> tag. 
We will cover an example that will show a working of<html:rewrite>tag.

Example code :
Creating an Action Class : Not Required here.
Creating Form Bean        : Not Required here.

Defining the global-forwards :
Add the following entry in the struts-config.xml file for global-forward. 

<global-forwards>
<forward name="welcome" path="/Welcome.do"/>
</global-forwards>

Developing the Action Mapping in the struts-config.xml :
Here, Action mapping helps to select the  Form Bean, the Action class etc, for specific requests. 

<action path="/Welcome" forward="/welcomeStruts.jsp"/>

Developing the HtmlRewriteTag.jsp page :

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
      <body bgcolor="#999933">
        <h3><font color="#FFFF33">html:rewrite Tag Demo</font></h3>
        <A HREF="<html:rewrite action="Welcome.do" />" >
       Click 
for URL <html:rewrite action="Welcome.do" />
       </A> 

    </body>
</html>
 

Developing the welcomeStruts.jsp page :
<%taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>

<html:html locale="true">
<head>
<title><bean:message key="welcome.title"/></title>
<html:base/>
</head>
<a href="HtmlRewriteTag.jsp">Go Back........</a><br/>
<body bgcolor="#999933">

<logic:notPresent name="org.apache.struts.action.MESSAGE"
                                      
scope="application">
  <font color="red">
    ERROR:  Application resources not loaded -- check servlet container
    logs for error messages.
  </font>
</logic:notPresent>

<h3><bean:message key="welcome.heading"/></h3>
<p><bean:message key="welcome.message"/></p>
</body>
</html:html>
 

Add the following line in the index.jsp to call the form :
<a href="HtmlRewriteTag.jsp">HtmlRewriteTagDemo</a><br/> 

Building and Testing the Example  :
Build , deploy and Test  the application . 
Open the browser and navigate to the HtmlRewriteTag.jsp page. 

Your browser displays the following page.


Click  the hyperlink to analyze the generated URL, welcomeStruts.jsp  page, and see the output .

Output after clicked..........

Above actions   displays the working of  <html:rewrite>tag.

                         
Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

0 comments so far (post your own) View All Comments Latest 10 Comments:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.