Velocity string function

后端 未结 4 815
臣服心动
臣服心动 2020-12-30 19:52

I just start using Java Velocity. Now I want to create a java class template.

package $app.package_namespace
public class ${app.name}Station

{
    #foreac         


        
4条回答
  •  隐瞒了意图╮
    2020-12-30 20:37

    If you are using commons-lang you can use the StringUtils class:

    context.put("StringUtils", org.apache.commons.lang3.StringUtils.class);
    

    Then in your template:

    ...
    return  get$StringUtils.capitalize(s_attribute.name)();
    ...
    

提交回复
热议问题