Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Define Constants

 
gurcharan singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to define my custom constants, not finding any link on how to do it - Anyone has any insight to it.

Also, how can I upload custom settings for different installations, say, Dev and Production, with each having it's own constants/settings.

Thanks!

Gurcharan
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Custom constants for what? If you want to allow user value changes keep them in a database.

I'm not sure how this is related to Struts yet.
 
xsunil kumar
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gurcharan, This can be done if you are using Ant for building your application. Define custom values as place holders and in ant script replace these values with real one depends upon environment. Ant has its own task to replace it.

-Sunil
 
gurcharan singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Custom constants for what? If you want to allow user value changes keep them in a database.

I'm not sure how this is related to Struts yet.


This is my first app with Struts. In past I'd worked with different framework in other programming languages, like, DJango where we can define different settings files and based on our installation (Dev, Prod) we used to refer the specific settings. So I was exploring do Struts provide this kind of freedom.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general this kind of thing isn't really related to Struts itself, and would be handled via JNDI, property files, Spring, or compilation/execution properties.

If you have an example of the kinds of constants you're thinking about we might be able to help better, or direct you to a more appropriate forum.
 
gurcharan singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:In general this kind of thing isn't really related to Struts itself, and would be handled via JNDI, property files, Spring, or compilation/execution properties.

If you have an example of the kinds of constants you're thinking about we might be able to help better, or direct you to a more appropriate forum.


The settings can be - Whom to email in different mode, Don't send specific emails in dev mode, A specific set of validations need not to be performed if the installation is dev.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Custom Constant : the simple solution is Properties File[As David Suggested]
 
gurcharan singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the insight!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic