Learning Java Programming Made Easy
Page 1: first page (html/jsp)
Page 1: first page (html/jsp)
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <!--script let java code--> <% out.println("<h1>hello how are u</h1>"); %> <br> <!--expression java code--> <%= "hi hello how are u"%> <br> <!--declaration java code--> <%! int age = 18;%> <%! int sum(int i, int j) { return i + j; } %> <%= "the sum of 2 no=" + sum(4, 5)%><br> <%= "the age of emp=" + age%><br> <jsp:forward page="forwrod.jsp"></jsp:forward> </body> </html>
Page 2: Second page (HTMl/JSP)
<%-- Document : second Created on : Jan 31, 2017, 11:33:55 AM Author : my pc --%> <%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="third.jsp">
username:<input type="text" name="user"/>
<input type="submit" value="click"/>
</form> </body>
</html>
Page 3: Third page (html/jsp)
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
String str=request.getParameter("user");
out.println("username="+str);
%>
</body>
</html>
No comments:
Post a Comment
Welcome, happy learning