Results 1 to 1 of 1
-
JSP - getting value from a textfield
Review the code below:
myform.html
myjsp.jspJava Code:<html> <head> <title>Testing JSP</title> </head> <body> <h1>Welcome to JSP</h1> <form action="myjsp.jsp" method="POST" > <input type="text" name="name" /> <p> <input type="submit" name="Submit" value="Submit name" /> <input type="reset" name="Reset" value="Reset form" /> </p> </form> </body> </html>
Java Code:<html> <head> <title>Testing JSP</title> </head> <body> <h1>JSP test</h1> <% String name = request.getParameter("name"); if (name.trim().length() == 0) { %> No name entered.<br> <% } else { %> Welcome <%=name%><br><br><br> <% } %> <a href="myform.html">Try again?</a> </body> </html>
Similar Threads
-
set focus to the textfield
By paty in forum New To JavaReplies: 2Last Post: 07-09-2010, 08:28 AM -
[SOLVED] Confused by the textField
By jamesfrize in forum New To JavaReplies: 4Last Post: 03-28-2008, 05:30 PM -
Allowing only numeric values in a TextField
By Java Tip in forum Java TipReplies: 0Last Post: 03-01-2008, 10:08 PM -
Append text inputed in the textfield into a TextArea
By romina in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 05:35 AM -
alignment of textfield in awt
By nitinborge5 in forum New To JavaReplies: 2Last Post: 07-30-2007, 11:16 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks