Struts2.2.1 label Tag Example
Posted on: January 19, 2011 at 12:00 AM
The label tag is used to renders an HTML LABEL that allow to output.

Struts2.2.1 label Tag Example

The label tag is used to renders an HTML LABEL that allow to output <s: label name=? ? value=? ? /> combination that has the same format treatment as the rest of UI controls.The following Example will shows how to implement the label tag in the Struts2.2.1 --

First we create a JSP file named Label.jsp as follows.

<%@ page language="java" contentType="text/html; charset=UTF-8"


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"


<%@taglib prefix="s" uri="/struts-tags"%>



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Example Label Tag</title>



label1:<s:label value="Roseindia" /><br>

label2:<s:label value="Technology" />


<s:textfield label="Roseindia"/><br>

<s:textfield label="Technology"/>



Here is the Struts.xml file.

<?xml version="1.0" encoding="UTF-8"?>


"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"



<constant name="struts.enable.DynamicMethodInvocation" value="false" />

<constant name="struts.devMode" value="true" />

<constant name="struts.custom.i18n.resources" value="ApplicationResources" />

<package name="default" namespace="/" extends="struts-default">

<action name="Label" class="roseindia.LabelTag">

<result name="success">/index.jsp</result>



 This Program produces output on the basis of the label Tag evaluation, This  give the output as-



Download Select Source Code

Related Tags for Struts2.2.1 label Tag Example:




Advertisement null