Advance Java JSP tutorial

Advance Java JSP tutorial

JavaServer Pages (JSP) is a Java standard innovation that empowers you to compose dynamic information driven pages. JSP is based on the Java Servlet determination. The two innovations normally cooperate, particularly in more established Java web applications. From a coding point of view, the most clear contrast between them is that with servlets you compose Java code and afterward insert customer side markup (like HTML) into that code, while with JSP you start with the customer side content or markup, at that point install JSP labels to associate your page to the Java backend. 

JSP is additionally firmly identified with JSF (JavaServer Faces), a Java determination for building MVC (model-see controller) web applications. JSP is a moderately more straightforward and more established innovation than JSF, which is the standard for Java web structures like Eclipse Mojarra, MyFaces, and PrimeFaces. While it isn't phenomenal to see JSP utilized as the frontend for more established JSF applications, Facelets is the favored view innovation for current JSF executions. 


While JSP may not be your first decision for building dynamic website pages, it is a center Java web innovation. JSP pages are generally fast and simple to manufacture, and they interface flawlessly with Java servlets in a servlet holder like Tomcat. You will experience JSP in more seasoned Java web applications, and every now and then you may think that its helpful for building straightforward, unique Java website pages. As a Java engineer, you ought to at any rate be acquainted with JSP.

JSP Example
<html>
<head>
  <title>Echoing HTML Request Parameters example</title>
</head>
<body>
  <h3>Choose an author:</h3>
  <form method="get">
    <input type="checkbox" name="author" value="Tan Ah Teck">Tan
    <input type="checkbox" name="author" value="Mohd Ali">Ali
    <input type="checkbox" name="author" value="Kumar">Kumar
    <input type="submit" value="Query">
  </form>

  <%
  String[] authors = request.getParameterValues("author");
  if (authors != null) {
  %>
    <h3>You have selected author(s):</h3>
    <ul>
  <%
      for (int i = 0; i < authors.length; ++i) {
  %>
        <li><%= authors[i] %></li>
  <%
      }
  %>
    </ul>
    <a href="<%= request.getRequestURI() %>">BACK</a>
  <%
  }
  %>
</body>

</html>

Comments

Popular posts from this blog

Java Variables and Datatype

JAVA Features

Java Fundamentals