java - how to set value of Input Box in Jsp -
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <html> <form action="index.jsp"> <body> first input: <input name="firstinput" type="text" value=<%=request.getparameter("firstinput") %>> <br> <input type="submit" value="submit"> <% string first = request.getparameter("firstinput"); out.println(first); %> </body> </form> </html>
ths code when put input tax after button click set tax , print tax when tax input "tax" value set tax in input box while print correct "tax" want set input box value "tax" when take input "tax" after click please
you have both:
name="firstinput"
and
name="fname"
for same input field!
update: in addition that, change:
value=<%=request.getparameter("firstinput") %>>
to:
value='<%=request.getparameter("firstinput")%>' />
Comments
Post a Comment