Subset Tag (Control Tags) Example Using Start

In this section, you will learn how to set the tool tip text for text field tag of struts2. Tool Tip text is the help text of any component for user. When you rest the mouse cursor on the component then at that point a message. Which show the information about that component.

Add the following code snippet into the struts.xml file.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <!-- Rose India Struts Tutorials -->
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />

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

    <action name="Tooltips">
      <result>/pages/uiTags/toolTips.jsp</result>
    </action>

         <!-- Add actions here -->
    </package>


    <!-- Add packages here -->

</struts>

Now we create a jsp page using <s:form> and <s:textfield> tags as shown in the toolTips.jsp page. 

toolTips.jsp

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

<html>
  <head> 
    <title>Combobox (Form TagTag Example!</title>
    <link href="<s:url value="/css/main.css"/>" rel="stylesheet"
          type="text/css"/>
  </head>
  <body>
    <h1><span style="background-color: #FFFFcc">Tooltips Example!</span></h1>
    <s:form>
      <s:textfield name="name" label="Enter Name" size="20" tooltip="Please Enter name"/>
      <s:param name="tooltipDelay" value="200" />
    </s:form>
    </body>
</html>

Output of toolTips: