Results 1 to 2 of 2
  1. #1
    marie is offline Member
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    0

    Default Retrieving the data posted to a JSP file from HTML file

    Pls take a look at following code snippet :
    showname.jsp


    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>

    <title>Insert title here</title>
    </head>
    <body>
    Welcome :&nbsp;
    <%!String name=request.getParameter("username"); %>

    <%

    out.println("My name is " + name );
    %>


    </body>
    </html>

    form.html
    <html>
    <head>
    <title>Enter your name</title>
    </head>
    <body>
    <p>&nbsp;</p>
    <form method="POST" action="showname.jsp">

    <p><font color="#800000" size="5">Enter your name:</font><input type
    ="text" name="username" size="20"></p>

    <p><input type="submit" value="Submit" name="B1"></p>
    </form>
    </body>
    </html>

    It shows the error: request in showname.jsp cannot be resolved!!
    Last edited by marie; 10-19-2010 at 03:24 PM. Reason: incompltete

  2. #2
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default

    <%!String name=request.getParameter("username"); %>

    since you are using declaratives..you are getting that error
    use scriptlet
    <%String name=request.getParameter("username"); %>

    you will get out put

Similar Threads

  1. Capturing Data From A Html File
    By nickrowe_2k in forum New To Java
    Replies: 185
    Last Post: 06-28-2010, 11:42 AM
  2. Replies: 3
    Last Post: 06-02-2010, 07:58 PM
  3. Replies: 0
    Last Post: 04-04-2008, 10:36 AM
  4. storing and retrieving a file as such
    By anil_manu in forum Advanced Java
    Replies: 0
    Last Post: 03-11-2008, 02:27 PM
  5. how to upload a file along with html form data
    By pranith in forum Java Servlet
    Replies: 3
    Last Post: 07-30-2007, 03:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •