SpringMVC に次のような URL パス パターンがあります。
/person/{personId}/address/{addressId}
personId = 2 と addressId = 3 を持っています 簡単に生成する方法はありますか
/person/2/address/3
SpringMvc 内でユーティリティ メソッドを使用していますか?
SpringMVC に次のような URL パス パターンがあります。
/person/{personId}/address/{addressId}
personId = 2 と addressId = 3 を持っています 簡単に生成する方法はありますか
/person/2/address/3
SpringMvc 内でユーティリティ メソッドを使用していますか?
UriTemplateクラスを見てください。URL から独自の UriTemplate を作成し、テンプレート変数を展開できます。
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel}/bookings/{booking}");
Map<String, String> uriVariables = new HashMap<String, String>();
uriVariables.put("booking", "42");
uriVariables.put("hotel", "1");
System.out.println(template.expand(uriVariables));