简体   繁体   中英

Can I use a JSP template without an HTTP servlet?

I want to use a template with a markup standard such as JSP to create an HTML formatted string based on data from a bean or a bean container.

Essentially, I just want a standalone service that will take a JSP formatted template and a POJO and return an HTML string.

public String generatePage(String jspFormattedString, List<Object> data){
   ..some stuff
   return htmlString;
}

Is this possible?

Thanks

Yes, it is. Use a JSP engine like GnuJSP , Apache Jakarta or Resin . There's a tutorial how to use Jasper 2 engine with an ant task to compile the JSP pages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM