bean:include Tag - is used to load the response from a dynamic application request and make it available as a bean.
This tag performs an internal dispatch to the specified application component (or external URL) and makes the response data available from that request as a bean of type String.
Include tag works similar to that of the standard <jsp:include> tag, except that the response data is stored in a page scope attribute instead of being written to the output stream. If the current request is part of a session, the generated request for the include be part of the same session.
Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.
This attribute specifies the logical name of a global
This attribute specifies the absolute URL (including the appropriate protocol prefix such as "http:") of the resource to be included. Because this URL could be external to the current web application, the session identifier will not be included in the request.
This attribute specifies , the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified web application resource.
Page attribute specifies Module-relative URI (starting with a '/') of the web application resource to be included.
Example Illustrating the use of the Include<bean:include>
Here you will learn to use the Struts Html bean:include tags.
We will cover an example that will show a working of<bean:include> tags
Example code :
Creating an Action Class : Not Required here.
Creating Form Bean : Not Required here.
Defining the global-forwards : Not Required here.
Developing the Action Mapping in the struts-config.xml : Not Required here.
Developing the beanIncludeTag.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" %>
<title>Demo Of struts-bean:include Tag</title>
<h2><font color="#33FF33">struts-bean:include Tag Demo</font></h2>
<bean:include id="IncludePageOutput" page="/IncludePage.jsp" />
Display the contents returned by invoking
Add the following line in the index.jsp to call the form.
Above actions displays the working of beanIncludeTag..
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: January 10, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles