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

|
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