alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
<tr> </table> <p> <s:form action="submitApplication" namespace="/validation"> <s:textfield name="name" label="Name" /> <s:textfield name="age" label="Age" /> <s:submit /> <s:submit action="cancelApplication" value="%{'Cancel'}" /> </s:form> </p> <p> Try submitting with an invalid age value, and note that the browser location changes, but validation messages are retained. Because of the redirect, the input values are not retained. </p> </body> </html>

Other Struts examples (source code examples)

Here is a short list of links related to this Struts storeErrorsAcrossRequestExample.jsp source code file:

Struts example source code file (storeErrorsAcrossRequestExample.jsp)

This example Struts source code file (storeErrorsAcrossRequestExample.jsp) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Struts tags/keywords

across, content-type, errors, html, html, messagestoreinterceptor, messagestoreinterceptor, name, public, request, store, transitional//en, utf-8, when

The Struts storeErrorsAcrossRequestExample.jsp source code

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Showcase - Validation - Store Errors Across Request Example
</head>
<body>
	<p>
	This is an example demonstrating the use of MessageStoreInterceptor.
	When this form is submited a redirect is issue both when there's a validation
	error or not. Normally, when a redirect is issue the action messages / errors and
	field errors stored in the action will be lost (due to an action lives 
	only as long as a request). With a MessageStoreInterceptor in place and 
	configured, the action errors / messages / field errors will be store and 
	remains retrieveable even after a redirect.
	</p>

    <table border="1">
        <tr>
ActionMessages:
ActionErrors:
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.