Struts 2 UI tags

Struts2 UI tags examples programs for s textfield, s password, s submit, s hidden, s textarea, s radio, s checkboxlist, s checkbox, s select, s combobox, s file , s doubleselect, s updownselect, s datetimepicker, s autocompleter. Struts 2 UI tags are used for the user interface and data display in rich and reusable HTML. … Read more

Dynamic method invocation in struts 2

The dynamic method invocation is used to avoid the separate action mapping for every action in case of dispatch action functionality. We are using wildcard method to achieve dynamic method invocation. Example: test.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <html> <head> <title>Struts 2 dynamic method invocation example</title> </head> <body> <h3>This is a dynamic method invocation example.</h3>   … Read more

DispatchAction Functionality in Struts 2

The DispatchAction Functionality is a way of grouping the related actions into a single action class. In struts 1 DispatchAction class provides this functionality but in struts 2 every action class by default provide this functionality. To achieve this functionality in struts 2 we have to define the actions with the different names but having … Read more

JSP Expression Language

JSP Expression Language provides the facility to access the properties of java bean components or other implicit object. It is introduced in the JSP version 2.0. We can write both arithmetic and logical expressions using JSP Expression Language. Example: test.jsp <html> <head> <title>expression language example</title> </head> <body> <h3>This is an expression language example.</h3> 20 is … Read more

Categories JSP

Custom tag with attributes

Custom tags: Custom tags are the user defined tags. These tags are mainly used for code re-usability. We can define a custom tag with any number of attributes. Let us discuss it with the below example. Example: CustomTagWithAttribute.java import java.io.IOException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.SimpleTagSupport;   /** * This class is used for defining … Read more

Categories JSP

Custom tags

Custom tags: Custom tags are the user defined tags. These tags are mainly used for code re-usability. Advantages of custom tags: Code re-usability. Scriptlet tags are not needed. How to use custom tag? <prefix:tagname attributeName=attributeValue />   A custom tag may have zero or n attributes. How to create a custom tag? Steps to create a custom tag: … Read more

Categories JSP

JSTL fn:trim() function

The JSTL fn:trim() function returns the input string after removing the all white spaces from both ends of the string. Syntax: String trim(String inputString) Example: test.jsp <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>   <html> <head> <title>fn:trim JSTL function example</title> </head> <body> <c:set var="testString" value=" Hello this is a JSTL function example. … Read more

Categories JSP

JSTL fn:toUpperCase() function

The JSTL fn:toUpperCase() function returns the input string after converting the all characters of the string to upper case. Syntax: String toUpperCase(String inputString) Example: test.jsp <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>   <html> <head> <title>fn:toUpperCase JSTL function example</title> </head> <body> <c:set var="testString" value="Hello this is a JSTL function example."/> Given String: … Read more

Categories JSP

JSTL fn:toLowerCase() function

The JSTL fn:toLowerCase() function returns the input string after converting the all characters of the string to lower case. Syntax: String toLowerCase(String inputString) Example: test.jsp <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>   <html> <head> <title>fn:toLowerCase JSTL function example</title> </head> <body> <c:set var="testString" value="Hello this is a JSTL function example."/> Given String: … Read more

Categories JSP

JSTL fn:subStringBefore() function

The JSTL fn:subStringBefore() function returns a sub string of the input string before a specified string. Syntax: Strung subStringBefore(String inputString, String specifiedString) Example: test.jsp <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>   <html> <head> <title>fn:substringBefore JSTL function example</title> </head> <body> <c:set var="testString" value="Hello this is a JSTL function example"/> Given String: <br/> … Read more

Categories JSP