Frage

Vor einiger Zeit las ich einen Artikel, was erwartet wird in Servlet API 3.0. Ich erinnere mich, ich las, dass Sie einige .jsp Dateien in einem /WEB-INF/lib/somelib.jar/META-INF/web/.jsp und diese Mittel für den Kontext-Root werden ausgesetzt speichern die Web-Anwendung.

Ich habe gerade installiert tomcat7 es zu versuchen, aber ich fand keine Dokumentation, dass ich einige Web-Ressourcen in jar-Dateien einsetzen kann.

  • Ist diese Funktion existiert in Servlet API 3.0?
  • Ist diese Funktion existiert in tomcat 7.0?
  • Gibt es eine andere Art und Weise jsp-Dateien in /lib/*.jar Dateien zu haben?
War es hilfreich?

Lösung

There is a feature in servlet 3.0 that allows you to package resources (images, jsp, etc.) in a JAR file. What you do is in your jar file, you create META-INF/resources and dump anything you want in there including directories for structuring your resources. What happens is that META-INF/resources will be mapped to the docroot of your web application.

When there is a clash of resource between your app and the JAR file, your apps resource will be returned. See this

Tomcat 7 supports Servlet 3 so it should support this feature

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top