Author: tmjee Date: Sat Jun 10 06:34:22 2006 New Revision: 413295 URL: http://svn.apache.org/viewvc?rev=413295&view=rev Log: - added an example of using <saf:component ... /> tag - show templating using jsp and freemarker
Added: struts/action2/trunk/apps/showcase/src/main/resources/myTemplateDir/ struts/action2/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/ struts/action2/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/ struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp (with props) struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp (with props) struts/action2/trunk/apps/showcase/src/main/webapp/template/ struts/action2/trunk/apps/showcase/src/main/webapp/template/xhtml/ struts/action2/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp (with props) Modified: struts/action2/trunk/apps/showcase/src/main/webapp/WEB-INF/classes/xwork-tags-ui.xml struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp Added: struts/action2/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl URL: http://svn.apache.org/viewvc/struts/action2/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl?rev=413295&view=auto ============================================================================== --- struts/action2/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl (added) +++ struts/action2/trunk/apps/showcase/src/main/resources/myTemplateDir/myTheme/myAnotherTemplate.ftl Sat Jun 10 06:34:22 2006 @@ -0,0 +1,6 @@ +<div style="background-color:yellow;"> +<p> +Freemarker Custom Template - +parameter 'paramName' - ${parameters.paramName} +</p> +</div> Modified: struts/action2/trunk/apps/showcase/src/main/webapp/WEB-INF/classes/xwork-tags-ui.xml URL: http://svn.apache.org/viewvc/struts/action2/trunk/apps/showcase/src/main/webapp/WEB-INF/classes/xwork-tags-ui.xml?rev=413295&r1=413294&r2=413295&view=diff ============================================================================== --- struts/action2/trunk/apps/showcase/src/main/webapp/WEB-INF/classes/xwork-tags-ui.xml (original) +++ struts/action2/trunk/apps/showcase/src/main/webapp/WEB-INF/classes/xwork-tags-ui.xml Sat Jun 10 06:34:22 2006 @@ -50,6 +50,11 @@ <!-- END SNIPPET: treeExampleDynamicXWorkXml --> + + <action name="showComponentTagExampleCode"> + <result type="plaintext">/tags/ui/componentTagExample.jsp</result> + </action> + </package> <!-- START SNIPPET: treeExampleXWorkXml --> Added: struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl URL: http://svn.apache.org/viewvc/struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl?rev=413295&view=auto ============================================================================== --- struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl (added) +++ struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/ftlCustomTemplate.ftl Sat Jun 10 06:34:22 2006 @@ -0,0 +1,7 @@ +<div style="background-color:yellow;"> +<p> +Freemarker Custom Template - +parameter 'paramName' - ${parameters.paramName} +</p> +</div> + Added: struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp URL: http://svn.apache.org/viewvc/struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp?rev=413295&view=auto ============================================================================== --- struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp (added) +++ struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp Sat Jun 10 06:34:22 2006 @@ -0,0 +1,8 @@ +<[EMAIL PROTECTED] prefix="saf" uri="/struts-action" %> + +<div style="background-color:yellow;"> +<p> +JSP Custom Template - +parameter 'paramName' - <saf:property value="%{top.parameters.paramName}" /> +</p> +</div> Propchange: struts/action2/trunk/apps/showcase/src/main/webapp/customTemplateDir/customTheme/jspCustomTemplate.jsp ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp URL: http://svn.apache.org/viewvc/struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp?rev=413295&view=auto ============================================================================== --- struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp (added) +++ struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp Sat Jun 10 06:34:22 2006 @@ -0,0 +1,62 @@ +<[EMAIL PROTECTED] prefix="saf" uri="/struts-action" %> + +<html> +<head> +<title>Showcase - Tags - UI Tags - Component Tag</title> +</head> +<body> + +This example tries to demonstrates the usage of <saf:component ... > tag. +<p/> + +To have a look at the source of this jsp page click +<saf:url id="url" action="showComponentTagExampleCode" namespace="/tags/ui"/> +<saf:a href="%{#url}">here</saf:a> +<p/> + +<b>Example 1:</b> +This example load the template from the webapp context path using +the default (ftl) as its template. + <saf:component + theme="customTheme" + templateDir="customTemplateDir" + template="ftlCustomTemplate"> + <saf:param name="paramName" value="%{'paramValue1'}" /> + </saf:component> +<p/> + +<b>Example 2:</b> +This example load the template from the webapp context path using +jsp as its template (notice the *.jsp extension to the template). + <saf:component + theme="customTheme" + templateDir="customTemplateDir" + template="jspCustomTemplate.jsp"> + <saf:param name="paramName" value="%{'paramValue2'}" /> + </saf:component> +<p/> + +<b>Example 3</b> +This example load the template from the webapp context path, +using the default template directory and theme (default to +'template' and 'xhtml' respectively) + <saf:component template="mytemplate.jsp"> + <saf:param name="paramName" value="%{'paramValue3'}" /> + </saf:component> +<p/> + + +<b>Example 4</b> +This example load the template from the webapp classpath using +a custom themplate directory and theme. + <saf:component + theme="myTheme" + templateDir="myTemplateDir" + template="myAnotherTemplate"> + <saf:param name="paramName" value="%{'paramValue4'}" /> + </saf:component> +<p/> + +</body> +</html> + Propchange: struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/componentTagExample.jsp ------------------------------------------------------------------------------ svn:eol-style = native Modified: struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp URL: http://svn.apache.org/viewvc/struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp?rev=413295&r1=413294&r2=413295&view=diff ============================================================================== --- struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp (original) +++ struts/action2/trunk/apps/showcase/src/main/webapp/tags/ui/index.jsp Sat Jun 10 06:34:22 2006 @@ -14,6 +14,7 @@ <li><saf:url id="url" namespace="/tags/ui" action="lotsOfRichtexteditor" method="input" /><saf:a href="%{url}">Rich Text Editor UI Example</saf:a></li> <li><saf:url id="url" namespace="/tags/ui" value="treeExampleStatic.jsp" /><saf:a href="%{url}">Tree Example (static)</saf:a> <li><saf:url id="url" namespace="/tags/ui" action="showDynamicTreeAction"/><saf:a href="%{url}">Tree Example (dynamic)</saf:a> + <li><saf:url id="url" value="componentTagExample.jsp"/><saf:a href="%{#url}">Component Tag Example</saf:a> <%--li><saf:url id="url" namespace="/tags/ui" action="populateUsingIterator" method="input" /><saf:a href="%{url}">UI population using iterator tag</saf:a></li--%> </ul> </body> Added: struts/action2/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp URL: http://svn.apache.org/viewvc/struts/action2/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp?rev=413295&view=auto ============================================================================== --- struts/action2/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp (added) +++ struts/action2/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp Sat Jun 10 06:34:22 2006 @@ -0,0 +1,9 @@ + +<[EMAIL PROTECTED] prefix="saf" uri="/struts-action" %> + +<div style="background-color:yellow;"> +<p> +JSP Custom Template - +parameter 'paramName' - <saf:property value="%{parameters.paramName}" /> +</p> +</div> Propchange: struts/action2/trunk/apps/showcase/src/main/webapp/template/xhtml/mytemplate.jsp ------------------------------------------------------------------------------ svn:eol-style = native