Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Localization

 
Jayaraj Jaganathan
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new to struts 2. once again thanks for your replay.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic