Spring MVCを使って生成されたHTMLファイルを取得する方法はありますか?Spring MVC:クライアントに送信する前に、HTMLファイルを生成する方法はありますか?
@Controller
@RequestMapping(value = "/index")
public class Router {
@RequestMapping(method = RequestMethod.GET)
public String details(..., ModelMap model) throws ApplicationServiceException {
//add attribute to model, change generated html from base jsp
model.addAttribute("test", "test");
//instead of returning index.jsp (like below) ...
return "index";
//...is it possible to get index.jsp (as it's generated html file) like such:
File html = new File("index.html");
}
}
index.jspの下のコメントを参照してください:
<html>
${test}
</html>
(生成)のindex.html:< - 私は
<html>
test
</html>
をしたいファイルがあれば私に知らせてください私の記述は明確ではない、英語は私の最初の言語ではないので、私はよりよく説明しようとするだろう。ありがとう
これを行うことで何を達成しようとしていますか? HTMLにはcss、javascriptsなどのようなものがたくさん必要ですが、なぜローカルサーバーにコードをデプロイしていないのですか? –
なぜこれが必要でしょうか?ビューリゾルバにその作業をさせてください。 –
私はzipのすべての必要なjs、cssファイルとともにクライアントにhtmlファイルを送信します。それでなぜ私はそれをファイルとして必要としますか? @AmitKBist私はそれを私のローカルサーバに配備することができますが、それはどのように動作させたいのですか? – user2276831