Java Servlets
<html> <head><title>Hello</title></head> <body> <p> One way is by using an expression: <%= request.getParameter("name") %> </p> <p> Another is by using a scriplet: <% //scriptlet example if (request.getParameter("name") == null) { out.println("Hello World"); } else { out.println("Hello, " + request.getParameter("name")); } %> </p> <p> Finally, there are the declarations: <p> <%! /**Instance variable for this servlet */ private int counter = 0; /**Member function for this servlet */ private String randomNumber() { return(Math.random().toString()); } %> now call it: <%= randomNumber()%=> </body></html>
69 of 89