- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a scriptlet in JSP and what is its syntax?
A scriptlet can contain any number of JAVA language statements, variable or method declarations, or expressions that are valid in the page scripting language.
Following is the syntax of Scriptlet −
<% code fragment %>
You can write the XML equivalent of the above syntax as follows −
<jsp:scriptlet> code fragment </jsp:scriptlet>
Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP −
<html> <head> <title>Hello World</title> </head> <body> Hello World!<br/> <% out.println("Your IP address is " + request.getRemoteAddr()); %> </body> </html>
- Related Articles
- What is Syntax Tree?
- What is a request object in JSP?
- What is a response object in JSP?
- What is a config Object in JSP?
- What is a pageContext Object in JSP?
- What is a page object in JSP?
- What is a page directive in JSP?
- What is a buffer attribute in JSP?
- What is a include directive in JSP?
- What is a taglib directive in JSP?
- What is a Periscope and what is its ;use?
- What is autoFlush attribute in JSP?
- What is contentType attribute in JSP?
- What is errorPage attribute in JSP?
- What is isErrorPage attribute in JSP?

Advertisements