aspose file tools*
The moose likes Struts and the fly likes Localization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Localization " Watch "Localization " New topic
Author

Localization

Jayaraj Jaganathan
Ranch Hand

Joined: Jun 29, 2009
Posts: 70
I like to place my property file in the same dir where i place jsp

say if login.jsp in common folder
i like to place it in common folder as login_en.properties

is this possible in struts 2 ?



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't think so; I think they need to be on the classpath (at least by default). Why would you want to do this, though?
Jayaraj Jaganathan
Ranch Hand

Joined: Jun 29, 2009
Posts: 70
David Newton wrote:I don't think so; I think they need to be on the classpath (at least by default). Why would you want to do this, though?




the above code works only when the page is from a action say http://localhost:9082/Template/common/showLogin.action

if i can place the properties flie in the same dir
developer can use http://localhost:9082/Template/common/login.jsp

and the configuration itself will be in the same dir and it will be easier for developing and customization

is it possible to override any struts 2 class and obtain this feature ?

thanks for your reply :)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You shouldn't be using JSPs directly in a Struts application.

I have no idea how to override the default locale support; ActionSupport I think uses a locale support provider by default and I don't know if it's overridable in a trivial way--you'd have to check yourself.

The default package- and class-based I18N support is much easier to support and refactor than what you're describing though, and in a situation like this I'd sure reconsider your choice.
Jayaraj Jaganathan
Ranch Hand

Joined: Jun 29, 2009
Posts: 70
i am new to struts 2. once again thanks for your replay.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No apologies are necessary :)

One reason to eliminate direct JSP access is that it keeps implementation details hidden: for example, if it's decided that the JSP actually *does* need an action backing, the URL exposed to the user doesn't have to change. Or if you decide to use FreeMarker for some of the pages. And so on.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Localization