Search code examples
velocitystruts-1

Can Struts1 tags be used in Velocity templates in Struts1?


Unfortunately, I have the need to inject new functionality in an old Struts1 application. The current view is using Velocity templates, however I do not see any struts tags in use. I also know that in Struts2, there is the ability to use Struts tags in Freemarker and/or Velocity templates.

For instance, in a Struts2 application, on can do the following in Velocity templates (instead of using the JSP tag lib):

#sform ("action=updatePerson")
    #stextfield ("label=First name" "name=firstName")
    #ssubmit ("value=Update")
#end

Did this type of integration exist in Struts1? Is there a way to use Struts1 tags in Velocity templates, or does that require some significant overhaul of the way that velocity is integrated into Struts1?


Solution

  • There's no direct use of Struts 1 tags in Velocity templates, but additional tools are provided that allow parallel funtionality, e.g., from http://velocity.apache.org/tools/devel/struts.html:

    VelocityStruts includes both the GenericTools and VelocityView and adds tools for use in Struts 1.x applications. These tools match the functions of the key Struts taglibs and provide access to Struts resources, messages, tiles, validation functions and more.

    This will get you at least part-way there.