answersLogoWhite

0

How can you get the current JSP Page name?

Updated: 8/18/2019
User Avatar

Anandvijayakumar

Lvl 1
14y ago

Best Answer

Using either of the two below commands inside a JSP Scriptlet:

application.getRealPath(request.getServletPath()); or

getServletConfig().getServletContext().getRealPath(request.getServletPath());

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you get the current JSP Page name?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can a Servlet call a JSP error page?

Declare That a JSP Page Is an Error PageThe isErrorPage attribute tells the container if the current page is available to be an error page for another JSP page (the current page is the URL in another page's errorPage attribute). Ex:If this attribute is set to "true" then the variable "exception" is available to you. Otherwise (default is "false"), if you try to reference the exception, you will get a fatal error.So, when a Servlet request being forwarded to a JSP Page faces an exception/error this error page would get called.


Can I prevent the creation of a session in a JSP page?

Yes you can. Use the below line in your JSP page to accomplish it. <%@ page session="false" %>


What are the Implicit object in JSP?

The implicit objects in a JSP page are:requestresponsepageContextsessionapplicationoutconfigpage


What are the JSP lifecycle methods?

The 3 life cycle methods in a JSP page are:jspInit() - Called when the JSP page is initializedjspService() - Called everytime a request/response is received/submittedjspDestroy() - Called when the JSP is no longer required


When you forward a JSP page which built-in JSP object goes out of scope?

application


Is it possible to include a doc file in a JSP page?

Yes. You can embed spreadsheets, pdfs and word documents in a JSP Page


How many page directive can use in a single JSP?

There is no limit as such. You can use one or more Page Directives in a JSP but you cannot have duplicates


How does a JSP page handle run-time exceptions?

You can use the errorPage attribute of the page directive. If this attribute is defined in a JSP page, when a run time exception is encountered, the control will be transferred to this JSP page. This error page can access details of the Exception from the request and use it to display a logical message to the user.


What is the purpose of page directive in JSP?

The Page Directive is one of the important components of any JSP Page. It can help us define page specific properties like Buffer size or location of an error page etc A JSP page, and any files included via the include directive, can contain one or more page directives but no duplicates. The JSP container will apply all the attributes to the page. The position of these page directives is irrelevant, but it is good practice to keep them together at the top of the page. (So that we can identify them easily)


How do you create master page in jsp?

how to create a master page in java


How you can display servlet page in jsp page?

You cannot. You display JSP Pages using the help of Servlets. Servlets are of the background classes and you cannot display them


What are the built in objects in jsp?

The correct term is "JSP Implicit Objects" In any JSP Page, there are a bunch of implicit objects that are available for the programmer to use. It contains a variety of information that can be used to display stuff on the page. The following JSP Implicit Objects that are available for a programmer. • request • response • out • session • config • application • page • pageContext