Specifying Struts templates source

Say I'm using a form with a text-field.

<@s.form action="login"> <@s.textfield label="E-mail" name="email"/> <@s.submit value="send"/>

How can I specify that the text-form should be generated by a custom template (text_login.ftl) rather than the standard text.ftl?

Answers


I did it few years ago, and as I remember I did the following 1) created my own template in forlder

src/template/_theme_/_template_.ftl

theme - it is name of theme used in struts tag definition (see below). E.g. ajax (already defined and existed in Struts2 theme) template - name of your template. E.g. inline-submit:

src/template/ajax/inline-submit.ftl

2) now in jsp, when I want to show that some tag should use that template, I wrote the following:

<s:submit theme="ajax" template="submit-inline" ... />

that's all. In your case you need to write something like that:

<@s.textfield label="E-mail" name="email" theme="_DEFINE_WHERE_TEMPLATE_IS_LOCATED" template="text_login"/>

Need Your Help

Count how many times an element occurs in an array - Java

java arrays

I recently made a very simple practice program in Python, that takes user input and rolls dice. The code is: