【问题标题】:Can Struts1 tags be used in Velocity templates in Struts1?Struts1 标签可以用在 Struts1 的 Velocity 模板中吗?
【发布时间】:2016-09-29 14:56:09
【问题描述】:

不幸的是,我需要在旧的 Struts1 应用程序中注入新功能。当前视图使用 Velocity 模板,但是我没有看到任何使用的 struts 标签。我也知道在 Struts2 中,可以在 Freemarker 和/或 Velocity 模板中使用 Struts 标签。

例如,在 Struts2 应用程序中,on 可以在 Velocity 模板中执行以下操作(而不是使用 JSP 标签库):

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

Struts1 中是否存在这种类型的集成?有没有办法在 Velocity 模板中使用 Struts1 标签,还是需要对将 Velocity 集成到 Struts1 的方式进行重大改造?

【问题讨论】:

    标签: velocity struts-1


    【解决方案1】:

    Velocity 模板中没有直接使用 Struts 1 标签,但提供了允许并行功能的附加工具,例如来自http://velocity.apache.org/tools/devel/struts.html

    VelocityStruts 包括 GenericTools 和 VelocityView 并添加了用于 Struts 1.x 应用程序的工具。这些工具与关键的 Struts 标签库的功能相匹配,并提供对 Struts 资源、消息、图块、验证功能等的访问。

    这会让你至少部分到达那里。

    【讨论】:

    • 实际上我第一次读错了你的帖子。感谢您指出 VelocityStruts 包。我会更仔细地看一下。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-05
    • 2014-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多