JSP Tutorials

21. What are the different scopes in JSP?

By: Barbara : 2008-12-09

Description: The scope of an object describes how widely it's available and who has access to it. For example, if an object is defined to have page scope, then it's available only for the duration of the current request on that page before being destroyed by the container. In this case, only the current page has access to this data, and no one else can read it. At the other end of the scale, if an object has application scope, then any page may use the data because it lasts for the duration of the application, which means until the container is switched off.


22. Using a DataSource from WebLogic in a JSP

By: Bruce W. Perry : 2008-11-24

Description: Example below imports the necessary classes at the top of the code using the page directive and its import attribute. Otherwise, this JSP accomplishes everything that the servlet of the prior recipe does, including the display of nearly identical output in the web browser.


23. Getting HTTP Request Headers in a JSP

By: Bruce W. Perry : 2008-11-24

Description: The JSTL v1.0 makes all existing request headers available via the header implicit object. The JSTL automatically makes this variable available to JSPs; the header object evaluates to a java.util.Map type.


24. Automatically Refreshing a JSP

By: Emiley J. : 2008-11-24

Description: The following scriptlet code adds a Refresh header that specifies a 60-second interval for refreshing the JSP. Place this code at the top of the JSP before any content appears:


25. Embedding a QuickTime movie in a JSP

By: Bruce W. Perry : 2008-11-24

Description: Similar to using the Java Plug-in, a JSP uses the embed tag inside of an HTML object tag to properly load one of Apple Computer's QuickTime movies. You must include the CLASSID attribute value exactly as the below sample jsp program specifies. You also must include the same CODEBASE attribute value. If the user has an Internet Explorer Windows browser, but has not yet installed the QuickTime ActiveX control, the CODEBASE attribute value specifies where the user can download it.


26. Embedding MP3 audio file in a JSP

By: Bruce W. Perry : 2008-11-24

Description: The embed tag is used to include an audio file with a JSP, so that when a user requests the JSP, the browser plays music. Specifically, the browser is designed to detect the MIME type of the embedded file, then activate a helper application such as QuickTime or RealAudio to handle the embedded file and play the music.


27. Writing your first JSP page

By: Bruce W. Perry : 2008-11-23

Description: A JavaServer Pages (JSP) component is a type of Java servlet that is designed to fulfill the role of a user interface for a Java web application. Web developers write JSPs as text files that combine HTML or XHTML code, XML elements, and embedded JSP actions and commands. JSPs were originally designed around the model of embedded server-side scripting tools such as Microsoft Corporation's ASP technology; however, JSPs have evolved to focus on XML elements, including custom-designed elements, or custom tags, as the principal method of generating dynamic web content.


28. Deploying an Individual JSP on Tomcat

By: Bruce W. Perry : 2008-11-23

Description: The easiest way to test a new JSP file is to place it at the top level of Tomcat's default web application. This application is located in the /webapps/ROOT/ directory. Tomcat 4.1.x compiles (or recompiles, if you are pasting a new JSP file over an old one) the JSP and display its response in a web page. You do not have to stop and start Tomcat using the Tomcat manager application for the new JSP file to be available to your web application.


29. Using UTF-8 in JSP / ASP / HTML pages.

By: Markus Kuhn : 2008-08-13

Description: There are two ways in which a HTTP server can indicate to a client that a document is encoded in UTF-8:


30. Calling JSP from a batch file

By: Emiley J. : 2008-03-24

Description: If you wondering why in the world should I call a JSP from a batch file then read on. In fact, my problem was to schedule a task that runs every day on a specific time and must generate a report for my management and email the same. Searching the net I was able to accomplish this by combining VB and batch files. But I was not happy with the results. Or to be more specific, my management was not happy with the type of report I was generating in terms of formatting etc.