Which Java MVC frameworks integrate easily with StringTemplate? -


It's hard to see that StringTemplate subtly (or not) most Java Web MVC Framework

Which Java MVC framework is easily integrated with StringTemplate?

A good answer:

  • Includes some useful and applicable links , such as :
    • A < document ,
    • or document ,
    • or source code reference:
        Li> free ,
      • and Open source or public domain .

    readers / voters , please vote for the resolution if you know it's true And is great.

    In the scope of this question, I am not interested in any other templateing engine compared to string template .

I got StringTemplate to work with Spring Basically, it was a custom view of all.

But first, a disclaimer: this is an experimental hack that I have never used it in the production code, and before that there may be some improvement. I think it is enough to answer your question how easily the string template is integrated with the web MVC framework, though.

References:

StringTemplateView.java:

  Import java.io.PrintWriter; Import java.util.Map; Import javax.servlet.http.HttpServletRequest; Import javax.servlet.http.HttpServletResponse; Import org.antlr.stringtemplate.StringTemplate; Import org.antlr.stringtemplate.StringTemplateGroup; Import org.springframework.core.io.Resource; Import org.springframework.web.servlet.view.InternalResourceView; Public class StringTemplateView internal ReSourceView {@Override protected void Rendermrgdoptputmodel (Map model, Actiteepisrwlet request), that throws the exception it throws an exception provided {// .st file referencing spring resource descriptor resource Templetfail = getApplicationContext (). GetResource (getUrl ()); // Type of redundant ... StringTemplate Group Group = New StringTemplate Group ("Group", Template FileGetFile (.) GetParent ()); String Template Template = Group.Justinofffone (getBeanName ()); Template.setAttributes (model); // Client Print Out Author Author = response.getWriter (); Author.print (template); Writer.flush (); Writer.close (); }}  

and an example visual resolver definition:

  & lt; Bean id = "viewResolver" class = "org.springframework.web.servlet.view .internalResourceViewResolver" & gt; & Lt; Property Name = "View Class" Value = "myapp.web.view.StringTemplateView" /> & Lt; Property Name = "Prefix" Value = "/ Web-ANF / St-Marriage /" /> & Lt; Property name = "suffix" value = ".st" /> & Lt; / Bean & gt;  

Comments