XML formatted JSP source code

I’ve found that many developers still use the classic coding style on JSP’s, unfortunately this makes it difficult to use some common tools for validation and complicates matters when looking for improperly nested tags in the markup. Migrating the XML formatted JSP markup simplifies matters and makes it possible for developers to quickly identify many problem areas of code within the IDE.

<%@ page language="java" %> = <jsp:page.directive language="java" />

<%@ page contentType="text/html; charset=utf-8" %> = <jsp:page.directive contentType="text/html; charset=utf-8" />

<%@ page import="" %> = <jsp:page.directive import="" />

NOTE: you can combine page.directive’s to a single tag with all attributes.

<% //some scriptlet %> = <jsp:scriptlet>//some scriptlet</jsp:scriptlet>

<%! String somevalue="1"; %> = <jsp:declaration>String somevalue="1";</jsp:declaration>

<%= somevalue %> = <jsp:expression>somevalue</jsp:expression>

<jsp:include page="" />
<jsp:directive.include file="" />

<jsp:useBean id="" scope="" type="" />

<jsp:setProperty name="" />

Unfortunately, there’s one common type of tag that does not have an XML equivalent:

<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>

REFERENCES:

Happy coding