Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
问题在标题中:“JSP 中是否有与 java @SuppressWarnings 等效的东西?”
是的,只需使用:
<%! @SuppressWarnings("unchecked") %>
如果您在从 JSP 生成的代码中(或在 JSP 中的内联代码中)收到警告,一种解决方案是将问题代码移到 Servlet 或实用程序类中。这样您就可以随心所欲地标记它,并且您的 JSP 中的 Java 代码更少。双赢!