Skip to main content

servelet&jsp

Servelet
&
JSP






Can use web.xml or Annotations to link form action to Servelet




<form method="post" action="Validate">
Name:<input type="text" name="user" /><br/>
Password:<input type="password" name="pass" ><br/>
<input type="submit" value="submit">
</form>

Welcome.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Welcome extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        out.println("<h2>Welcome user</h2>");
 
    }
}
Validate.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Validate extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
      
            String name = request.getParameter("user");
            String password = request.getParameter("pass");

            if(password.equals("studytonight"))
            {
                RequestDispatcher rd = request.getRequestDispatcher("Welcome");
                rd.forward(request, response);
            }
            else
            {
                out.println("<font color='red'><b>You have entered incorrect password</b></font>");
                RequestDispatcher rd = request.getRequestDispatcher("index.html");
                
            }
  
    }
}



web.xml
<web-app>
    <servlet>
        <servlet-name>Validate</servlet-name>
        <servlet-class>Validate</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>Welcome</servlet-name>
        <servlet-class>Welcome</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Validate</servlet-name>
        <url-pattern>/Validate</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Welcome</servlet-name>
        <url-pattern>/Welcome</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        </welcome-file-list>
</web-app>

JSP

  • JSP technology is used to create dynamic web applications. JSP pages are easier to maintain then a Servlet. JSP pages are opposite of Servlets as a servlet adds HTML code inside Java code, while JSP adds Java code inside HTML using JSP tags. Everything a Servlet can do, a JSP page can also do it.


  • A JSP page looks similar to an HTML page, but a JSP page also has Java code in it. We can put any regular Java Code in a JSP file using a scriplet tag which start with <% and ends with %>. JSP pages are used to develop dynamic responses.

There are five different types of scripting elements

Scripting ElementExample
Comment<%-- comment --%>
Directive<%@ directive %>
Declaration<%! declarations %>
Scriptlet<% scriplets %>
Expression<%= expression %>
                                                                              JSTL
JSP Standard Tag Library(JSTL) is a standard library of readymade tags. The JSTL contains several tags that can remove scriplet code from a JSP page by providing some ready to use, already implemented common functionalities.
  • JSTL Core provides several core tags such as if, forEach, import, out etc to support some basic scripting task. Url to include JSTL Core Tag inside JSP page is →

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>




Comments

Popular posts from this blog

1& 2 - Introduction to Fusion Cloud and Course Content

  Front End Pages were developed using JET Framework. Backend access won't be available we have to use BI server FRS/Smart view - Essbase OTBI - Subject Area BIP - Select tables In Fusion Cloud applications you cannot create the process all together from the beginning and you cannot modify the the workflow process also so what you can do you can configure the approval rules you can configure the approval so that means who can approve who has to take the action who has to be notified so all those approval rules . If process is not there you cannot do anything 

27, 28 REST API SOAP Services

  PPT Webservices REST SOAP Notes **************************************************************************** SOAP Services - Old Timer **************************************************************************** Service WSDL URL: https://servername/fscmService/ErpIntegrationService?WSDL https://fa-esev-saasfademo1.ds-fa.oraclepdemos.com/fscmUI/faces/FuseWelcome?fndThemeName=Vision_Default fin_impl or hcm_impl5 or scm_impl vNE3n%4* https://fa-esev-saasfademo1.ds-fa.oraclepdemos.com/fscmService/ErpIntegrationService?WSDL EBS - Concurrent Programs Fusion Cloud - ESS Job - Enterprise Scheduler Service Job (Conc Prog) Fusion Cloud: ERP Cloud - FSCM - Financials and Supply Chain Mgmt HCM Cloud - HCM - Core HR, Payroll etc. PL/SQL Pkg -> (Procedures -> Logical units) SOAP Web Service -> (Operations -> Logical units) ESS - Enterprise Scheduler Service Job (conc prog) SubmitESSJobRequest Operation: Input - SubmitESSJobRequestMsg -> attributes defined -> jo...

8 to15 BIP Data Model RTF ESS Job Schedule and Bursting

  Tools -> Report and Analytics -> Browse Catalog Fusion URL/analytics  Custom Folder Significance in Shared Folders Getting Table Information Official Docs Record Issue and Raise SR with Oracle [If not able to find] In Create New Data Model In Fusion Audti tables with _ at the end of table not like _A in EBS Drag n Drop Link between two groups like above Parameter type menu for  LOV to use and Refresh Check box Save as sample data and create Reprot Generate RTF automatically ESS Job LOV  for ESS Job Parameters In ESS Job we cannot pass first parameter value to the second parameter like in EBS and BI publisher - Limiation SR with Oracle UCM or Content Server or WebCentre Content - FusionURL/cs We won't this BI Publisher Schedule as we cannpt chnage dynamically mails or subject or msg body. We will mostly use bursting concept Schedule from ESS Bursting SQL For UCM Delivery Channel SQL for Email Delivery Channel SQL for FTP Delivery Channel In order for FTP to wo...