Found 4336 Articles for Java 8

What the different types of JSTL tags are ?

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

518 Views

The JSTL tags can be classified, according to their functions, into the following JSTL tag library groups that can be used when creating a JSP page −Core TagsFormatting tagsSQL tagsXML tagsJSTL Functions

What is JSTL?

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

967 Views

The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates the core functionality common to many JSP applications.JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags. It also provides a framework for integrating the existing custom tags with the JSTL tags.Install JSTL LibraryTo begin working with JSP pages you need to first install the JSTL library. If you are using the Apache Tomcat container, then follow these two steps −Step 1 − Download the binary distribution from Apache Standard Taglib and ... Read More

How to send a email with attachment using a JSP page?

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

344 Views

Following is an example to send an email with attachment from your machine −Example Send Attachment Email using JSP Send Attachment Email using JSP Let us now run the above JSP to send a file as an attachment along with a message on a given email ID.User Authentication PartIf it is required to provide user ID and Password to the email server for authentication purpose, then you can set these properties as follows −Outputprops.setProperty("mail.user", "myuser"); props.setProperty("mail.password", "mypwd");

How to send a html based email using a JSP page?

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

492 Views

Here is an example to send an HTML email from your machine. It is assumed that your localhost is connected to the Internet and that it is capable enough to send an email. Make sure all the jar files from the Java Email API package and the JAF package are available in CLASSPATH.This example is very similar to the previous one, except that here we are using the setContent() method to set content whose second argument is "text/html" to specify that the HTML content is included in the message.Using this example, you can send as big an HTML content as ... Read More

How to send a simple text based email using a JSP page?

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

229 Views

To send an email using a JSP, you should have the JavaMail API and the Java Activation Framework (JAF) installed on your machine.You can download the latest version of JavaMail (Version 1.2) from the Java's standard website.You can download the latest version of JavaBeans Activation Framework JAF (Version 1.0.2) from the Java's standard website.Download and unzip these files, in the newly-created top-level directories. You will find a number of jar files for both the applications. You need to add the mail.jar and the activation.jar files in your CLASSPATH.Send a Simple EmailHere is an example to send a simple email from ... Read More

How do you implement the auto refresh in JSP?

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

330 Views

JSP makes this job easy by providing you a mechanism where you can make a webpage in such a way that it would refresh automatically after a given interval.The simplest way of refreshing a Webpage is by using the setIntHeader() method of the response object. Following is the signature of this method −public void setIntHeader(String header, int headerValue)This method sends back the header "Refresh" to the browser along with an integer value which indicates time interval in seconds.Auto Page Refresh ExampleIn the following example, we will use the setIntHeader() method to set Refresh header. This will help simulate a digital ... Read More

What is auto refresh feature in JSP?

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

140 Views

JSP makes this job easy by providing you a mechanism where you can make a webpage in such a way that it would refresh automatically after a given interval.The simplest way of refreshing a Webpage is by using the setIntHeader() method of the response object. Following is the signature of this method −public void setIntHeader(String header, int headerValue)This method sends back the header "Refresh" to the browser along with an integer value which indicates time interval in seconds.Auto Page Refresh ExampleIn the following example, we will use the setIntHeader() method to set Refresh header. This will help simulate a digital ... Read More

How can you implement hit counter to avoid loss of count data with each restart of the application in JSP?

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

245 Views

When you restart your application, i.e., web server, this will reset your application variable and your hit counter will reset to zero. To avoid this loss, consider the following points −Define a database table with a single count, let us say hitcount. Assign a zero value to it.With every hit, read the table to get the value of hitcount.Increase the value of hitcount by one and update the table with the new value.Display the new value of hitcount as a total page hit counts.If you want to count hits for all the pages, implement above logic for all the pages.Read More

How do you implement hit counter in JSP?

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

405 Views

A hit counter tells you about the number of visits on a particular page of your web site. Usually, you attach a hit counter with your index.jsp page assuming people first land on your home page.To implement a hit counter you can make use of the Application Implicit object and associated methods getAttribute() and setAttribute().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.Following is the syntax to set a variable at the ... Read More

What is a hit count for a Webpage?

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

677 Views

A hit counter tells you about the number of visits on a particular page of your web site. Usually, you attach a hit counter with your index.jsp page assuming people first land on your home page.To implement a hit counter you can make use of the Application Implicit object and associated methods getAttribute() and setAttribute().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.Following is the syntax to set a variable at the ... Read More

Advertisements