[500 error] JSTL c tag 링크 에러

yoondgu·2022년 7월 27일
0

오류 기록

목록 보기
6/10
There was an unexpected error (type=Internal Server Error, status=500).
/WEB-INF/views/sample.jsp (line: [15], column: [0]) /WEB-INF/views/common/navbarsample.jsp (line: [2], column: [0]) /WEB-INF/views/common/tags.jsp (line: [2], column: [62]) The prefix [c] specified in this tag directive has been previously used by an action in file [/WEB-INF/views/sample.jsp] line [14].
org.apache.jasper.JasperException: /WEB-INF/views/sample.jsp (line: [15], column: [0]) /WEB-INF/views/common/navbarsample.jsp (line: [2], column: [0]) /WEB-INF/views/common/tags.jsp (line: [2], column: [62]) The prefix [c] specified in this tag directive has been previously used by an action in file [/WEB-INF/views/sample.jsp] line [14].

내비게이션 바를 테스트용으로 새로 만들어보려고
기존 navbar를 새 페이지에서 jstl로 include하고
c:set으로 navbar에 필요한 값을 세팅해줬는데 컨트롤러로 요청을 보냈더니 이런 에러가 났다.
정말 아무것도 없는 이 코드에..

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<title>Insert title here</title>
</head>
<body>
<c:set var="menu" value="home" />
<%@ include file="common/nav.jsp" %>
<div class="container">

</div>
</body>
</html>

알고보니 이 파일에서는 c태그 라이브러리를 불러오지 않아서 생긴 문제였다.ㄱ-..

프로젝트 내에서 각종 태그들을 불러오는 코드를 모아놓은 jsp를 include했더니 오류없이 화면을 출력할 수 있었다.

<%@ include file="common/tags.jsp" %>

nav.jsp 안에서 c태그 라이브러리를 include해놨으니 여기서는 할 필요가 없다고 착각했나보다;

0개의 댓글