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

Struts example source code file (jsp_2.jsp)

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

do, do, galt, hi, http, john, john, jsp, jsp, more, the, the, to, value

The Struts jsp_2.jsp source code

<%
    request.setAttribute("decorator", "none");
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<p>
    <b>if tag
</p>
<p>
    The <i>if tag allows you to optionally execute a JSP section. Multiple elseif tags
    and one <i>else tag can be associated to an if tag.
</p>
<p>    
    To say hello to John Galt type:
</p>
<p>
    <pre id="example0">
        <s:if test="name == 'John Galt'">
            Hi John
        </s:if>
        <s:else>
            I don't know you!
        </s:else>
    </pre>
</p>
<p>
    on the JSP console and hit enter. <a href="#" onclick="execJSP('example0')">Do it for me
</p>
<p>
    <b>iterator tag
</p>
<p>
    The <i>iterator tag loops over an Iterable object one object at a time into
    the Value Stack (the value will be on top of the stack).
</p>
<p>    
    To print the all the elements in the "bands" property type:
</p>
<p>
    <pre id="example1">
        <s:iterator value="bands">
            <s:property />
            <br />
        </s:iterator>
    </pre>
</p>
<p>
    on the JSP console and hit enter. <a href="#" onclick="execJSP('example1')">Do it for me
</p>
<p>
    <a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/property.html')">[More on the if tag]
    <a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/iterator.html')">[More on the iterator tag]
</p>

Other Struts examples (source code examples)

Here is a short list of links related to this Struts jsp_2.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.