Springフレームワーク

Springã¨ã¯ï¼Ÿ

Java用汎用アプリケーションフレームワーク
・DI機能
・Webアプリケーションã ã‘ã§ã¯ãªãã€ãƒ‡ã‚¹ã‚¯ãƒˆãƒƒãƒ—アプリケーション等ã®é–‹ç™ºã§ã‚‚使ãˆã‚‹
・多ãã®ã‚ªãƒ¼ãƒ—ンソースライブラリã¨ã®é€£æºãŒå¯èƒ½
ç­‰ã®ç‰¹å¾´ãŒã‚る。

ãƒ—ãƒ­ã‚¸ã‚§ã‚¯ãƒˆä½œæˆæ–¹æ³•

MVC

spring1
spring2
テンプレート:「Spring MVC Projectã€ã‚’é¸æŠž
spring3
デフォルトã§ãƒ“ューã¨ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ©ãŒä½œæˆã•れる。

アノテーション

@Controller

Controllerã®å½¹å‰²ã¨ãªã‚‹ã‚¯ãƒ©ã‚¹ã«ä»˜ä¸Ž
コントローラã§ã‚る事を定義

@RequestMapping

リクエストã¨ãƒ¡ã‚½ãƒƒãƒ‰ã‚’ç´ä»˜ã‘ã‚‹
@RequestMapping(value = "/test")
public String index() {
 URLï¼testã¸ã®ãƒªã‚¯ã‚¨ã‚¹ãƒˆã‚’処ç†
 return "test";
}
@RequestMapping(value = {"/test", method = RequestMethod.POST)
public String index() {
 URLï¼testã¸ã®POSTリクエストを処ç†
 return "test";
}
@RequestMapping(value = {"/login/{" + Constants.UUID_KEY + "}"}, method = RequestMethod.POST)
public String index() {
 URLï¼testã¸ã®POSTリクエストを処ç†
 return "test";
}
@Controller
@RequestMapping(value = "/login")
public class LoginController {
 @RequestMapping(value = "/test1")
 public String index() {
  URLï¼login/test1ã¸ã®ãƒªã‚¯ã‚¨ã‚¹ãƒˆã‚’処ç†
  return "test1";
 }
 @RequestMapping(value = "/test2")
 public String index() {
  URLï¼login/test2ã¸ã®ãƒªã‚¯ã‚¨ã‚¹ãƒˆã‚’処ç†
  return "test2";
 }
}

ã‚¿ã‚°

if

<%
session.setAttribute("count","15");
%>
<c:if test="${count >= 10}" >
 ~
</c:if>

choose when

<%
session.setAttribute("count","15");
%>
<c:choose>
 <c:when test = "${count >= 10}">
  ~
 </c:when>
 <c:otherwise>
  ~
 </c:otherwise>
</c:choose>

Follow me!