I have written a class in java that will be called from a JSP file, I already have Servlet mapping defined in the web.xml file (there is already an existing jsp project), my question is Do I have to define a new servlet mapping to point to my class.
Here is content is the web,xml file:
<servlet-name>Test</servlet-name>
<servlet-class>Test</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>ico</extension>
<mime-type>image/x-icon</mime-type>
</mime-mapping>
From JSP you can directly access the Java class(by creating instance probably). only servlets need mapping in web.xml.(All servlets must be mapped to a url) If you want a servelt to be invoked from JSP then use requestDispatcher.