alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Struts example source code file (index.jsp)

This example Struts source code file (index.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

a, example, example, examples, examples, for, struts, the, the, there, these, these, this, you

The Struts index.jsp source code

<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
    <head>Token Examples (double post)

<body>
    <h1>Token Examples

    These examples illustrate Struts build in support of using tokens to prevent double post.
    <p/>
    You have a web page where user can input data and press a button to submit.
    There could be a problem that the user submit the data many times, by either clicking the
    button many times, or use the browser back button and then submit the form again.
    <br/> A good solution is to use a hidden token in the form. The token is autogenerated and unique
    from time to time. This token is then validated with the HttpSession that it is the first time
    it is submitted, if not we have a double post and therefore can prevent the second submit action.
    <p/>
    For more information check out javadoc for org.apache.struts2.interceptor.TokenInterceptor
    and org.apache.struts2.interceptor.TokenSessionStoreInterceptor.

    <br/>
    <br/>Example 1 (token based .jsp example)

    <br/>
    <br/>Example 2 (as example 1 with redirect after post)

    <br/>
    <br/>Example 3 (token-session based .jsp example)

    <br/>
    <br/>Example 4 (token based freemarker example)

</body>
</html>

Other Struts examples (source code examples)

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

... 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.