Click here to Skip to main content
15,919,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have one html and jsp page in html page im putting value by dynamic text box and in jsp i tried to enter but when im try to click submit nothing has happen not able to understand where im stucking

What I have tried:

my html code:
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
<form action="EmployeeVendorValidation.jsp" method="post">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function selectres(z){

var selection=z.val();



if(selection == '2'){
z.next('input').show();
}else{
z.next('input').hide();
}
}
$(function() {
$("#btnAdd").bind("click", function() {
AddControl();
});

$("#btnGet").bind("click", function() {
var values = "";
$("input[name=DynamicTextBox1]").each(function() {
values += $(this).val() + "\n";
});
var values = "";
$("input[name=DynamicTextBox2]").each(function() {
values += $(this).val() + "\n";
});

alert(values);
});

$("body").on("click", ".remove", function() {
$(this).closest("div").remove();


});
});
function GetDynamicTextBox1(value) {

return 'Project:<input name = "DynamicTextBox1" id="ingr_project" type="text" value = "' + value + '" required/>&nbsp&nbsp&nbsp' +
'Header:<input name = "DynamicTextBox2" id="ingr_header" type="text" value = "' + value + '"required/>&nbsp&nbsp&nbsp'+
'Department:<input name = "DynamicTextBox3" id="ingr_department" type="text" value = "' + value + '"required/>&nbsp;&nbsp;&nbsp'+
'Description<input name = "DynamicTextBox4" id="ingr_description" type="text" value = "' + value + '" required/>&nbsp;&nbsp;&nbsp'+
'<input name = "DynamicTextBox2" style="display:none" id="res_name" type="text" value = "' + value + '" required/>&nbsp'+ '<input type="button" value="Remove" class="remove" />'

}


function selectres(z){

var selection=z.val();



if(selection == '2'){
z.next('input').show();
}else{
z.next('input').hide();
}
}
function AddControl() {
var div = $("<div />");

div.append(GetDynamicTextBox1(''));


$("#TextBoxContainer").append(div);
}
</script>

<input id="btnAdd" type="button" value="Add" /><br><br>
<div id="TextBoxContainer">


</div>
<br><br>
<input type="hidden" name="txtemployeeid" value="employee_id">
<input type="submit" name="btnSubmit" value="Submit" /><br><br>
</form>
</body>

</html>
Posted
Comments
Atul Rokade 16-Apr-18 7:34am    
my jsp code :


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page


<%

String employee_id=request.getParameter("txtemployeeid");
String get_project1=request.getParameter("ingr_project");
String get_header=request.getParameter("ingr_header");
String get_department=request.getParameter("ingr_department");
String get_description=request.getParameter("ingr_description");

HttpSession session1=request.getSession(true);
session1.setAttribute("txtemployeeid", employee_id);
%>

<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@177.18.114.213:1821:godb","xe","Spacess");

try
{
int count=0;
//String btnsubmit=Integer.parseInt(request.getParameter("btnSubmit"));
String btnsubmit=request.getParameter("btnSubmit");
if(btnsubmit!=null)
{
count=Integer.parseInt(btnsubmit.trim());


for(int i=0;i< count; i++)
{


PreparedStatement ps=con.prepareStatement("insert into Employee_task values(?,?,?,?,?)");
ps.setString(1, employee_id);
ps.setString(2, get_project1);
ps.setString(3, get_header);
ps.setString(4, get_department);
ps.setString(5, get_description);
ps.executeUpdate();
}



}
}
catch(Exception ex)
{
ex.printStackTrace();
}

%>


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900