<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Name and Age Form</title> </head> <body> <h1>Enter Your Details</h1> <form action="process.jsp" method="get"> <label for="name">Name:</label> <input type="text" id="name" name="name" required> <br><br> <label for="age">Age:</label> <input type="number" id="age" name="age" required> <br><br> <input type="submit" value="Submit"> </form> </body> </html> process.jsp <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Processed Details</title> </head> <body> <h1>Processed Details</h1> <% // Retrieve the name and age parameters String name = request.getParameter("name"); String age = request.getParameter("age"); %> <p>Name: <%= name %></p> <p>Age: <%= age %></p> </body> </html>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter