티스토리 뷰
728x90
반응형
유즈빈 액션 태그(useBean Action Tag) & 표현 언어(Expression Language)
// isELIgnored 설정.
<%@ page ... isELIgnored="false" %>
<jsp:useBean id="member" class="package.name.MemberBean" />
<jsp:setProperty name="member" property="*" />
// <%= memb
er.getName() %>
${ member.name }
유즈빈 액션 태그(useBean Action Tag) & Collection 객체
// isELIgnored 설정.
<%@ page ... isELIgnored="false" %>
<jsp:useBean id="member" class="package.name.MemberBean" />
<jsp:setProperty name="member" property="*" />
<jsp:useBean id="memberList" class="java.util.ArrayList" />
<%
MemberBean memberBean = new MemberBean("name", "id");
memberList.add(memberBean);
%>
${ memberList[0].name }
${ memberList[0].id }
유즈빈 액션 태그(useBean Action Tag) & HashMap
// isELIgnored 설정.
<%@ page ... isELIgnored="false" %>
<jsp:useBean id="member" class="package.name.MemberBean" />
<jsp:setProperty name="member" property="*" />
<jsp:useBean id="memberHashMap" class="java.util.HashMap" />
<%
memberHashMap.put("name", "value");
memberHashMap.put("id", "value");
%>
${ memberHashMap.name }
${ memberHashMap.id }
<jsp:useBean id="memberList" class="java.util.ArrayList" />
<%
MemberBean memberBean = new MemberBean();
memberBean.setName("value");
memberBean.setId("id");
memberList.add(memberBean);
memberHashMap.put("memberList", memberList);
%>
${ memberHashMap.memberList[0].name }
${ memberHashMap.memberList[0].id }
유즈빈 액션 태그(useBean Action Tag) & Has-a
// isELIgnored 설정.
<%@ page isELIgnored="false" %>
<jsp:useBean id="memberBean" class="package.MemberBean" />
<jsp:useBean id="memberAddressBean" class="package.MemberAddressBean" />
<jsp:setProperty name="memberAddressBean" property="city" value="인천" />
<jsp:setProperty name="memberAddressBean" property="zipCode" value="1212" />
<%
memberBean.setMemberAddress(memberAddressBean);
%>
// <%= memberBean.getMemberAddress().getCity() %>
${ memberBean.memberAddressBean.city }
유즈빈 액션 태그(useBean Action Tag)
<jsp:useBean id="memberBean" class="jspMemberSearch.ex1.MemberBean" scope="page" />
<%
request.setCharacterEncoding("utf-8");
memberBean.setName("name34");
memberBean.setId("id3434");
MemberDAO memberDAO = new MemberDAO();
memberDAO.addMember(memberBean);
%>
// scope
// scope = page OR request OR session OR application
셋프로퍼티 액션 태그(setProperty Action Tag)
<jsp:useBean id="memberBean" class="jspMemberSearch.ex1.MemberBean" scope="page" />
<jsp:setProperty name="memberBean" property="name" value='<%= request.getParameter("name") %>' />
<jsp:setProperty name="memberBean" property="id" value='<%= request.getParameter("id") %>' />
<%
request.setCharacterEncoding("utf-8");
MemberDAO memberDAO = new MemberDAO();
memberDAO.addMember(memberBean);
List<MemberVO> memberList = memberDAO.memberList("");
%>
<form name="formName" action="memberAdd.jsp" method="post">
<input type="text" name="name">
<input type="text" name="id">
<br>
<input type="submit" value="Data Send">
</form>
<jsp:useBean id="memberBean" class="jspMemberSearch.ex1.MemberBean" scope="page" />
<jsp:setProperty name="memberBean" property="name" />
<jsp:setProperty name="memberBean" property="id" />
// Html Tag: name 과 property: name 동일할 경우 자동으로 값이 바인딩된다.
<form name="formName" action="memberAdd.jsp" method="post">
<input type="text" name="name">
<input type="text" name="id">
<br>
<input type="submit" value="Data Send">
</form>
<jsp:useBean id="memberBean" class="jspMemberSearch.ex1.MemberBean" scope="page" />
<jsp:setProperty name="memberBean" property="*" />
// Html Tag: name 과 property: name 동일할 경우 자동으로 값이 바인딩된다.
겟프로포터 액션 태그(getProperty Action Tag)
<form name="formName" action="memberAdd.jsp" method="post">
<input type="text" name="name">
<input type="text" name="id">
<br>
<input type="submit" value="Data Send">
</form>
<jsp:useBean id="memberBean" class="jspMemberSearch.ex1.MemberBean" scope="page" />
<jsp:setProperty name="memberBean" property="*" />
<p>input value = <jsp:getProperty name="memberBean" property="name" /></p>
<p>input value = <jsp:getProperty name="memberBean" property="id" /></p>
추가 관련 글
표현 식(Expression Tag) VS 표현 언어(Expression Language)
표현 언어(Expression Language)-param 객체
표현 언어(Expression Language)-requstScope, sessionScope, applicationScope
728x90
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 표현 언어(expression language)
- await
- 진수 변환
- 특정 문자를 기준으로 자르기
- nl2br
- 제품 등록
- React
- jstl(java standard tag library)
- 문자 자르기
- jstl(java standard tag library)-core
- 람다식(lambda expression)
- 메이븐(maven)
- System.Diagnostics
- 스프링 시큐리티(spring security)
- java-개발 환경 설정하기
- .submit()
- 스프링 시큐리티(spring security)-http basic 인증
- java.sql
- system.io
- java 키워드 정리
- REST API
- In App Purchase
- java web-mvc
- 스프링 프레임워크(spring framework)
- jsp 오픈 소스
- MainActor
- 스프링 프레임워크(spring framewordk)
- error-java
- 인텔리제이(intellij)
- 상품 등록
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함