[질문] <form:select> selected 옵션 질문 입니다.

8,883 views
Skip to first unread message

GIL

unread,
May 19, 2011, 6:32:43 PM5/19/11
to Korea Spring User Group
안녕하세요
게시판에서 업데이트 페이지를 구현 중에 어려운 점이 있어 질문 드립니다.

<form:selectd> 를 쓸려고 하는데 selected 옵션 구현하는 방법을 알고 싶습니다.
option: 5sec, 10sec, 15sec 중에 db에 저장된 값(ex>5)을 selected되어 보여 주고 싶은데 쉽지
안네요

<form:select path="interval">
<form:option value="5" label="5sec" <c:if test='$
{list.interval==5}'>selectd</c:if>/>
<form:option value="10" label="10sec" <c:if test='$
{list.interval==10}'>selectd</c:if>/>
<form:option value="15" label="15sec" <c:if test='$
{list.interval==15}'>selectd</c:if>/>
</form:selectd>

이렇게 구현 하면 될 거 같았는데 이상하게 unterminate <form:option tag 500번 에러 뜨면서 "/>" 부
분을 인식
못하더라구요

Andrew,Ahn

unread,
May 19, 2011, 9:44:41 PM5/19/11
to ks...@googlegroups.com
아래 참고해보세요.
http://forum.springsource.org/showthread.php?85023-Rendering-the-quot-selected-quot-attribute-of-html-lt-option-gt-tag-using-spring-lt-form-options-gt-tag

전 예전에 form tag에서 selected처리는 그냥 자바스크립트단에서 처리했었습니다.
windows.onload = function {
...
form.interval.value = ${model.inteval};
...
}
대충은 이런 식이었죠.

2011/5/20 GIL <jb9...@gmail.com>:

> --
> Google 그룹스 'Korea Spring User Group' 그룹에 가입했으므로 본 메일이 전송되었습니다.
> 이 그룹에 게시하려면 ks...@googlegroups.com(으)로 이메일을 보내세요.
> 그룹에서 탈퇴하려면 ksug+uns...@googlegroups.com로 이메일을 보내주세요.
> 더 많은 옵션을 보려면 http://groups.google.com/group/ksug?hl=ko에서 그룹을 방문하세요.
>
>

--
/**
* Life is too short, Code is too long.
* I am a coder who dreams the programmer.
*
* +author Andrew <rats...@gmail.com>
* +homepage http://xinublog.tistory.com
* +twitter @ratsbomb
*/

Shin-Hyeong Song

unread,
May 19, 2011, 9:56:11 PM5/19/11
to ks...@googlegroups.com
<form:select> 태그 또는 <form:options> 태그를 써주시고..
items 리스트 내부에 일치하는 값이 있으면 자동으로 해당 값으로 selected 생성됩니다..

메일링 리스트는 처음 써보는데 이렇게 쓰는게 맞나 모르겠네요.. ^^

2011년 5월 20일 오전 7:32, GIL <jb9...@gmail.com>님의 말:

GIL

unread,
May 22, 2011, 10:24:36 AM5/22/11
to Korea Spring User Group
감사합니다.
정말 자동으로 해당 값이 select 되네요
알면 알 수록 편리하게 되어 있네요

스프링에선 binding 객체가 작성 폼이나 수정 폼에서 같다는 걸 이번에 알았어요

감사 합니다.

> > 더 많은 옵션을 보려면http://groups.google.com/group/ksug?hl=ko에서 그룹을 방문하세요.- 원본 텍스트 숨기기 -
>
> - 원본 텍스트 보기 -

Reply all
Reply to author
Forward
0 new messages