473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Redirect

In servlet use the REDIRECT
If I send the file,this file is updated data this can be updated in the database ?
EXPLAIN ME?
Sep 30 '07 #1
1 1229
Dököll
2,364 Expert 2GB
Greetings!

I did not understand what you said here, not your English, I think it's great, I just did not get it. I do suspect you need to update using a Servlet. It's been a long day, and I truly cannot explain how a servlet works. Please turn below code into a Servlet code. Tips; you'll need to remove 'public static void main(String[] args) {'...

Expand|Select|Wrap|Line Numbers
  1. import java.sql.*;
  2.  
  3. public class YourUpdatingData{
  4.   public static void main(String[] args) {
  5. //make a connection to your driver
  6.     Connection con = null;
  7.     try{
  8.       Class.forName("add your driver info here");
  9. //start connection to DB
  10.       con = DriverManager.getConnection(
  11. //example here uses odbc
  12. "jdbc:odbc:Northwind","root","root");
  13. //run your sql to grab data and update
  14.       try{
  15.         String sql = "UPDATE YourTable SET ThisField = ? WHERE ThatField= ?";
  16.         PreparedStatement prest = con.prepareStatement(sql);
  17. //display your results
  18.         prest.setString(1,"ThisAndThat");
  19.         prest.setInt(2,00000);
  20.         prest.executeUpdate();
  21.         con.close();
  22.       }
  23. //throw an errr if you do not like what is happening
  24.       catch (SQLException s){
  25.         System.out.println("Statement did not run!");
  26.       }
  27.     }
  28.     catch (Exception e){
  29.       e.printStackTrace();
  30.     }
  31.   }
  32.  
  33.  
Here's a tutorial on building your own Servlets

Java Servlet Technology

Looks like you can get sound exaplaination from the good folks @ Sun;-)

Good luck!
Dec 24 '08 #2

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

Similar topics

10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
3
by: Paul | last post by:
I'm not getting the results I want when I use Response.Redirct in a ASP page. I enter this line of code in a asp page from domain1.com. Response.Redirect...
7
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script...
1
by: Peter Kirk | last post by:
Hi there I have a program written by another company (it's a "web control" which returns a web-page: can I compare this to a servlet in the Java world?), which they think is causing problems on...
2
by: Mark Dengler | last post by:
Is it possible to do a Response.Redirect to multiple URLs? I have tried the following and it simply ignores the first redirect: Response.Redirect("test.aspx", false);...
3
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The...
6
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx...
6
by: Peter Row | last post by:
Hi, I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response redirect or not. Specifically I need to know...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
10
by: Eirik Eldorsen | last post by:
How can I 301 redirect www.example.com/default.aspx to www.example.com without using ISAPI filters?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.