Struts 1 Web.xml on Eclipse Step 10
For a struts application to work, you need to have a web.xml file. Create a file under your content/WEB-INF directory called web.xml. To do this, select the right mouse button on the WEB-INF folder and select create new and then file. Name the file web.xml. To open up an xml file for the first time in eclipse, you should select it with your right mouse button and select open with->text editor. If you do not open it with the text editor, it will open up in a browser.
Struts Web.xml
|
The above code should be pasted into your web.xml file.
You should already be familiar with xml. Tomcat will read the web.xml file to load certain classes needed at the startup of the server. The action is a standard servlet that is used by struts.
A servlet is a Java class that extends the capabilities of servers that can host applications using the request-response life cycle. They are commonly used to extend the applications used by Web Servers, in this case, Tomcat.
In the web.xml file you will inform Tomcat of the struts.xml file that you are using. Load-on-startup says to load the struts config file when the server starts. You also have the action *.do url pattern. This informs Tomcat that the struts actions will be followed by a .do. That is struts standard. You also have the session timeout which we have set to an hour. This means that after an hour, the user will no longer have an active session. They will have to open up another browser to start a new session. You should always have a session timeout or your system can get overloaded by users.

0 comments:
Post a Comment