
i dont know how to write a code to Create a JSP with one text field to enter the URL and a submit button.On clicking the submit button, send the request to a servlet .Once the servlet receives the request, it need to create a thread. so please help me in writing this code

jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<%
if(session.getAttribute("name")== null)
{
response.sendRedirect("../../jsp/index.jsp");
}
else{
if(!session.getAttribute("domain").equals("admin"))
{
response.sendRedirect("../../jsp/index.jsp");
}
}
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>National Self Employment Program</title>
<link href="../../NSEP/css/basicstyle.css" rel="stylesheet"
type="text/css" />
<script type="text/javascript" src="/js/CreateAccount.js">
</script>
</head>
<div id="container">
<div id="header">
<div id="logo"><img src="../../images/logo1.jpg" width="235"
height="77" alt="" /></div>
</ul>
</div>
</div>
<div id="right">
<body onload="noBack();" onpageshow="if(event.persisted) noBack();"
onunload="">
<div id="content" style="height: 700px;">
<div id="leftmenu">
</ul>
</ol>
</div>
<center>
<h1>CREATE NEW NSEP STUDENT ACCOUNT</h1>
strong text<p><font color="red">* marked fields are mandatory</font></p>
</center>
<form name="f" method="post" onsubmit="return validateForm()"
action="/NSEP/AccountManagementServlet"><input type="hidden"
name="RequestPage" value="createAccount">
<table border="0" align="center">
<tr>
<td>Student ID:<font color="red">*</font></td>
<td><input type="text" name="sid"></td>
</tr>
<tr>
<td>Account ID:<font color="red">*</font></td>
<td><input type="text" name="aid"></td>
</tr>
<tr>
<td>Bank Name:<font color="red">*</font></td>
<td><select name="bn">
<option value="" />
---select---
</option>
<option value="inb" />
Indian Bank
</option>
<option value="Punjab National Bank" />
Punjab National Bank
</option>
<option value="Syndicate Bank" />
Syndicate Bank
</option>
<option value="obn" />
Oriental Bank
</option>
<option value="sbi" />
SBI
</option>
</select></td>
</tr>
<tr>
<td>Committed Amount:<font color="red">*</font></td>
<td><input type="text" name="balance"></td>
</tr>
<tr>
<td>Start Date:<font color="red">*</font></td>
<td><input type="text" name="sd"></td>
<td>(dd/mm/yyyy)</td>
</tr>
<tr>
<td>End Date:<font color="red">*</font></td>
<td><input type="text" name="ed"></td>
<td>(dd/mm/yyyy)</td>
</tr>
<tr>
<td><input type="submit" value="submit"></td>
<td><input type="submit" value="reset"></td>
</tr>
</table></form>
</body>
</html>
</div>
<div id="footer"></div>
</div>
</body>
</html>
servlet:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = null;
action = request.getParameter("RequestPage");
// Creating new participating bank
if (action.equals("createbank")) //check if action equals to createbank
{
// Getting details entered by the user
String bid = request.getParameter("BID");
String bName = request.getParameter("Bname");
String branchLoc = request.getParameter("Branch");
String address1 = request.getParameter("Address");
String phNo = request.getParameter("Phoneno");
// creating object of class BankVo
BankVo vo = new BankVo();
// Setting these values to BankVo class
vo.setBank(bid, bName, branchLoc, address1, phNo);
// Calling method in CreateBankDao class for storing values in
// database.
CreateBankDao dao = new CreateBankDao();
String dispMssg = dao.storeDb(vo);
// Displaying response message
request.setAttribute("message", dispMssg);
String destination = "/jsp/OutputMessage.jsp";
RequestDispatcher rd = request.getRequestDispatcher(
destination);
rd.forward(request, response);
}//end of if loop
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.