•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 402,807 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,054 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1052 | Replies: 4 | Solved
![]() |
•
•
Join Date: Jun 2008
Posts: 35
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
my adduser.jsp page consist of form with field username,groupid like.
I am forwarding this page to insertuser.jsp. my aim is that when I submit adduser.jsp page then the field filled in form should insert into the usertable.The insertuser.jsp is like:
But showing error at the above red lines as:can not symbol
method updatestring(java.lang.string))2.')' 3.';' expected.
Really Speaking I am newbie in this java world.
waiting Your valuable suggestion.
Thanks and regards
haresh
my adduser.jsp page consist of form with field username,groupid like.
I am forwarding this page to insertuser.jsp. my aim is that when I submit adduser.jsp page then the field filled in form should insert into the usertable.The insertuser.jsp is like:
String USERID=request.getParameter("id");
String NAME=request.getParameter("name");
String GROUPID=request.getParameter("group");
InitialContext context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:comp/env/jdbc/mynewdatabase");
Connection conn = ds.getConnection();
context.close();
Statement stmt=conn.createStatement();
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("select UserId,GroupId, emailid from user");
rs.next();
rs.updateString("userId=+"id"+");
rs.updateString("GroupId=+"group"+")
rs.updateString("emailid=+"name"+");
rs.updateRow();
rs.close(); But showing error at the above red lines as:can not symbol
method updatestring(java.lang.string))2.')' 3.';' expected.Really Speaking I am newbie in this java world.
waiting Your valuable suggestion.
Thanks and regards
haresh
Last edited by peter_budo : Jul 9th, 2008 at 4:45 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Jun 2008
Posts: 35
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
my adduser.jsp page consist of form with field username,groupid like.
I am forwarding this page to insertuser.jsp. my aim is that when I submit adduser.jsp page then the field filled in form should insert into the usertable.The insertuser.jsp is like:
But showing error at the marked lines lines as:non static method executeupdate can not be referenced from static context.
Really Speaking I am newbie in this java world.
whether you have any other solution for above issue?
waiting Your valuable suggestion.
Thanks and regards
haresh
my adduser.jsp page consist of form with field username,groupid like.
I am forwarding this page to insertuser.jsp. my aim is that when I submit adduser.jsp page then the field filled in form should insert into the usertable.The insertuser.jsp is like:
<% String USERID=request.getParameter("id");
String NAME=request.getParameter("name");
String GROUPID=request.getParameter("group");
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mynewdatabase","root", "root123");
PreparedStatement st;
st = con.prepareStatement("Insert into user values (1,2,4)");
st.setString(1,USERID);
st.setString(2,GROUPID);
st.setString(4,NAME);
// PreparedStatement.executeUpdate();//
}catch(Exception ex){
System.out.println("Illegal operation");
}
%> But showing error at the marked lines lines as:non static method executeupdate can not be referenced from static context.
Really Speaking I am newbie in this java world.
whether you have any other solution for above issue?
waiting Your valuable suggestion.
Thanks and regards
haresh
Last edited by peter_budo : Jul 9th, 2008 at 7:21 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,239
Reputation:
Rep Power: 10
Solved Threads: 270
- Accessing database from JSP is wrong thing to do, you should access DB only from servlet
- The
PreparedStatement.executeUpdate();should best.executeUpdate(); - Closing connection on the end would be nice
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
•
•
Join Date: Jun 2008
Posts: 35
Reputation:
Rep Power: 0
Solved Threads: 0
Dear sir,
Thank you very very much for your valuable suggestion.Sir I hertly wish to thanks for your post. I am one of the java newbie working at one company client office independantly.
I am stuck at that code nearly 3-hours and your one post couses me become tension free.
Thanks a lot.
Your faithfully
Haresh
Thank you very very much for your valuable suggestion.Sir I hertly wish to thanks for your post. I am one of the java newbie working at one company client office independantly.
I am stuck at that code nearly 3-hours and your one post couses me become tension free.
Thanks a lot.
Your faithfully
Haresh
•
•
Join Date: Jan 2008
Posts: 12
Reputation:
Rep Power: 0
Solved Threads: 0
If the problem is solved, please close the thread. Else see this
http://jspcodes.elementfx.com/codesn...d=3&category=1
http://jspcodes.elementfx.com/codesn...d=3&category=1
![]() |
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access advice breach broadband business code combo crime cult of the dead cow daniweb data data protection data transfer database drive dropdownlist encryption europe forensic forensics gadget google government gpt guid partition table hacking hard hardware help hitachi hp industrial espionage information internet mobile module net news partition payment services privacy protection reuse search security storage terabyte tv web wikipedia
- Mismatch Type Error (JSP)
- Problems in inserting data into MySQL table from JSP.... (JSP)
- problem in inserting data in msaccess (JSP)
- Problem inserting data into database (JSP)
Other Threads in the JSP Forum
- Previous Thread: Sending a message to JSP
- Next Thread: JSP ERROR



Linear Mode