but it always returns null in name
i used this type of statement in my othere jsp and it works fine but here
it is not
see the emp.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import = "java.sql.*"%>
<%@ page import = "pkgs.*"%>
<%!
public static String nulltostring(String obj){
if(obj == null)
{
obj = "";
}
obj = obj.replace('"',' ');
return obj;
}
%>
<%
MyConnection con=new MyConnection();
Statement stmt = null;
ResultSet rs = null;
String qry ="";
int i = 1;
try{
stmt = con.getCon(1);
}
catch(Exception e){
out.println(e);
}
String emp=request.getParameter("emp");
if (emp==null){
emp="0";
}
%>
<HTML>
<HEAD>
<TITLE> Employee Master </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Vaishali Pandya">
<META NAME="Description" CONTENT="Emplyee Master">
</HEAD>
<script>
function doenable(){
parent.f1.document.emp_menu.per.disabled=false;
parent.f1.document.emp_menu.off.disabled=false;
parent.f1.document.emp_menu.acc.disabled=false;
parent.f1.document.emp_menu.join.disabled=false;
parent.f1.document.emp_menu.exp.disabled=false;
parent.f3.emp_smenu.saveall.disabled=false;
parent.f3.emp_smenu.resetall.disabled=false;
}
</script>
<BODY BGCOLOR="B0B0B0" onload="doenable()">
<CENTER>
<h2>
Employee Master
</h2>
</center>
<%
String mode = request.getParameter("mode");
if (mode == null){
mode = "0";
}
if (mode.equals("1")){
String name=request.getParameter("ename");
String updqry="update hrm_employee_mas set emp_empname = '" +
name + "' where emp_employee_no = " + emp;
out.println(updqry);
// stmt.executeUpdate(updqry);
}
%>
<form name=femp method=post action="emp.jsp">
<%
qry = "Select * from hrm_employee_mas where emp_employee_no = " +
emp;
rs = stmt.executeQuery(qry);
if (rs.next()){
%>
<a name=personal>
Personal
<TABLE border=2 width="100%">
<tr>
<td align=right>Employee No
</td>
<td><input style="width:100%" type=text name=emp_no value
="<%=nulltostring(rs.getString("emp_employee_no"))%>">
</td>
</tr>
<tr>
<td align=right>Old Employee No
</td>
<td><input style="width:100%" type=text name=old_no value
="<%=nulltostring(rs.getString("emp_old_empno"))%>">
</td>
</tr>
<tr>
<td align=right>Name
</td>
<td><input style="width:100%" type=text name="ename"
value="<%=nulltostring(rs.getString("emp_empname"))%>">
</td>
</tr>
</TABLE>
</a>
<%
}
rs.close();
stmt.close();
%>
</form>
</BODY>
</HTML>
Hi Vaishali
Check This,,,,
if (mode.equals("1")){
String name=request.getParameter("ename");
if( !name.length() ==0 || !name == null) {
String updqry="update hrm_employee_mas set emp_empname = '" + name +
"' where emp_employee_no = " + emp;
}else {
out.println(name);
}
}
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com