This is my code for one servlet in my web.xml file:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
Can I just copy and paste and change certain values and use that again?
SECOND QUESTION (WHICH MAY HELP ANSWER THE FIRST)
currently when i deploy my application in glassfish with this url localhost/HelloSpring I get a 404. However, when I add /home on the end like so: localhost/HelloSpring/home it goes to the correct page. I can also add /index localhost/HelloSpring/index on the end and that works correctly too. So how can I load localhost/HelloSpring/home from startup rather than having to type it in manually and thus avoiding the 404 error?
NOTE: when changing the url pattern from / to /home in the servlet mappings, fixes the /home problem but then means /index will not work
So in summary, how can I load up localhost/home from deployment and then type in index into the url /index and display the correct page?
p.s. stackoverflow would not let me type in my full address links so assume where I have said localhost it contains the port :8080 directly after