How load servlet on index.jsp -


is there way call servlet on index.jsp? welcome file index.jsp. need populate dropdown list values servlet when index.jsp opened.

i tried set <load-on-startup> in web.xml, didn't have effect. how welcome file index.jsp call servlet?

just change welcome file url 1 of servlet.

given servlet mapping,

<servlet-mapping>     <servlet-name>indexservlet</servlet-name>     <url-pattern>/index</url-pattern> </servlet-mapping> 

just have welcome file list:

<welcome-file-list>     <welcome-file>index</welcome-file> </welcome-file-list> 

don't forget move /index.jsp /web-inf folder prevent being accessed directly endusers guessing url (and don't forget alter forward call in index servlet point /web-inf/index.jsp).

or if solely intend have "home page servlet" , not "index servlet", map servlet empty string url pattern instead of welcome file.

<servlet-mapping>     <servlet-name>indexservlet</servlet-name>     <url-pattern></url-pattern> </servlet-mapping> 

see also:


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -