Question What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher()? (JSP)
Answer request.getRequestDispatcher(path): In order to create it we need to give the relative path of the resource
context.getRequestDispatcher(path): In order to create it we need to give the absolute path of the resource.
Question How to pass information from JSP to included JSP? (JSP)
Answer Using <%jsp:param> tag.
Question What is the difference between directive include and jsp include? (JSP)
Answer <%@ include> : Used to include static resources during translation time.
: Used to include dynamic content or static content during runtime.
Question What is the difference between RequestDispatcher and sendRedirect? (JSP)
Answer RequestDispatcher: server-side redirect with request and response objects.
sendRedirect : Client-side redirect with new request and response objects.
Question How does JSP handle runtime exceptions? (JSP)
Answer Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting of a JSP.
Question How do you delete a Cookie within a JSP? (JSP)
Answer
Cookie mycook = new Cookie("name","value");
response.addCookie(mycook);
Cookie killmycook = new Cookie("mycook","value");
killmycook.setMaxAge(0);
killmycook.setPath("/");
killmycook.addCookie(killmycook);
Question How do I mix JSP and SSI #include? (JSP)
Answer If you're just including raw HTML, use the #include directive as usual inside your .jsp file.
But it's a little trickier if you want the server to evaluate any JSP code that's inside the included file. Ronel Sumibcay (ronel@LIVESOFTWARE.COM) says: If your data.inc file contains jsp code you will have to use
<%@ vinclude="data.inc" %>
The is used for including non-JSP files.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment