Good Afternoon Greg
here is an example of forms using freemarker templates in chat\chatLogin.ftl
<html>
<head>
<title>Showcase - Chat - Login</title>
<@s.head />
</head>
<body>
<@s.actionerror />
<@s.actionmessage />
<@s.fielderror />
<@s.form action="login" namespace="/chat" method="POST">
<@s.textfield name="name" label="Name" required="true" />
<@s.submit/>
</@s.form>
</body>
</html>
//in order for the container to render this script one needs to define the
FreemarkerPageFilter in web.xml
//here is mine (transcribed from showcase/WEB-INF/web.xml)
<!-- SNIPPET START: example.freemarker.filter.chain
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>org.apache.struts2.sitemesh.FreeMarkerPageFilter</filter-class>
</filter>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
END SNIPPET: example.freemarker.filter.chain -->
//BTW my non-xhtml (simple theme) ftl files are located in
//struts2-showcase-2.1.6\WEB-INF\classes\template\simple
//my xhtml ftl files are located on
//struts2-showcase-2.1.6\WEB-INF\classes\template\xhtml
//the location of this folder are resolved by 3 parameters defined in
/org/apache/struts2/default.properties
### Standard UI theme
### Change this to reflect which path should be used for JSP control tag
templates by default
struts.ui.theme=simple
####location of template dir
struts.ui.templateDir=template
#sets the default template type. Either ftl, vm, or jsp
struts.ui.templateSuffix=ftlthis is one solution and I am sure there other
available solutions from the group monitoring this list
Does this help?
Martin Gainty
______________________________________________
Disclaimer and Confidentiality Notice
Please be respectful of the rights of transmitter and recipient and do not
alter/modify or obstruct this transmission. Thank You
> Subject: FreeMarker Tags Help - setup
> Date: Fri, 18 Sep 2009 13:09:31 -0400
> From: [email protected]
> To: [email protected]
>
> Hello,
>
> Setup: struts2 (2.1.6) with Spring (2.5)
>
> I Refer to the article in the docs
>
> http://struts.apache.org/2.1.6/docs/freemarker-tags.html
>
> We are trying to use FreeMarker tags with a custom theme in order to
> pass extra parameters to the tag which the tag does not define (section
> of the above doc "Using inline attributes with templates")
>
> When I attempt to use the markup
>
> <@s.form action="updatePerson">
> <@s.textfield label="First name" name="firstName"
> extraParamName="blah"/>
> <@s.submit value="Update"/>
> </@s.form>
>
> The JSP does not recognize this as a tag at all; all of the above is
> printed to HTML verbatim. Is there anything I need to do, namespace
> definition, etc. to make the engine understand that I use tags and not
> literals? I understand that FreeMarker tags are extensions that are
> shipped with default Struts distro, right?
>
> Thank you very much
>
> Greg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/