This commit is contained in:
Zzzz
2026-04-28 20:15:47 +08:00
parent 0face72b8d
commit d0e71f2aa9
12 changed files with 206 additions and 145 deletions
+15 -2
View File
@@ -18,8 +18,8 @@ the reusable UI units.
sidebar, footer, pagination, and message banners.
- Use `.jspf` includes for the current JSP presentation layer. The authenticated
application frame lives in `src/main/webapp/WEB-INF/jsp/common/header.jspf`
and owns the dark sidebar, top utility bar, role workbench links, module
navigation, global search, user display, and logout link.
and owns the dark sidebar, top utility bar, module navigation, global search,
user display, and logout link.
- Any `.jspf` fragment that contains user-visible Simplified Chinese text must
declare `<%@ page pageEncoding="UTF-8" %>` at the top. Do not rely only on the
including JSP page or response `Content-Type`; Tomcat/Jasper can otherwise
@@ -31,6 +31,19 @@ the reusable UI units.
links stay inside `sessionScope.userRole == 'administrator'`; staff links stay
inside `administrator or librarian`; reader-only links stay inside
`sessionScope.userRole == 'reader'`.
- For active navigation in forwarded JSPs, derive the current location from the
public Servlet path before falling back to the JSP servlet path. Use exact
matches or slash-delimited prefixes; do not use broad `fn:contains` checks
against `requestURI`, because forwarded pages expose `/WEB-INF/jsp/...` paths
and can activate unrelated sidebar items.
```jsp
<c:set var="currentPath" value="${requestScope['javax.servlet.forward.servlet_path']}" />
<c:if test="${empty currentPath}">
<c:set var="currentPath" value="${pageContext.request.servletPath}" />
</c:if>
<a class="${(currentPath == '/books' or fn:startsWith(currentPath, '/books/')) ? 'is-active' : ''}">
```
- Keep fragments presentation-focused. They should not open database
connections or call DAOs.