0

One particular JSP file is now rendered in black&white when it used to be syntax colored
Other JSP files in the same project are rendered correclty.
I tried to cut portions of the code thinking of a syntax error, but it didn't change anything.

What can cause that behavior?

Edit:
Since the syntax was good and restarting Eclipse didn't help, I simply copy/pasted the code in a new file, deleted previous and renamed new to previous. Cheesy, but works.
I would still like to understand...

2
  • Check the Open With context menu on the file that opens in black and white--are you actually using the JSP Editor?
    – nitind
    Apr 24, 2013 at 20:23
  • I just tried. Open With > Text Editor shows same symptoms indeed. Not sure why Eclipse made that decision since I never used that feature before. Thanks. Apr 25, 2013 at 6:57

2 Answers 2

3

Recently I just ran into the same Issue...

Adding this:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

to my .jsp (and reopening the file) solved my problem.

And don't forget to open it in the JSP Editor

JSPEditor

Maybe you opened it in Text Editor last time?

1
  • I just had to do the second step. Sep 20, 2018 at 9:44
1

I had this problem too. Do you include taglibs?

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%

Something like this could be the error ( no > in the end ). Are you in Java EE perspective?

If nothing helps, just create a new JSP, write some valid code(so syntax highlighting is assured) and then copy paste your "black&white" code into it. If the highlighting disappears, you can be sure you have some syntax mistakes. Also the good old "restart eclipse" may also help.

1
  • I am not using tablibs. I am in Java perspective but JEE has the same issue. Copy/Paste in a new file renders correctly it has to be a file setting. Restarting Eclipse didn't help either ... Mar 20, 2013 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.