7

次の要件を持つ次のプロジェクトがあります。

  • 非常に使いやすい(エンドユーザーが使用することが期待されます)
  • Java ベース、プロジェクトは Spring3 で作成されます
  • テンプレートをファイルとしてではなくデータベースに保存するため、文字列ベースの読み込み (同様の提案が可能ですが)

これのトリッキーな部分は、データベースからテンプレートをロードするためのテンプレート エンジンを取得することのようです。

私は Thymeleaf の外観がとても気に入っていますが、文字列から手動でテンプレートをレンダリングする方法がわかりません - 誰か試したことがありますか?

仕事のためのより良い技術の提案は歓迎しますが、これは私の好みです。

4

2 に答える 2

0

Have you tried the UrlTemplateResolver? Maybe you could expose the templates through a REST interface so you could access the raw template via a URL. I've never tried this but seems possible. Otherwise, you would likely need to implement your own template resolver. Thymeleaf comes with servlet, file, url, and classloader template resolvers. You would basically need to write one for MongoDB.

See http://www.thymeleaf.org/apidocs/thymeleaf/2.0.17/org/thymeleaf/templateresolver/package-summary.html

于 2013-07-30T23:02:07.640 に答える