What is JavaServer Pages?
Java Server Pages (JSP) could be a technology for developing web content that support dynamic content that helps developers insert java code in HTML pages by creating use of special JSP tags, most of that begin with <% and finish with %>. A JavaServer Pages element could be a form of Java servlet that’s designed to satisfy the role of a program for a Java internet application. internet developers write JSPs as text files that mix HTML or XHTML code, XML parts, and embedded JSP actions and commands.
Using JSP, you’ll be able to collect input from users through online page forms, gift records from a information or another supply, and build web content dynamically. JSP tags are often used for a range of functions, like retrieving data from a information or registering user preferences, accessing JavaBeans parts, passing management between pages and sharing data between requests, pages etc.
Why You Use JSP?
JavaServer Pages usually serve a similar purpose as programs enforced victimisation the Common entree Interface (CGI). however JSP provide many blessings compared with the CGI. Performance is considerably higher as a result of JSP permits embedding Dynamic parts in HTML Pages itself rather than having a separate CGI files. JSP area unit forever compiled before it’s processed by the server not like CGI/Perl which needs the server to load AN interpreter and therefore the target script on every occasion the page is requested.
JavaServer Pages area unit designed on high of the Java Servlets API, thus like Servlets, JSP conjointly has access to all or any the powerful Enterprise Java Apis, as well as JDBC, JNDI, EJB, JAXP etc. JSP pages are often employed in combination with servlets that handle the business logic, the model supported by Java servlet guide engines. Finally, JSP is AN integral a part of Java electrical engineering, a whole platform for enterprise category applications. this suggests that JSP will play an area within the simplest applications to the foremost advanced and tightened.
Complete Example containing all scriptlet Tags:
<!-- Declaration Tag Example -->
int i = 15;
String name = "Jwalant";
<!-- Expression Tag Example -->
<!-- Scriptlet Example -->
Date date = new Date();
out.println("Current Time is "+date);