基本上我有一个连接到数据库的网络服务,它有一个插入方法。我在 jsp 中创建了一个注册表单,我需要将用户插入到 registration.jsp 表单中的数据发送到我的 Web 服务。因此,当单击提交按钮时,我使用 Web 服务客户端调用作为registration.jsp 的操作。
我不知道如何获取用户在表单中输入的数据并将其传递给 Web 客户端,后者又将其插入我的 Web 服务数据库。
这是我的代码:
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title> Registration</title>
    </head>
    <body>
        <h1> Welcome</h1>
        <form name="test" action="Wclient2.jsp" method="POST" enctype="multipart/formdata">
                   <table border="0">
                <thead>
                    <tr>
                        <th>Register Here</th>
                      <th></th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>First Name:</td>
                        <td><input type="text" name="fname" value="" size="50" /></td>
                    </tr>
                    <tr>
                        <td>Last Name:</td>
                        <td><input type="text" name="lname" value="" size="50" /></td>
                    </tr>
                    <tr>
                        <td>Email:</td>
                        <td><input type="text" name="email" value="" size="50" /></td>
                    </tr>
                    <tr>
                        <td>Password:</td>
                        <td><input type="password" name="password" value="" size="50"/>      </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td> <input type="submit" value="submit" name="submit" /> </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </body>
</html>
这是网络客户端点击提交按钮后的代码
注册(动作=“Wclient2.jsp”方法=“POST”)
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title> Enroll</title>
    </head>
    <body>
        <h1> Welcome</h1>
        <form name="test"<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
           <%-- start web service invocation --%><hr/>
        <%        
            try {
                mypack.Bioweb_Service service = new mypack.Bioweb_Service();
                mypack.Bioweb port = service.getBiowebPort();
                // TODO initialize WS operation arguments here
                java.lang.String fname = "";
                java.lang.String lname = "";
                java.lang.String email = "";
                java.lang.String password = "";
                // TODO process result here
                java.lang.String result = port.insert(fname, lname, email, password);
                out.println("Result = " + result);
            } catch (Exception ex) {
                // TODO handle custom exceptions here
            }
        %>
        <%-- end web service invocation --%><hr/>
    </body>
</html>
我不知道如何从registration.jsp 中获取fname 的参数以放入Web 客户端。当我写:
java.lang.String fname = request.getParameter("fname");
要将文本字段 fname 的值获取到我的 Web 服务中,在我的数据库中创建了一行,但插入了 NULL 而不是我的用户在表单中输入的值。
请帮忙。