| | |
change statement
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2004
Posts: 7
Reputation:
Solved Threads: 0
Property Description : (list bar)
Property Description : null
(submit button)
.............................................................................
As you can see from the above, i need to choose option from a list bar. after choose an option, it will automatically show at below replacing the null. when the statement is display, i can change it to replace with the more updated one. Then click submit button when property description is changed. the problem is my program can't automatically display statement when i choose option from list bar. i include some part of my code and hope to be corrected. i am using jsp
----------------------------------------------------------
<%! String property_code, property_desc; %>
<% if (request.getParameter("hid_value") != null ) {
String property_code = request.getParameter("hid_value");
String property_desc = request.getParameter("property_desc");
String update1 = "UPDATE fcprop SET fp_prop_desc='"+property_desc+"' "+
"WHERE fp_prop_desc = '"+property_desc+"' ";
PreparedStatement pstmt1 = conn.prepareStatement(update1);
pstmt1.executeUpdate();
pstmt1.close();
response.sendRedirect("property_information.jsp");
} %>
<html>
<head>
<title>Property - Change</title>
<link rel="stylesheet" href="resident.css">
<script language="Javascript">
function checking1() {
setBoolean = true
<% String chk1 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"ORDER BY fp_prop_desc ";
Statement stmt_chk1 = conn.createStatement();
ResultSet rset_chk1 = stmt_chk1.executeQuery(chk1);
while (rset_chk1.next()) {
String property_desc = rset_chk1.getString("fp_prop_desc");
%>
if (document.form2_1.property_desc.value == '') {
alert('Please fill Property Description.');
document.form2_1.r_name.focus();
return false;
}
<% } %>
if (document.form2_1.property_desc.value == 'done') {
document.form2_1.property_desc.value = '';
alert('Please select Property Description.');
return false;
}
return setBoolean;
}
</script>
</head>
<BODY leftMargin=0 text=#0080c0 topMargin=0 oncontextmenu="return false">
<table border="0" width="100%" height="100%">
<tr><td valign="top" topmargi="0">
<A class=small href="property_information.jsp">Property Information</a> > Change Property
<div align="right">
<font size="5" color="#cc0000">Change Property</font>
</div>
<form name="form2_1" method="post" onSubmit="return checking1();">
<script>
function show_property_desc(sel_index, sel_value) {
if (sel_index == '0') {
document.all.property_desc.value = "";
}
document.all.property_desc.value = sel_value
<% int counter = 1;
String sql_comp1 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"ORDER BY fp_prop_desc ";
Statement stmt_comp1=conn.createStatement();
ResultSet rset_comp1=stmt_comp1.executeQuery(sql_comp1);
while(rset_comp1.next()) {
String property_desc= rset_comp1.getString("fp_prop_desc"); %>
var property_desc<%=counter%> = new Array();
<% String sql_3 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"WHERE fp_prop_desc = '"+property_desc+"' ";
Statement stmt3 = conn.createStatement();
ResultSet rset3 = stmt3.executeQuery(sql_3);
int counter_property_desc = 0;
while (rset3.next()) {
property_desc = rset3.getString("fp_prop_desc");%>
property_desc0 = "";
property_desc<%=counter%>[<%=counter_property_desc%>]='<%=property_desc%>'
<% counter_property_desc++;
}
counter++;
} %>
for(var h = 0; h < eval("property_desc"+sel_index+".length"); h++){
document.all.property_desc.value = eval("property_desc"+sel_index+"[h]")
}
}
</script>
<table border="0" width="98%" align="center">
<tr>
<td width="25%">Property Description</td>
<td width="1%">:</td>
<td width="79%"><select name="property_desc" style=width:"260px" onchange="show_property_desc(this.selectedIndex, this.value);">
<option value="done">-- Select --</option>
<% String sql_3 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"ORDER BY fp_prop_desc ";
Statement stmt_3 = conn.createStatement();
ResultSet rset_3 = stmt_3.executeQuery(sql_3);
while (rset_3.next()) {
String property_desc = rset_3.getString("fp_prop_desc");%>
<option value="<%=property_desc%>"><%=property_desc%></option>
<% } %>
</select>
<input type="hidden" name="property_desc" value="">
</td>
</tr>
<br>
<tr>
<td width="25%"> Property Description</td>
<td width="1%">:</td>
<td width="74%"><input type="text" name="property_desc" style="HEIGHT: 20px; WIDTH: 254px" value="">
</td>
</tr>
</table>
<br>
<table border="0" width="20%" align="center">
<tr>
<td><input type="submit" name="submit" value="Submit"></td>
<td><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
<input type="hidden" name="hid_value" value="A">
</form>
<% conn.close(); %>
</td></tr>
</table>
</BODY>
</html>
Property Description : null
(submit button)
.............................................................................
As you can see from the above, i need to choose option from a list bar. after choose an option, it will automatically show at below replacing the null. when the statement is display, i can change it to replace with the more updated one. Then click submit button when property description is changed. the problem is my program can't automatically display statement when i choose option from list bar. i include some part of my code and hope to be corrected. i am using jsp
----------------------------------------------------------
<%! String property_code, property_desc; %>
<% if (request.getParameter("hid_value") != null ) {
String property_code = request.getParameter("hid_value");
String property_desc = request.getParameter("property_desc");
String update1 = "UPDATE fcprop SET fp_prop_desc='"+property_desc+"' "+
"WHERE fp_prop_desc = '"+property_desc+"' ";
PreparedStatement pstmt1 = conn.prepareStatement(update1);
pstmt1.executeUpdate();
pstmt1.close();
response.sendRedirect("property_information.jsp");
} %>
<html>
<head>
<title>Property - Change</title>
<link rel="stylesheet" href="resident.css">
<script language="Javascript">
function checking1() {
setBoolean = true
<% String chk1 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"ORDER BY fp_prop_desc ";
Statement stmt_chk1 = conn.createStatement();
ResultSet rset_chk1 = stmt_chk1.executeQuery(chk1);
while (rset_chk1.next()) {
String property_desc = rset_chk1.getString("fp_prop_desc");
%>
if (document.form2_1.property_desc.value == '') {
alert('Please fill Property Description.');
document.form2_1.r_name.focus();
return false;
}
<% } %>
if (document.form2_1.property_desc.value == 'done') {
document.form2_1.property_desc.value = '';
alert('Please select Property Description.');
return false;
}
return setBoolean;
}
</script>
</head>
<BODY leftMargin=0 text=#0080c0 topMargin=0 oncontextmenu="return false">
<table border="0" width="100%" height="100%">
<tr><td valign="top" topmargi="0">
<A class=small href="property_information.jsp">Property Information</a> > Change Property
<div align="right">
<font size="5" color="#cc0000">Change Property</font>
</div>
<form name="form2_1" method="post" onSubmit="return checking1();">
<script>
function show_property_desc(sel_index, sel_value) {
if (sel_index == '0') {
document.all.property_desc.value = "";
}
document.all.property_desc.value = sel_value
<% int counter = 1;
String sql_comp1 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"ORDER BY fp_prop_desc ";
Statement stmt_comp1=conn.createStatement();
ResultSet rset_comp1=stmt_comp1.executeQuery(sql_comp1);
while(rset_comp1.next()) {
String property_desc= rset_comp1.getString("fp_prop_desc"); %>
var property_desc<%=counter%> = new Array();
<% String sql_3 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"WHERE fp_prop_desc = '"+property_desc+"' ";
Statement stmt3 = conn.createStatement();
ResultSet rset3 = stmt3.executeQuery(sql_3);
int counter_property_desc = 0;
while (rset3.next()) {
property_desc = rset3.getString("fp_prop_desc");%>
property_desc0 = "";
property_desc<%=counter%>[<%=counter_property_desc%>]='<%=property_desc%>'
<% counter_property_desc++;
}
counter++;
} %>
for(var h = 0; h < eval("property_desc"+sel_index+".length"); h++){
document.all.property_desc.value = eval("property_desc"+sel_index+"[h]")
}
}
</script>
<table border="0" width="98%" align="center">
<tr>
<td width="25%">Property Description</td>
<td width="1%">:</td>
<td width="79%"><select name="property_desc" style=width:"260px" onchange="show_property_desc(this.selectedIndex, this.value);">
<option value="done">-- Select --</option>
<% String sql_3 = "SELECT fp_prop_desc "+
"FROM fcprop "+
"ORDER BY fp_prop_desc ";
Statement stmt_3 = conn.createStatement();
ResultSet rset_3 = stmt_3.executeQuery(sql_3);
while (rset_3.next()) {
String property_desc = rset_3.getString("fp_prop_desc");%>
<option value="<%=property_desc%>"><%=property_desc%></option>
<% } %>
</select>
<input type="hidden" name="property_desc" value="">
</td>
</tr>
<br>
<tr>
<td width="25%"> Property Description</td>
<td width="1%">:</td>
<td width="74%"><input type="text" name="property_desc" style="HEIGHT: 20px; WIDTH: 254px" value="">
</td>
</tr>
</table>
<br>
<table border="0" width="20%" align="center">
<tr>
<td><input type="submit" name="submit" value="Submit"></td>
<td><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
<input type="hidden" name="hid_value" value="A">
</form>
<% conn.close(); %>
</td></tr>
</table>
</BODY>
</html>
![]() |
Similar Threads
- Change char to int and store in an array (C)
- Change my IF statement to a loop (PHP)
- Needs help with If statement (Visual Basic 4 / 5 / 6)
- arrays and functions (C++)
- writing my own MID FUNCTION (Visual Basic 4 / 5 / 6)
- Extracting a field in a txt file (C)
- setTimeout prevents resetting of image (JavaScript / DHTML / AJAX)
- Array troubles? (C++)
Other Threads in the JSP Forum
- Previous Thread: chat program
- Next Thread: web tool for exporting data to MS Access
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web





