• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting object through context-param

 
vivek ja
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I set a value in <context-param>? if so
In <param-value> How can I set an Address object that contains streetaddress, apt #, city, etc.,

Thank you!
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, there is no way to do it.
Put in your <context-param> name-value pairs where values are: streetaddress, apt #, city, etc., . In the init() method of your servlet or in the ServletContextListener's contextInitialized you can get that values, create an Address object, set the values to it's fields and put this object as attribute in context scope (context.setAttribute(String name, String value)).

Hope it helps
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!