• Post Reply Bookmark Topic Watch Topic
  • New Topic

Configuring a jsp page in web.xml

 
Prashanth Chandra
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to configure a JSP page in web.xml. But the application falis to reload or start. The configuration in web.xml is as below

<servlet>
<servlet-name>Test</servlet-name>
<jsp-file>/test.jsp</jsp-file>
</servlet>

<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/testing.jsp</url-pattern>
</servlet-mapping>

Thanks in advance
Prashanth
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems fine. What error do you get ? Please post the whole trace.
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have to configure jsp files in the web.xml file? I thought it was only for servlets. Have you tried not doing this and just calling for the file directly. Like http://server:8080/webapp/test.jsp
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jaime Tovar:
Do you have to configure jsp files in the web.xml file?


Only if you want to give them an alternative mapping. (Seems rather silly to me. In a proper Model 2 application, the JSP names are never exposed anyways).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:


Only if you want to give them an alternative mapping.....


It is also necessary if you want to set servlet init params for a particular JSP in web.xml or if you want the JSP to be loaded on startup. In short, if you want to use the deployment descriptor (web.xml) for any JSP configuration, you will need to configure the JSP file as a servlet.



(Seems rather silly to me. In a proper Model 2 application, the JSP names are never exposed anyways)

Agreed, none of these issues are relevant in a proper MVC app.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!