The picture above showing Servlet and JSP as separate entity |
http://< ip >:< port >/< project >/< path >The Servlet object will be initialize and do its job. This is how we should instruct the servlet to do its job in the web.xml.
< servlet >When someone enter http://< ip >:< port >/MyPath. MyServlet object will get execute, and process client's request in doGet() function. In doGet(), the JSP Page will get forward using following code:
< servlet-name >My Servlet< /servlet-name >
< servlet-class >org.huahsin68.MyServlet< /servlet-class >
< /servlet >
< servlet-mapping >
< servlet-name>My Servlet< /servlet-name >
< url-pattern>/MyPath/*< /url-pattern>
< /servlet-mapping >
req.getRequestDispatcher("/thePage.jsp").forward(req, res);
So, is this basic enough?
No comments:
Post a Comment