• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)

Struts BEAN Include Tag ( < bean:include >)

October 1, 2010 //  by Krishna Srinivasan//  Leave a Comment

Struts BEAN Tag Library

Struts BEAN tag library provides tags which are usefull in accessing beans and their properties as well as defining new beans (based on these accesses) that are accessible to the remainder of the page via scripting variables and page scope attributes. Convenient mechanisms to create new beans based on the value of request cookies, headers, and parameters are also provided.

Syntax to use Struts BEAN tag library

	<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>

bean:include

– It is used to load the response data from the dynamic application request and make it as available as a bean of type string.It performs internal dispatch to specified application component.this tag works similar to tag except the response date is stored in page context instead of writing into output stream.

Example Code for bean:include

In this example we do not need the ActionForm bean.
In this example we do not need the Action class.
No need to configure struts-config.xml file

1.Create a simple jsp page BeanIncludeTag.jsp which illustrates the bean:include tag by id and page attributes which specifies the jsp page that to be included.

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

< html>
    < head>

        < title> Bean Include Tag </title>
    < head>
    < body bgcolor="#DDDDDD">
        < h1 > bean:include tag example  </h1>

		   < bean:include id="SampleJsp" page="/Sample.jsp"/>

            < h3> Displaying the Included Page Content</h3>
			< bean:write name="SampleJsp" /> < br>

		  </body>
</html>

2.Create any Sample jsp page which will be displayed here we used Sample.jsp page to be included.

3.Building and running the application
Output

Access page:http://localhost:8084/beaninclude/BeanIncludeTag.jsp

also read:

  • Struts 2.0 Introduction and Validations using Annotations
  • Introduction to Struts Actions
  • What’s new in Struts 2.0?
  • Internationalization and Taglibs in Struts 1.2

Category: StrutsTag: Struts Tags

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Previous Post: « BlackBerry Java Application Development
Next Post: Struts BEAN Paramter Tag ( < bean:parameter >) »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

EJB 3.0 Timer Services

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact