English 中文(简体)
Java Servlet Context
原标题:Java ServletContext
  • 时间:2010-09-29 04:20:59
  •  标签:
  • java

我有一个共同财产调查网站,而不是春天的MVC网站,它有一个汇辑网站。

在我喜欢查阅的网上xml档案中有若干种环境。

然而,我想从我的成套资料中选取一个班子,进入这些场所。

我知道,我可以把SerletContect从联合人民军转至这几类人,但我想避免这种情况,只是从我的班子上查阅网页。

这是可能的吗?

http://www.ohchr.org。

我一直在研究<代码>javax.servlet。 我想到的是我所希望的,但如果我看不到。

问题回答

Hmmm. 我假定,一旦您的网页上台,你将不改变网站。

现在,你可以做的是建立一个装饰器,装上一个单一吨级。 您可在您的网页上使用以下术语。

  <servlet>
    <description></description>
    <display-name>XMLStartUp</display-name>
    <servlet-name>XMLStartUp</servlet-name>
    <servlet-class>com.test.servlets.XMLStartUp</servlet-class>
    <init-param>
      <param-name>log4j-init-file</param-name>
      <param-value>WEB-INF/classes/log4j.properties</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>

在目录中,如果你制定<代码>上载-启动<>代码/代码>数值0,则这意味着在装上该编码时,其优先权最高。 现在,在服务器中<代码>init 方法中,读到所有像样的内分参数,并将其放入你的单子类别。

String dummy= getInitParameter("log4j-init-file");

这并非易事,可能不是一个ele切的解决办法。 我可以建议的唯一选择是,在您的WEB-INF/级名录中找到您的配置选择,即Xml或特性档案,以便你能够使用<条码>查询。

我知道,这可能是组合的重复,但海事组织的热情方式。

I really don t like classes reading from web.xml... Why do you need that? IMHO it would be easier, cleaner and by far much more manageable if you prepared a properties file and a manager class that reads from there.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签