Eclipse IDE 2022-06, how to change template when create new JSP file?

252 Views Asked by At

I am using Eclipse IDE 2022-06 , Java/JDK 1.6, Windows 10 pro x64, Spring 2.5.6 .

enter image description here

I need encoding UTF-8 by default, not ISO-8859-1. I don't want edit many files, many time manually. How to change template when create new JSP file?

2

There are 2 best solutions below

0
howlger On

In the New JSP File dialog click Next

  • to choose a template or
  • click the JSP Templates link to go to the preferences Web > JSP Files > Editor > Templates where you can change the template for JSP.

By default, in the JSP templates the variable ${encoding} is used which can be configured in the preferences Web > JSP Files.

enter image description here

enter image description here

sample result

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

</body>
</html>
0
user-jose garcia-2384656 On

If you are working in a Dynamic Web Project in eclipse IDE for web development, then click the "Window" menu tab, then "Preferences", then the Preferences window comes up, then in the navigation column (left), click "Web" > "Editor" > "Templates". Then, click on the the "New" template you want to change and click the "Edit" button. The window that allows you to change the tags comes up. Make the changes, then click OK, and then click "Apply and Close" and it's done. enter image description here