jsp:include action tag

jsp:include action tag is used to include the content of another resource at the specific position into current JSP page. Another resource can be servlet, jsp or html file. Syntax: <jsp:include page=”URL of another resource”/> Note: In case of jsp:include action tag contents are included during request processing. Difference between include directive and include action. … Read more

Categories JSP

jsp:forward action tag

jsp:forward action tag is used for controlling the page flow. It forwards the request from a JSP to the other resource. Another resource can be servlet, jsp or html file. Syntax: <jsp:forward page=”URL of other resource”/> Example: welcome.jsp <html> <head> <title>forward action example</title> </head> <body> <jsp:forward page="home.jsp"/> </body> </html><html> <head> <title>forward action example</title> </head> <body> … Read more

Categories JSP

JSP action tags

JSP specification provides the action tags to control the behaviour of the servlet engine, to control page flow, to dynamically insert a file, to reuse JavaBeans components etc. jsp: is used as prefix. Syntax: <jsp:actionName attributeName=”attributeValue”/> Commonly used JSP action tags are as follows: jsp:forward jsp:include jsp:param jsp:useBean jsp:setProperty jsp:getProperty Common attributes of all action … Read more

Categories JSP

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

Struts 2 email validator

The email validator is used check that the String field is a valid email address and it should not be empty. Plain validator syntax of email validator. <validators> <validator type="email"> <param name=”fieldName">fieldName</param> <message>message string</message> </validator> </validators><validators> <validator type="email"> <param name=”fieldName">fieldName</param> <message>message string</message> </validator> </validators> Field validator syntax of requiredstring validator. <validators> <field name="fieldName"> <field-validator type="email"> … Read more

Struts 2 date validator

The required validator is used check that the date is within a specific range. Plain validator syntax of date validator. <validators> <validator type="date"> <param name=”fieldName">fieldName</param> <param name="min">minDate</param> <param name="max">maxDate</param> <message>message string</message> </validator> </validators><validators> <validator type="date"> <param name=”fieldName">fieldName</param> <param name="min">minDate</param> <param name="max">maxDate</param> <message>message string</message> </validator> </validators> Field validator syntax of date validator. <validators> <field name="fieldName "> … Read more