Using post method along with jquery modal window
I am developing an application using jquery ui and servlets.I have used modal dialog window for login.Once I Login the credentials are being sent to LoginServlet where the crendentials are checked and the user is being redirected to new page.
now Login.jsp has:
<html>
<head>
<script>
$(document).ready(function() {
$("#dialog").dialog();
</script>
</head>
<body style="font-size: 62.5%;">
<div id="dialog" title="DBoperations">
<form id="LoginForm" method="post" action="Login">
<fieldset>
<label>Username:</label>
<input type="text" id="username" value=""></input><br></br>
<label>Password:</label>
<input type="password" id="password" value=""></input><br></br>
<input type="submit" id="submit" class="submit" value="Log In" align="middle"></input>
</fieldset>
</form>
</div>
</body>
Now when I run the application the data passed to the servlet is null.I checked it using println statements.As far as I know al it takes to pass data to servlet is specifying action and using getparameter on server side...
I am gettin Null pointer exception due to the null value being passed to the login method..
开发者_JAVA技巧why are null values passed??
Try adding a name attribute to your inputs and see if that works. I believe the browser only sends the request parameter if it has a name attribute.
<input type="text" id="username" name="username" value="">
精彩评论