Found 177 Articles for JSP

What is a page object in JSP?

Chandu yadav
Updated on 30-Jul-2019 22:30:25

266 Views

This object is an actual reference to the instance of the page. It can be thought of as an object that represents the entire JSP page.The page object is really a direct synonym for the this object.

How to write an if-else statement in a JSP page?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

12K+ Views

The if...else block starts out as an ordinary Scriptlet, but the Scriptlet is closed at each line with HTML text included between the Scriptlet tags.Example Live Demo           IF...ELSE Example                         Today is weekend                 Today is not weekend           The above code will generate the following result −Today is not weekend

How to upload a file using JSP?

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

239 Views

Click the Below link to Know how to Upload a file Using JSPhttps://www.tutorialspoint.com/jsp/jsp_file_uploading.htm

What is a pageContext Object in JSP?

Chandu yadav
Updated on 30-Jul-2019 22:30:25

963 Views

The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page.This object is intended as a means to access information about the page while avoiding most of the implementation details.This object stores references to the request and response objects for each request. The application, config, session, and out objects are derived by accessing attributes of this object.The pageContext object also contains information about the directives issued to the JSP page, including the buffering information, the errorPageURL, and page scope.The PageContext class defines several fields, including PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, and APPLICATION_SCOPE, ... Read More

What is a config Object in JSP?

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

341 Views

The config object is an instantiation of javax.servlet.ServletConfig and is a direct wrapper around the ServletConfig object for the generated servlet.This object allows the JSP programmer access to the Servlet or JSP engine initialization parameters such as the paths or file locations etc.The following config method is the only one you might ever use, and its usage is trivial −config.getServletName();This returns the servlet name, which is the string contained in the element defined in the WEB-INF\web.xml file.

How to write a switch statement in a JSP page?

Samual Sam
Updated on 30-Jul-2019 22:30:25

2K+ Views

Following is the example of using a switch statement within a JSP page. Live Demo           SWITCH...CASE Example                   The above code will generate the following result −It's Wednesday.

How to create a Hit Counter in JSP?

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

130 Views

Click the Below link to know how to create a hit Counter in Jsphttps://www.tutorialspoint.com/jsp/jsp_hits_counter.htm

What is an application Object in JSP?

George John
Updated on 30-Jul-2019 22:30:25

316 Views

The application object is direct wrapper around the ServletContext object for the generated Servlet and in reality an instance of a javax.servlet.ServletContext object.This object is a representation of the JSP page through its entire lifecycle. This object is created when the JSP page is initialized and will be removed when the JSP page is removed by the jspDestroy() method.By adding an attribute to application, you can ensure that all JSP files that make up your web application have access to it.

How to delete Session data in JSP?

Ankith Reddy
Updated on 30-Jul-2019 22:30:25

3K+ Views

When you are done with a user's session data, you have several options −Remove a particular attribute − You can call the public void removeAttribute(String name) method to delete the value associated with the particular key.Delete the whole session − You can call the public void invalidate() method to discard an entire session.Setting Session timeout − You can call the public void setMaxInactiveInterval(int interval) method to set the timeout for a session individually.Log the user out − The servers that support servlets 2.4, you can call logout to log the client out of the Web server and invalidate all sessions ... Read More

Please share a working example of session maintenance in JSP.

George John
Updated on 30-Jul-2019 22:30:25

207 Views

This example describes how to use the HttpSession object to find out the creation time and the last-accessed time for a session. We would associate a new session with the request if one does not already exist.           Session Tracking                   Session Tracking                         Session info          Value     ... Read More

Advertisements