Question

Eclipse Specific : content assist

Problem statement:

if I type sysout in JSP and press ctrl+spacebar then it should expand to System.out.println

Description

I am using sysout in Java for quite some time. but whenever I tried to use sysout in JSP I am getting error as content assist is not available at this location

I have also tried to insert template for JSP editor for sysout(Copied from template of Java Editor) but still I am getting same error.

Can anyone please suggest solution or any references where I can get help.

Était-ce utile?

La solution

If you love shortcuts:

syso is a shortcut for sysout

Hey, you can define a jsp-template with value

(window->preferences->web->jspfiles->editor->templates)

<%System.out.println("${cursor}");%>

So you can switch to JSP-Templates using Ctrl+Spacebar+Spacebar

Autres conseils

Java Templates are not offered in the JSP Editor. That's currently working as designed.

Interestingly I also found one more way If you turn on Snippets view(Windows-->Views-->other-->Snippets) and if I copy the statement

System.out.println();

and right click on snippets view and select paste as snippet and create snippet it also does the work only difference being if i want to include sysout I need to double click on the snippet.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top