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

Access to constants

Mallika Kumar
Ranch Hand

Joined: Feb 15, 2001
Posts: 61
Hi,
This is what I want to achieve. I have few constants declared in a jsp file, which I want to make use of in a servlet. There is a way of calling a jsp file in a servlet, but I would like to know if there are other solutions to this. What if I can define an interface and implement that interface in the servlet? What are the pros and cons of this ? And what if I have a class which declares these constant vlaues, and import in into the servlet ? What are the benefits or disadvantages of doing this ?
Classes and interfaces, when changed, will need to be recompiled, and so should other dependent files too. Is there a way where we can declare constants, and if the change, they and other dependencies are recompiled as necessary ?
Any feedback will be very helpful.
Thanks.
Shama Khan
Ranch Hand

Joined: Aug 14, 2000
Posts: 185
I have few constants declared in a jsp file,

why not declare them in the servlet and access them from the jsp (if needed)

What if I can define an interface and implement that interface in the servlet? What are the pros and cons of this ? And what if I have a class which declares these constant vlaues, and import in into the servlet ? What are the benefits or disadvantages of doing this ?

I would say that's the best way to do it. And I would recompile only the files that get affected.
Shama

[This message has been edited by Shama Khan (edited March 21, 2001).]


Shama
 
jQuery in Action, 2nd edition
 
subject: Access to constants