1

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.

Amol Patil
  • 238
  • 1
  • 2
  • 7
  • sound slike you could do with a hot deploy envirnment set up and avoid using scriptlets – NimChimpsky Jan 30 '13 at 15:52
  • You're doing something wrong. [Java code doesn't belong in JSP files, but in Java classes](http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files). – BalusC Jan 31 '13 at 02:54

3 Answers3

1

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

Grim
  • 1,938
  • 10
  • 56
  • 123
  • Thanks for the suggestion I found that I was not aware of ctrl + Spacebar +Spacebar command that`s why I could not find my template as well.. thanks for detailed info.. – Amol Patil Jan 31 '13 at 06:32
0

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.

Amol Patil
  • 238
  • 1
  • 2
  • 7
-1

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

nitind
  • 19,089
  • 4
  • 34
  • 43