1

I want to create a web application that presents some data graphically. The HTML5 canvas seems perfect for that. But I want to use Spring MVC, and thus JSP. Would that work? Can you put an HTML5 canvas in a JSP page? Does anyone have any experience of this: what are the gotchas?


Edit: In particular, I have in mind that HTML5 is not XHTML, yet JSP seems to require XHTML.

Rob
  • 5,223
  • 5
  • 41
  • 62
Raedwald
  • 46,613
  • 43
  • 151
  • 237

2 Answers2

0

You can use html5-canvas within jsp. As long as you include the html5 syntax () in jsp and the usage of canvas. It will work. Canvas works only with these browser versions. http://caniuse.com/canvas For the browsers which don't support canvas either you can use pollyfills or else the functionality wont be available. One more point - Spring MVC or anyother backend technology doesn't matter as long as you use jsp or another view which renders html to the browser. Thanks

prashanth
  • 445
  • 5
  • 14
  • "or another view which renders html to the browser": but there is no such thing as plain "HTML". HTML has multiple versions, including XHTML. All the JSP I've seen uses XHTML, which would not allow use of the `canvas` element. Are you saying you can use JSP for other than XHTML? – Raedwald Aug 03 '12 at 10:26
0

As clearly stated in an answer by BalusC to a different question, your JSP must produce well-formed XML, so you must use the "empty element syntax" for elements without content. And you should include the HTML5 DOCTYPE to prevent triggering of "quirks mode".

Community
  • 1
  • 1
Raedwald
  • 46,613
  • 43
  • 151
  • 237
  • To be sure, you aren't confusing "JSP" with "JSP Document" (which has `.jspx` extension)? You have nowhere explicitly stated "JSP Document" in your question. With regular/oldschool JSP it's of course perfectly possible to use non-well-formed HTML. – BalusC Aug 03 '12 at 13:17
  • @BalusC well, I'm a newcomer to JSP and Spring, so I *am* confusing them. – Raedwald Aug 03 '12 at 13:44