Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
JEE
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Web-Applications== A '''web application''' is a collection of servlets, jsps, html-pages, classes and other resources installed under a specific subset of the server's URL namespace such as /catalog and possibly installed via a .war file. In the case of a web application marked "distributed" in its deployment descriptor, there will be one context instance for each virtual machine. ===Deployment Descriptor=== Eine Web-Applikation wird im File '''web.xml''' beschrieben. Since JEE6 it is optional. Das root Element ist '''<web-app>'''. When the web server receives a request, it determines which servlet class to call using web.xml, which resides in the war/WEB-INF/ directory in the WAR. WEB-INF/ and web.xml are part of the servlet specification. The entries are: ====<filter>,<filter-mapping>==== Servlet-Filter bieten eine Möglichkeit, auf die Werte des Requests und der Response um eine Anfrage an eine Web-Ressource herum zuzugreifen. Dabei können mehrere Filter je nach Konfiguration eine Filterkette bilden, die der Request durchläuft. Dabei wird mittels Mapping-Regeln bestimmt, welche Filter für welche Requests zuständig sind und ggf. eine Kette bilden. Jeder Filter muss das Interface javax.servlet.Filter implementieren. <!-- first define a named filter --> <filter> <filter-name><Name></filter-name> <filter-class><Full classname></filter-class> <init-param> <param-name><Parametername></param-name> <param-value><Parametervalue</param-value> </init-param> </filter> <!-- now map this filter to a URL-pattern --> <filter-mapping> <filter-name><Name s. above></filter-name> <url-pattern>/*</url-pattern> </filter-mapping> ====<listener>==== '''<listener>''' braces the listener classes. '''<listener-class>''' contains the name of the class that responds to a Web Application event, e.g. to listen for application create/destroy events, to listen for session create/destroy events, to listen for changes to session attributes. The named classes have to implement specific interfaces: * ServletContextListener * HttpSessionListener * HttpSessionAttributeListener ====<servlet>==== Ein Servlet wird mit den folgenden Elementen beschrieben: {| border=1 cellpadding=2 cellspacing=0 |- |<servlet-name> |required | |- |<servlet-class> |required (or use <jsp-file>) |[<Packages>].<Class> |} Zur Abbildung auf eine URL dient das '''<servlet-mapping>''' mit den folgenden Elementen: {| border=1 cellpadding=2 cellspacing=0 |- |<servlet-name> |required | |- |<url-pattern> |required |/xyz/abc => nur <WebAppURL>/xyz/abc\\\\/xyz/* => alle <WebAppURL>/*\\\\*.abc => alle <WebAppURL>/*/*.abc |} ====<welcome-file-list>==== Contains a list of files to be used if no file is specified in the URL. ===WAR-Files=== A war file (web application archive) is just a jar file. The structure is: *'''\WEB-INF''' **['''[[JEE#Deployment_Descriptor|web.xml]]''' for servlet container] **['''faces-config.xml''' for [[JavaJEEJSF|JSF]]] **['''[[Seam#Components_configuration|components.xml]]''' for [[Seam]]] **['''[[Seam#Pageflow_configuration|pages.xml]]''' for [[Seam]]] **[<WarFileName>'''-ds.xml''' for JPA datasource configuration] **[other configuration files] **['''[[Axis#Create_a_web_service_for_an_existing_POJO_and_web_application|Axis Web Services Directories]]'''] for Axis Web Service Implementations] **['''\classes'''] ***[servlet and utilities classes] ***['''\META-INF'''] ****['''[[JavaJEEJPA#persistence.xml|persistence.xml]]'''] **['''\lib'''] *'''\META-INF''' *[own directories] *[own web files like html, jsp, css] ===Applet Code within a Web-Application=== An applet is executed on the client side (browser), not on the server side (servlet container). You need to place the applet class files in a location accessible from the browser, which means you have to treat them like normal files (like HTML or GIF files that you want the browser to load). Thus they need to go in the webapp directory tree, but '''not''' in the WEB-INF subdirectory. It is best to think of the set of applet class files as entirely different from the set of servlet class files. They will be loaded by different Virtual Machines, and may even have different versions of classes. It is a simple matter to configure your build environment (Ant or make) to create copies of common class files in the two different classpath directories.
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width