Struts 2 s:hidden UI tag

<s:hidden>: The <s:hidden> tag is used to create a HTML hidden field. Syntax: <s:hidden name=”fieldName” value=”fieldVale”/> Example: test.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <html> <head> <title>Struts 2 s:hidden UI tags example</title> </head> <body> <h3>This is a s:hidden UI tags example.</h3>   <s:property value="message" /> <br/>   <s:form action="hiddenTest"> <s:hidden name="website" value="826.a00.myftpupload.com"/> <s:submit value="Submit"/> </s:form>   </body> … Read more

Struts 2 s:textfield, s:password and s:submit UI tags

<s:textfield>: The <s:textfield> tag is used to create a HTML input text box. Syntax: <s:textfield label=”fieldLabel” name=”fieldName”/> <s:password>: The <s:password> tag is used to create a HTML password field. Syntax: <s:password label=”fieldLabel” name=”fieldName”/> <s:submit>: The <s:submit> tag is used to create a HTML submit button. Syntax: <s:submit value=”buttonLable”/> Example: login.jsp <%@ taglib uri="/struts-tags" prefix="s"%> <html> … Read more

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

Struts 2 Zero Configuration by annotation approach

As we discussed how to create a struts application using struts.xml file. Struts framework also provides a way to create a struts application without using struts.xml file. Struts framework provides the annotation to achieve this. A struts application without using struts.xml file is also known as application with Zero Configuration. Some useful annotations. 1. @Action: … Read more

Struts 2 Zero Configuration by convention approach

A struts application without using struts.xml file is also known as application with Zero Configuration. Note: Put the view files inside the WEB-INF/content folder. The view file name must follow the below pattern: View file name: Request name-String returned by action class. Struts 2 Zero Configuration by convention approach example: login.jsp <%@ taglib uri="/struts-tags" prefix="s"%> … Read more

Struts 2 i18n

Internationalization or i18n is the process of designing a software application in such a way so that it can potentially be adapted to various languages and regions without changes. Struts framework provides the i18n interceptor to achieve internationalization. Struts 2 i18n example: login.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%> <%@ taglib uri="/struts-tags" prefix="s"%>   <html> … Read more

Struts 2 url validator

The url validator is used check that the specified url is valid or not. Plain validator syntax of url validator <validators> <validator type="url"> <param name=”fieldName">url</param> <message>message string</message> </validator> </validators><validators> <validator type="url"> <param name=”fieldName">url</param> <message>message string</message> </validator> </validators> Field validator syntax of url validator. <validators> <field name="fieldName"> <field-validator type="url "> <param name=" fieldName"> url</param> <message>message string</message> … Read more

Struts 2 regex validator

The regex validator is used validates a string field against a regular expression. Plain validator syntax of regex validator. <validators> <validator type="regex"> <param name=”fieldName">fieldName</param> <param name="regex"> regex</param> <message>message string</message> </validator> </validators><validators> <validator type="regex"> <param name=”fieldName">fieldName</param> <param name="regex"> regex</param> <message>message string</message> </validator> </validators> Field validator syntax of regex validator. <validators> <field name="fieldName"> <field-validator type="regex”> <param name="regex"> … Read more