Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

모든 페이지에서 데이터가 뿌려지지 않는 문제 #14

Closed
Anna-Jin opened this issue Mar 22, 2022 · 1 comment
Closed

모든 페이지에서 데이터가 뿌려지지 않는 문제 #14

Anna-Jin opened this issue Mar 22, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Anna-Jin
Copy link
Owner

pet 데이터를 가져와서 gnb에 뿌리려면 어떻게 해야하지?

@Anna-Jin Anna-Jin added the documentation Improvements or additions to documentation label Mar 22, 2022
@Anna-Jin Anna-Jin self-assigned this Mar 22, 2022
Anna-Jin pushed a commit that referenced this issue Mar 22, 2022
Anna-Jin pushed a commit that referenced this issue Mar 26, 2022
Anna-Jin pushed a commit that referenced this issue Mar 27, 2022
@Anna-Jin
Copy link
Owner Author

해결

petId와 petName을 배열이나 리스트가 아닌 string으로 담아서 session에 저장한 후 jsp에서 split함수를 이용해 뿌렸다.

petId = "1,2,3";
petName = "고양이, 빵이";

<c:set var="petIdArr" value="${fn:split(petIdArr, ',')}" />
<c:set var="petNameArr" value="${fn:split(petNameArr, ',')}" />
<c:forEach items="${petIdArr}" var="petId" varStatus="status">
	<c:set var="petName" value="${petNameArr[status.index]}" />
	<li class="mypet-nav">
		<a class="pet-nav d-block" href="/mypet/${petId}">
			> ${petName}
		</a>
	</li>
</c:forEach>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant