stackjc
stackjc

Reputation: 25

Struts2 custom tag/template

I'm in a struts project. I wanted to create reusable custom tags. So heres the thing, for example i have this set of struts UI tags:

<s:form action="some.action" namespace="/somenamespace">
    <s:textfield name="username" label="Username"/>
    <s:textfield name="pwd" label="Password" />
    <s:submit value="login"/>
</s:form>

Is it possible to come up with something like this to produce the same output instead of the code above:

<mycustomtag:login />

Upvotes: 2

Views: 3310

Answers (2)

VolkerK
VolkerK

Reputation: 1510

You can do this using tag-files.

Here are some links:

Upvotes: 1

Johannes
Johannes

Reputation: 2070

You can use the tag for this. An other way are Templates or creating your own custom Struts2 Tag Lib like other Plugins (jQuery/Bootstrap).

Upvotes: 1

Related Questions