Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set value of Input Box in Jsp

Tags:

java

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 is My code when Put Input tax then after Button click its set to tax and Print Tax But when I tax Input "tax" then Value set to tax in Input Box while Print correct "tax" i want to set input Box value also "tax" when I take Input "tax" after click please help

like image 473
Anil Kumar Avatar asked Aug 10 '13 06:08

Anil Kumar


1 Answers

You have both:

name="firstinput" 

and

name="fname"

for the same input field!

UPDATE: In addition to that, change:

value=<%=request.getParameter("firstinput") %>>

to:

value='<%=request.getParameter("firstinput")%>' />
like image 112
Nir Alfasi Avatar answered Oct 07 '22 15:10

Nir Alfasi