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

Struts example source code file (main.jsp)

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

ajax, ajax, download, execute, file, file, manager, showcase, showcase, struts, struts, tiles, transitional//en, view

The Struts main.jsp source code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%
    response.setHeader("Pragma", "no-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
    
    // Calculate the view sources url
    String sourceUrl = request.getContextPath()+"/viewSource.action";
    com.opensymphony.xwork2.ActionInvocation inv = com.opensymphony.xwork2.ActionContext.getContext().getActionInvocation();
    org.apache.struts2.dispatcher.mapper.ActionMapping mapping = org.apache.struts2.ServletActionContext.getActionMapping();
    if (inv != null) {
        com.opensymphony.xwork2.util.location.Location loc = inv.getProxy().getConfig().getLocation();
        sourceUrl += "?config="+(loc != null ? loc.getURI()+":"+loc.getLineNumber() : "");
        sourceUrl += "&className="+inv.getProxy().getConfig().getClassName();
        
        if (inv.getResult() != null && inv.getResult() instanceof org.apache.struts2.dispatcher.StrutsResultSupport) {
	        sourceUrl += "&page="+mapping.getNamespace()+"/"+((org.apache.struts2.dispatcher.StrutsResultSupport)inv.getResult()).getLastFinalLocation();
        }
    } else {
        sourceUrl += "?page="+request.getServletPath();
    }
%>
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
<%@taglib prefix="s" uri="/struts-tags" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>
    <link href="
    <decorator:head/>
</head>

<body id="page-home">


<div id="page">
    <div id="outer-header">
        <div id="header" class="clearfix">
            <div id="branding">
                <h1 class="title">Struts Showcase
                <s:action var="dateAction" name="date" namespace="/" executeResult="true" />
            </div>

            <div id="search">
                <img src="
            </div>

            <hr/>
            <div style="clear: both;">
</div> </div> <div id="content" class="clearfix"> <div id="nav"> <div class="wrapper"> <h2 class="accessibility">Navigation <ul class="clearfix"> <li>Home <li>Ajax <li>Ajax Chat <li>Action Chaining <li>Config Browser <li>Conversion <li>CRUD <li>Execute & Wait <li>File Download <li>File Upload <li>Freemarker <li>Hangman <li>JavaServer Faces <li>Tags <li>Tiles <li>Token <li>Validation <li>Interactive Demo <li>Person Manager <li>Struts 1 Integration <li class="last">Help </ul> </div> <hr/> </div> <decorator:body/> </div> <div> <p> <a href="<%=sourceUrl %>">View Sources </p> </div> <div id="footer" class="clearfix"> <p>Copyright © 2003- The Apache Software Foundation.

<s:hidden name="project-name" value="Struts 2" /> </div> <p/> </div> </body> </html>

Other Struts examples (source code examples)

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