<s:url value="https://www.dineshonjava.com" var="dojURL" /> <s:a href="%{dojURL}">Dinesh On Java</s:a>
Click here for detailed Example.
This tag enables developers to call actions directly from a JSP page by specifying the action name and an optional namespace. The body content of the tag is used to render the results from the Action. Any result processor defined for this action in struts.xml will be ignored, unless the executeResult parameter is specified.
<div>Tag to execute the action</div> <br /> <s:action name="actionTagAction" executeResult="true" /> <br /> <div>To invokes special method in action class</div> <br /> <s:action name="actionTagAction!specialMethod" executeResult="true" />
Click here for detailed Example.
In this section, we are going to describe the include tag. The include tag is a generic tag that is used to include a servlet’s output (result of servlet or a JSP page) to the current page.
<-- First Syntax --> <s:include value="dojJsp.jsp" /> <-- Second Syntax --> <s:include value="dojJsp.jsp"> <s:param name="param1" value="value2" /> <s:param name="param2" value="value2" /> </s:include> <-- Third Syntax --> <s:include value="dojJsp.jsp"> <s:param name="param1">value1</s:param> <s:param name="param2">value2</s:param> </s:include>
Click here for detailed Example.
In this section, we are going to describe the param tag. The param tag is a generic tag that is used to parametrize other tags.
These param tag can be used to parametrize other tags. This tag has the following two parameters.
<ui:component> <ui:param name="username">Dinesh</ui:param><br> <ui:param name="username">Anamika</ui:param><br> <ui:param name="username">Sweety</ui:param> </ui:component>
Click here for detailed Example.
In this section, we are going to describe the Set tag . The set tag is a generic tag that is used to assign a value to a variable in a specified scope. These set tag assigns a value to a variable in a specified scope. It is useful when you wish to assign a variable to a complex expression and then simply reference that variable each time rather than the complex expression. The scopes available are application, session, request, page and action.
<h1><span style="background-color: #FFFFcc">Set Tag (Data Tags) Example!</span></h1> <s:set name="technologyName" value="%{'Java'}"/> Technology Name: <s:property value="#technologyName"/>
Click here for detailed Example.
These bean tag instantiates a class that conforms to the JavaBeans specification. This tag has a body which can contain a number of Param elements to set any mutator methods on that class. If the var attribute is set on the BeanTag, it will place the instantiated bean into the stack’s Context.
<s:bean name="org.apache.struts2.util.Counter" var="counter"> <s:param name="first" value="20"/> <s:param name="last" value="25" /> </s:bean>
Click here for detailed Example.
These date tag will allow you to format a Date in a quick and easy way. You can specify a custom format (eg. “dd/MM/yyyy hh:mm:ss”), you can generate easy readable notations (like “in 3 hours, 14 minutes, 23 seconds“), or you can just fall back on a predefined format with key ‘struts.date.format‘ in your properties file.
<s:date name="user.birthday" format="dd/MM/yyyy" /> <s:date name="user.birthday" format="%{getText('some.i18n.key')}" /> <s:date name="user.birthday" nice="true" /> <s:date name="user.birthday" />
Click here for detailed Example.
These property tag is used to get the property of a value, which will default to the top of the stack if none is specified.
<s:push value="myBean"> <!-- Example 1: --> <s:property value="myBeanProperty" /> <!-- Example 2: -->TextUtils <s:property value="myBeanProperty" default="a default value" /> </s:push>
Click here for detailed Example.
These push tag is used to push value on stack for simplified usage.
<s:push value="user"> <s:propery value="firstName" /> <s:propery value="lastName" /> </s:push>
Click here for detailed Example.
These text tag is used to render a I18n text message.
<!-- First Example --> <s:i18n name="struts.action.test.i18n.Shop"> <s:text name="main.title"/> </s:i18n>
<s:text name="main.title" /> <s:text name="i18n.label.greetings"> <s:param >Mr Smith</s:param> </s:text>
Click here for detailed Example.
These url tag is used to create a URL.
<-- Example 1 --> <s:url value="editGadget.action"> <s:param name="id" value="%{selected}" /> </s:url> <-- Example 2 --> <s:url action="editGadget"> <s:param name="id" value="%{selected}" /> </s:url> <-- Example 3--> <s:url includeParams="get"> <s:param name="id" value="%{'22'}" /> </s:url>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…