Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 328313

Summary: format command in jsp file changes embedded javascript code
Product: [WebTools] JSDT Reporter: Guy Thomas <guy.thomas>
Component: WebAssignee: Ian Tewksbury <itewksbu>
Status: RESOLVED WORKSFORME QA Contact: Nitin Dahyabhai <thatnitind>
Severity: major    
Priority: P3 CC: amj87.iitr, cmjaun, nsand.dev
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Guy Thomas CLA 2010-10-21 02:10:44 EDT
Build Identifier: 20100218-1602

This is the head of the jsp file in which the bug occurs.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Domain Security Administrator: Pas gebruiker aan</title>
<link href="<c:url value="/css/domainsecurityadmin.css"/>" rel="stylesheet" type="text/css">
<script src="<c:url value="/js/util.js"/>" type="text/javascript"></script>
<script src="<c:url value="/js/domainsecurityadmin.js"/>" type="text/javascript"></script>
<script src="<c:url value="/js/jquery-1.4.3.js"/>" type="text/javascript"></script>
<script>
    $(function() {
        $("#changepwtrigger")[0].onclick = function(event) {
      $("#changepwtd").empty().append('<table>')
            .append ('<tr>').append('<td>nieuw paswoord</td>')
            .append ('<td><input type="password" size="30" name="password" id="password"/></td>').append('</tr>')
            .append ('<tr>').append('<td>bevestig nieuw paswoord</td>')
            .append ('<td><input type="password" size="30" name="passwordConfirmed" id="passwordConfirmed"/></td>').append('</tr>')
            .append ('<tr><td>')
            .append ('<input type="submit" id="changepwsubmit" name="action:userchangePassword" value="Bewaar nieuw paswoord" class="button"/>')
            .append ('</td></tr>')
            .append ('</table>');
        };
    });
</script>
</head>
<body>
...

When running the format command the embedded javascript is converted to the following:

<script>
	$(function() {
		$("#changepwtrigger")[0].onclick = function(event) {
			$("#changepwtd")
					.empty()
					.append('__tag_17$39_')
					.append('__tag_18$22_')
					.append('__tag_18$37_nieuw paswoord__tag_18$55_')
					.append(
							'__tag_19$22_<input type="password" size="30" name="password" id="password"/>__tag_19$90_')
					.append('__tag_19$106_')
					.append('__tag_20$22_')
					.append('__tag_20$37_bevestig nieuw paswoord__tag_20$64_')
					.append(
							'__tag_21$22_<input type="password" size="30" name="passwordConfirmed" id="passwordConfirmed"/>__tag_21$108_')
					.append('__tag_21$124_').append('__tag_22$22_<td>').append(
							'__tag_23$22_').append('__tag_24$22_</tr>').append(
							'__tag_25$22_');
		};
</script>

Reproducible: Always
Comment 1 Ayushman Jain CLA 2010-10-21 02:54:46 EDT
Moving to JSDT
Comment 2 Ayushman Jain CLA 2010-10-21 03:01:55 EDT
Oops! Wrong place. Moving to WTP instead.
Comment 3 Chris Jaun CLA 2010-11-09 11:57:16 EST
Pretty sure this has been fixed in 3.2.3. Ian can you verify?
Comment 4 Ian Tewksbury CLA 2010-11-09 12:01:41 EST
(In reply to comment #3)
> Pretty sure this has been fixed in 3.2.3. Ian can you verify?

Yes I fixed that in 3.2.3.  I just tested this specific case and it works as expected.
Comment 5 Ian Tewksbury CLA 2010-11-09 16:41:40 EST
resolving as works for me since this is working in 3.2.3