Jump to content

Constants?


davej

Recommended Posts

If you have several JSP pages or servlets that need the same bit of information, such as a filepath, how do you handle that? I realize globals are generally frowned upon, so what is usually done? Thanks.

Link to comment
Share on other sites

To answer my own question -- it looks like these can go in the web.xml file. Servlets can retrieve constants defined using the <context-param> tag using the call context.getInitParameter(). I don't know if JSP's can also access these items with a scriptlet. There is also a <init-param> tag.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...