Home Jsp INTRODUCTION TO JSP SCRIPTLETS



INTRODUCTION TO JSP SCRIPTLETS
Posted on: February 13, 2008 at 12:00 AM
JSP Scriptlets begins with <% and ends %> .

INTRODUCTION TO JSP SCRIPTLETS

     

Syntax of JSP Scriptles are:

  <%
  //java codes
   %>

JSP Scriptlets begins with <% and ends %> .We can embed any amount of java code in the JSP Scriptlets. JSP Engine places these code in the _jspService() method. Variables available to the JSP Scriptlets are:

  • request:
    request represents the clients request and is a subclass of HttpServletRequest. Use this variable to retrieve the data submitted along the request.
    Example:
      <%
      //java codes
       String userName=null;
       userName=request.getParameter("userName");
       %>
  • response:
    response is subclass of HttpServletResponse.
     
  • session:
    session represents the HTTP session object associated with the request.
     
  • out:
    out is an object of output stream and is used to send any output to the client.
Other variable available to the scriptlets are pageContext, application,config and exception.

INTRODUCTION TO JSP EXPRESSIONS

Syntax of JSP Expressions are:

  <%="Any thing"   %>

JSP Expressions start with 

Syntax of JSP Scriptles are with <%= and ends with  %>. Between these this you can put anything and that will converted to the String and that will be displayed.

Example:
  <%="Hello World!" %>
Above code will display 'Hello World!'.
  

Related Tags for INTRODUCTION TO JSP SCRIPTLETS:
javachttpjspclassdatavariablesscriptservicehttpsservletclientmethodvariablerequestipembedvisubmitcliriathisaisubclassenginejsielongmounttoeilithttpservletrequestcanlimitvarusetrieceinsubasmntpstrcaletjaceclclientsesscriptletretrieveemmessuspginatanyquestisicepreandarcodcodereprrvvattscrssriripthtpsavbcstabablhttpservletplprmindodeono


More Tutorials from this section

Ask Questions?    Discuss: INTRODUCTION TO JSP SCRIPTLETS   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.