aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Internationalizing JSP's in Eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Internationalizing JSP Watch "Internationalizing JSP New topic
Author

Internationalizing JSP's in Eclipse?

Tom Cunningham
Greenhorn

Joined: Dec 09, 2004
Posts: 5
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

Joined: May 26, 2003
Posts: 30944
    
158

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Tom Cunningham
Greenhorn

Joined: Dec 09, 2004
Posts: 5
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

Joined: May 26, 2003
Posts: 30944
    
158

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Internationalizing JSP's in Eclipse?