Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Internationalizing JSP's in Eclipse?

 
Tom Cunningham
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use Eclipse's string externalization feature but I'm running into some problems. A lot of the strings that I want to externalize are in JSP's, and Eclipse's wizard only seems to try to handle .java files or java packages.

Is there a way to get Eclipse to do string externalization on JSP files like this? Do I need an extra plugin? I've already tried adding the Java Editor as an associated editor for the .jsp file type in Preferences->Workbench, but that doesn't seem to help much.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34401
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom,
Welcome to JavaRanch!

You are correct that Eclipse's refactorings only work in .java files.

Any JSP support requires a separate plugin like MyEclipse or Lomboz. However, plugins are unlikely to offer JSP refactoring because it is a best practice to avoid putting code in a JSP. It is preferable to put the code in a servlet (where you can refactor it using the built in IDE tools) and redirect to a JSP just for the display.
 
Tom Cunningham
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:

You are correct that Eclipse's refactorings only work in .java files.

Any JSP support requires a separate plugin like MyEclipse or Lomboz. However, plugins are unlikely to offer JSP refactoring because it is a best practice to avoid putting code in a JSP. It is preferable to put the code in a servlet (where you can refactor it using the built in IDE tools) and redirect to a JSP just for the display.


Hi Jeanne,

I'm a little confused. I'm not trying to refactor code, I'm trying to externalize strings, like a label for a checkbox or textfield or a general set of instructions - which need to be localized. The text labels are already in the JSP, which makes it difficult for me to use the Eclipse externalize strings feature, because that only works on .java files. Right now the strings are hardcoded into the JSP, but I was going to use the JSTL bundle and message tags to display the strings. Is there a better way to do this?

If there's no way to configure Eclipse to do this, I guess I'll have to do this manually.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34401
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom,
Elipse considers externalization to be a refactoring. (It's on the refactoring menu.) Technically speaking it is a refactoring because it improves the design to allow for internationalization, so they are correct.

Your approach sounds fine. There is no automatic way to go about this in JSPs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic