Scriptlet Tag in JSP, How to write Java Code in JSP, JSP Scriptlet Tag for Writing Java Codes inside the HTML


Scriptlet Tag in JSP, How to write Java Code in JSP, JSP Scriptlet Tag for Writing Java Codes inside the HTML

The JSP Code can be embed with HTML and every Java Code written inside the JSP Tags. The Scriptlet Tag is one of the Tags which is used to write the Java Code inside the HTML code like if condtional statements, iterative statements, handle requests, sending response, the Scriptlet Tags are used to do these tasks.

The syntax for Scriptlet Tag

<%
//code here
%>

Example for Scriptlet Tag

<html>
<head>
<title>Handling Request</title>
</head>
<body>
<%
String user=request.getParameter("user");
if(user.equals("admin"))
{
response.sendRedirect("welcome.jsp");
}
%>
</body>
</html>

Thanks for visiting

{ 0 comments... read them below or add one }

Post a Comment