Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Introduction to JSP Scriptlets 
 

Introduction to JSP Scriptlets 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

 

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!'.
    

                         

» View all related tutorials
Related Tags: c exception error jsp io count page using invoke js handle if to ci counter e directive can pe ce

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

13 comments so far (
post your own) View All Comments Latest 10 Comments:

Hi,
Can we store null value in the date field in Access database or any other database

Atul

Posted by Atul on Monday, 07.7.08 @ 08:17am | #66074

hai am beginner of Jsp i searched in net i found this site really this is ecxcellent and nice to study .... i wish to keep grow this site

Posted by sreekanth on Monday, 05.19.08 @ 12:21pm | #60436

This site is good for example but there is no explanation of topics only examples are there.

Posted by Piyush on Tuesday, 05.13.08 @ 09:44am | #59655

*** Thanks for the reply...this site is really nice...and special thanks to neelam..who really guided me and solved my problems in JSP....

Posted by santhosh on Thursday, 04.3.08 @ 10:29am | #55194

I LIKE THIS WEB SITE. ITS EASILY UNDERSTANDING

Posted by sudha on Tuesday, 02.5.08 @ 17:13pm | #47302

This sight is good for reading...

Posted by Chirag on Wednesday, 01.2.08 @ 11:42am | #44357

No you can't as it goes to service method of Servlet.

Posted by Raj on Thursday, 09.27.07 @ 19:56pm | #30088

it is good

Posted by anand on Wednesday, 04.11.07 @ 14:53pm | #13865

hai this is sathish.. I am novice to JSP.so i need savvy it.so please help to give me new examples and present situation in world.

Posted by sathish on Thursday, 04.5.07 @ 16:36pm | #13390

Scriptlet canot be used to define a method;only declaration can be used 4 that..

Posted by ABHI on Tuesday, 04.3.07 @ 23:40pm | #13298

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.