473,799 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in accessing bean

1 New Member
public class area
{
int id;


public void setId(int id)
{
this.id=id;
}
public String deleterecord()
{
String message="";

try{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("Jdbc:Odbc:my DSN","sa","");
PreparedStateme nt st=con.prepareS tatement("delet e from tbl_area where id=?");
st.setInt(1,id) ;
st.executeUpdat e();

message="record deleted";
}
catch(Exception e)
{
message=e.getMe ssage();
}
return message;
}
}
this is my bean class
-----------------------------------------------------------------------------------------------------
<%@page contentType="te xt/html"%>
<%@page pageEncoding="U TF-8"%>
<%@page import="java.sq l.*"%>
<%@page import="java.io .*"%>
<%@page import="java.ut il.*"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<jsp:useBean id="are" class="area.are a" scope="page">
<%
String s=request.getPa rameter("ares") ;
if(s!=null)
{

%>


<jsp:setPropert y name="are" property="id" param="ares"/>



<%
}
%>
</jsp:useBean>
<%
try{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("Jdbc:Odbc:my DSN","sa","");
Statement st=con.createSt atement();
ResultSet rs=st.executeQu ery("select id,aname from tbl_area where status='Y'");



%>

<form action="area.js p" method="get">

Select area:
<select name="areas" >
<option value="">select area</option>
<%



while(rs.next() )
{

%>
<!--<option value="saltlake ">saltlake</option>-->

<option value="<%=rs.ge tString(1)%>">< %=rs.getString( 2)%></option>
<%
}

%>

</select>
<br><br><br>

<input type="submit" name="Submit" value="edit">
<input type="submit" name="Submit" value="delete">
</form>
<%
}
catch(Exception e)
{out.println(e) ;}



try{
if(request.getP arameter("submi t").equals("del ete"))
{ out.println("su manta");
String delmessage=are. deleterecord();
out.println(del message);
}
}

catch(Exception E)
{
}

%>
can any help me solving this bcuz I can't delete data....
Mar 14 '08 #1
1 1236
Stang02GT
1,208 Recognized Expert Top Contributor
public class area
{
int id;


public void setId(int id)
{
this.id=id;
}
public String deleterecord()
{
String message="";

try{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("Jdbc:Odbc:my DSN","sa","");
PreparedStateme nt st=con.prepareS tatement("delet e from tbl_area where id=?");
st.setInt(1,id) ;
st.executeUpdat e();

message="record deleted";
}
catch(Exception e)
{
message=e.getMe ssage();
}
return message;
}
}
this is my bean class
-----------------------------------------------------------------------------------------------------
<%@page contentType="te xt/html"%>
<%@page pageEncoding="U TF-8"%>
<%@page import="java.sq l.*"%>
<%@page import="java.io .*"%>
<%@page import="java.ut il.*"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<jsp:useBean id="are" class="area.are a" scope="page">
<%
String s=request.getPa rameter("ares") ;
if(s!=null)
{

%>


<jsp:setPropert y name="are" property="id" param="ares"/>



<%
}
%>
</jsp:useBean>
<%
try{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con=DriverManag er.getConnectio n("Jdbc:Odbc:my DSN","sa","");
Statement st=con.createSt atement();
ResultSet rs=st.executeQu ery("select id,aname from tbl_area where status='Y'");



%>

<form action="area.js p" method="get">

Select area:
<select name="areas" >
<option value="">select area</option>
<%



while(rs.next() )
{

%>
<!--<option value="saltlake ">saltlake</option>-->

<option value="<%=rs.ge tString(1)%>">< %=rs.getString( 2)%></option>
<%
}

%>

</select>
<br><br><br>

<input type="submit" name="Submit" value="edit">
<input type="submit" name="Submit" value="delete">
</form>
<%
}
catch(Exception e)
{out.println(e) ;}



try{
if(request.getP arameter("submi t").equals("del ete"))
{ out.println("su manta");
String delmessage=are. deleterecord();
out.println(del message);
}
}

catch(Exception E)
{
}

%>
can any help me solving this bcuz I can't delete data....
sumantabardhan,

Welcome! It appears that your question will fall into one of or specific forums. Please check out the Java and JavaScript forms, and PM a moderator and ask them to move your post to the correct forum.


thanks!
Mar 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3632
by: Amy | last post by:
When accessing my JSP I get the following error: org.apache.jasper.JasperException: Missing message for key button.next Can anyone tell me what the problem is? I have tried to figure this out but am new to building webapps and struts. Thank you for your help. My JSP has : <html:form action="/ContactAction">
0
1505
by: Geno Timlin | last post by:
In Weblogic 7.x, I can define a bean using the Struts bean:define tag and then access the bean's methods in a script. But in Weblogic 8 the same code does not work. <logic:iterate name="myForm" id="myDTO" property="myDTOCollection" type="MyDTO"> <bean:define id="hyperlinkParms" property="hyperlinkParms" name="myForm" scope="session" type="java.util.Map"/> <% hyperlinkParms.put("Id",myDTO.getId());
1
1641
by: bhadram | last post by:
hello, Please help me the jsp problem. I used java bean and written the bean and copyied in WEB-INF/classes of particular application but the compiler cannot locate the bean it is giving error as: C:\Tomcat\work\Standalone\localhost\JSPTechSupport\techSupport_jsp.java:42: cannot resolve symbol symbol : class TechSupportBean location: class org.apache.jsp.techSupport_jsp TechSupportBean techSupportBean = null;
13
7232
by: Tom Bean | last post by:
I developed a C# application to automate input to elements of a web page displayed in an AxWebBrowser control. The app calls GetEnumerator() on the HTMLDocument's HTMLElementCollection (i.e. HTMLDocument.all) to walk elements of the document. This works perfectly on my development system with both Debug and Release builds, however, when I deploy the app to a client system running Windows XP Professional, it doesn't work. I added...
0
2283
by: kisc71117 | last post by:
When accessing my JSP I get the following error: org.apache.jasper.JasperException: Missing message for key "button.add" my error message javax.servlet.ServletException: Missing message for key "button.add" org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758) ...
2
2136
by: nvidia1 | last post by:
Hi this is my first post but so far this is pretty good site. I have a file called index.html with the following code: <!-- index.html --> <html> <head><title>Student Registration Front</title></head> <body bgcolor="#ffffcc"> <h2 align="center"><font color="#800000">Student Registration Webapp 2007</font></h2>
0
1373
by: radhi | last post by:
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <html:html> <HEAD> <%@ page contentType="application/msexcel" %> <% response.addHeader("Content-Disposition","inline; filename="+ "CONTRACTSAMENDMENTHISTORYEXCEL.xls" + ";" );
2
1500
dmjpro
by: dmjpro | last post by:
I have five source files. public class SpringAOP implements SpringAOPInterface { public void showMessage() { System.out.println("I m learning Spring+AOP, & i really enjoying dis :-)"); } }
0
2730
by: buk110 | last post by:
Hi everyone, I'm new to using JAVA and I'm trying to interact with a web service I wrote in C# I downloaded Netbeans & followed the instructions to point to the wsdl file I navigated to my WSDL file http://localhost/myService/myService.asmx?WSDL And Looking at the output of 'Web Services Manager' I see the following
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10249
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10025
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6804
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5461
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.