This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 100033 [details] JSP code before JSP formatter reformat After automatic format (reformat) of JSP code.jsp my code is messy.
Created attachment 100034 [details] JSP code after JSP formatter reformat JSP code after JSP formatter reformat
The issue is about formatting JSP scriptlets with nested JSP/HTML tags. Here is a simplified case extracted from the example submitted by the user: <% String p = request.getParameter("p"); if (p != null) { if (p.equals("podanie")) { %><%@ include file="index.jsp" %><% } else { %><%@ include file="index.jsp" %><% } } else { %><%@ include file="index.jsp" %><% } %> is formatted to: <% String p = request.getParameter("p"); if (p != null) { if (p.equals("podanie")) { %><%@ include file="index.jsp" %><% } else { %><%@ include file="index.jsp" %><% } } else { %><%@ include file="index.jsp" %><% } %> This admittedly looks ugly. Grryf, before the issue is solved you may want to use the JSTL conditional tags (the use use of java scriptlets in JSP is obsolete and discouraged). The code would like this: < %@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %> <c:if test="${p != null}"> <c:if test="${p == "podanie"}"> <%@ include file="index.jsp" %> </c:if> </c:if> An even better idea would be to apply the "dispatcher view" pattern, see http://java.sun.com/blueprints/corej2eepatterns/Patterns/DispatcherView.html
Tomasz, IMO this is Java problem - their formatter should be fixed.
Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/8c0331ab30b8
Integrated into 'main-golden', will be available in build *201007300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/8c0331ab30b8 User: Dusan Balek <dbalek@netbeans.org> Log: Issue #187503: JSP code formatter reformat - fixed.