Skip to content Skip to sidebar Skip to footer

Linking HTML To JSP Page

I'm have problems linking my HTML and JSP. Just trying to make a simple html page to take a 'email' and 'password' then have the jsp display on the next page. But when i click subm

Solution 1:

You need to use the name attribute in the form fields .

<input type="text" name="email"></td>

The value of "email" can be retrieved in JSP as :

String email = request.getParameter("email");

OR

${param.email}

OR

<c:out value="${param.email}"/> <%--(Using JSTL)--%>

Here are the complete list of attributes.

name = string #

The name part of the name/value pair associated with this element for the purposes of form submission.


Solution 2:

You should specify the input name attribute. Try this,

<form action="form.jsp" method="get">
        <table cellspacing="5" border="0">
                <tr>
                     <td align="right">Email:</td>
                     <td><input type="text" name="email"></td>
                </tr>

                <tr>
                     <td align="right">Password:</td>
                     <td><input type="text" name="password"></td>
                </tr>

                <tr>
                     <td></td>
                     <td><br><input type="submit" value="Submit"></td>
                </tr>
        </table>
        </form>

For more info you can try this link


Post a Comment for "Linking HTML To JSP Page"