I have a requirement to store a jsp in a database. I managed to store the html in the database and display using escapeHTML. The problem I had was with jsp tags. They never resolved.
I am now using Velocity Templates instead. I am busy with a proof of concept and managed to get variable substitution and the use of if statements working using Velocity.evaluate. I now have a problem using spring tags for binding as I cant get the macros to resolve. Any ideas on 开发者_StackOverflow社区what my problem could be?
    Velocity.init();
    VelocityContext context = new VelocityContext();
    String template="#springBind(\"command.firstname\") " +
    "   <input type=\"text\" size=\"50\" maxlength=\"255\" id=\"userName\"  " +
    "       name=\"${status.expression}\"  " +
    "       value=\"${status.value}\"  " +
    "   <div class=\"requiredexample\">  " +
    " e.g. username@domain.com  " +
    "   </div>  " +
    "   <div class=\"errors\">${status.errorMessage}</div>  ";
    StringWriter writer = new StringWriter();
    Velocity.evaluate(context, writer, "TemplateName", template);
    System.out.println(writer);  
In order to use Spring tags you need to have a Velocity engine configured in appropriate way. It's done by VelocityConfigurer. Perhaps you can use that class as is or check its source to perform similar configuration manually. 
Also take a look at VelocityViewResolver and VelocityView, they may contain something important for Spring tags.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论