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

Struts example source code file (componentTagExample.jsp)

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

component, component, tag, tags, tags, this, this, to, to, ui

The Struts componentTagExample.jsp source code

<%@taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>Showcase - Tags - UI Tags - Component Tag
</head>
<body>
    
This example tries to demonstrates the usage of <s:component ... > tag.
<p/>

To have a look at the source of this jsp page click 
<s:url var="url" action="showComponentTagExampleCode" namespace="/tags/ui"/>
<s:a href="%{#url}">here
<p/>
    
<b>Example 1:   
This example load the template from the webapp context path using 
the default (ftl) as its template.
    <s:component 
        theme="customTheme" 
        templateDir="customTemplateDir" 
        template="ftlCustomTemplate">
        <s:param name="paramName" value="%{'paramValue1'}" />
    </s:component>
<p/>
    
<b>Example 2:
This example load the template from the webapp context path using
jsp as its template (notice the *.jsp extension to the template).       
    <s:component 
        theme="customTheme" 
        templateDir="customTemplateDir" 
        template="jspCustomTemplate.jsp">
        <s:param name="paramName" value="%{'paramValue2'}" />
    </s:component>      
<p/>
    
<b>Example 3
This example load the template from the webapp context path, 
using the default template directory and theme (default to 
'template' and 'xhtml' respectively)
    <s:component template="mytemplate.jsp">
        <s:param name="paramName" value="%{'paramValue3'}" />
    </s:component>
<p/>
    
    
<b>Example 4    
This example load the template from the webapp classpath using 
a custom themplate directory and theme.
    <s:component
        theme="myTheme"
        templateDir="myTemplateDir"
        template="myAnotherTemplate">
        <s:param name="paramName" value="%{'paramValue4'}" />
    </s:component>
<p/>

</body>
</html>

Other Struts examples (source code examples)

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