Reputation:
I want to configure eclipse so that:
My Original Code Format:
name: <input type="text" value="${event.name}" name="name" /> <br /> description: <input type="text" value="${event.description}" name="description" /> <br />eventDate:<input type="date" value="${event.eventDate}" name="resumeUrl" /><br />
My Target Code Format:
name: <input type="text" value="${event.name}" name="name" />
<br />
description:
<input type="text" value="${event.description}" name="description" />
<br />
eventDate:
<input type="date" value="${event.eventDate}" name="resumeUrl" />
<br />
I want to get 1 line = 1 tag
!
How to configure eclipse to reformat my original to target format?
Upvotes: 17
Views: 38128
Reputation: 5264
In eclipse:
From the Preferences Window choose Web => HTML Files => Editor
From the Inline Elements:
view, add all tags that you want appear in one line
Now whenever you press CTRL+SHIFT+F, the JSP will be formatted to your new style
Upvotes: 26
Reputation: 21
Maybe you can try this: Window -> Preference -> Web -> HTML Files ->Editor -> Formatting : change the "Line width" to 200 or larger
Upvotes: 2
Reputation: 1
No you can't simply format jsp(html & jsp scriplets) pages using ctrl+shift+f, if you use that keys it will make your code change the syntax, for example:
{
String error = request.getAttribute("error") != null ? (String) request.getAttribute("error"): "";%>
}
this code will change it to
{
String error = request.getAttribute("error") != null ? (String) request.getAttribute("error") : "";%>
},
after using the keys again you have to manually align this scriplets
Upvotes: -2
Reputation: 21
From eclipse Window Menu, choose Preferences
From the Preferences Window choose Web => HTML Files => Editor
Increase the
line widths and format the jsp page using ctrl+shift+F
.
Upvotes: 0
Reputation: 28513
you can use CTL+SHIFT+F
in eclipse but make sure you have opened jsp in jsp editor.
if not then go to Eclipse - window - preferences - general - editors - File Associations
and select file type as *.jsp and set JSP Editor as default
Upvotes: 0