10

The question is in the title : "Is there an equivalent to java @SuppressWarnings in JSP ?"

Vinze
  • 2,549
  • 3
  • 22
  • 23

2 Answers2

29

Yes, just use:

<%! @SuppressWarnings("unchecked") %>
sth
  • 222,467
  • 53
  • 283
  • 367
Brett
  • 322
  • 3
  • 3
  • 1
    This does actually work. I've no idea why it was down voted. I just tried it and I no longer have those obnoxious warnings. – Ethan Reesor Jun 13 '12 at 16:29
2

If you are getting warnings in the code generated from a JSP (or in in-line code in a JSP), one solution is to move the problem code into a Servlet or into a utility class. That way you can mark it up to your heart's content, and your JSP has less Java code in it. Win-win!

Eddie
  • 53,828
  • 22
  • 125
  • 145
  • 1
    That's what I intended to do in the first place, but I asked the question by curiosity... – Vinze Jan 28 '09 at 16:16
  • 1
    This does not really answer the question. Of course you're right, but does not help for this question. – creativeby Mar 03 '14 at 16:26