Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Multiple url handling
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Dhananjay
Multiple url handling
2 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


I want to pick URLs from excel/CSV file and assign those urls to String variable and use that string variable to open the specified url from browser. I have written code to open browser using selenium libraries. Can you please help me in first part?


Advertisement
View Answers

March 3, 2011 at 5:26 PM


Read excel using jdbc:

Follow these steps:

1)Go to the start->Control Panel->Administrative Tools-> data sources.

2)Click Add button and select the Drive do Microsoft Excel(*.xls).

3)After selecting the driver, click finish button.

4)Then give Data Source Name,select drive, directory and excel file to be read and click ok button.

5)Your DSN will get created.

6)Then run the following code:

import java.sql.*;

class GetURLFromExcel{
    public static void main(String[] args){
        try{
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con = DriverManager.getConnection("jdbc:odbc:excel");
         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery("select * from [sheet$]");
         String url="";
         while (rs.next()){
             url+=rs.getString("URL")+" ";
         }
         String arrURL[]=url.split(" ");
         for(int i=0;i<arrURL.length;i++){
         System.out.println(arrURL[i]);
         }
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
}


March 11, 2011 at 10:58 AM


is there any other approach using jxl APIs or so.. because this would be distributed to different users and user may not have access to create the DSN.



Related Tutorials/Questions & Answers:
Multiple url handling
Multiple url handling  I want to pick URLs from excel/CSV file and assign those urls to String variable and use that string variable to open the specified url from browser. I have written code to open browser using selenium
Handling multiple buttons in HTML Form
Handling multiple buttons in HTML Form  How to handle Handling multiple buttons in HTML Form
Advertisements
Handling multiple combo boxes of same name - IDE Questions
Handling multiple combo boxes of same name  my code is like this.. i'm displaying two combos of same id.. on the browser..if user wants he can
Exception Handling : Multiple Catch
Exception Handling : Multiple Catch In this tutorial, we will discuss the use of declaring multiple catch  with the try block. Multiple Catch : A try statement can have multiple catch blocks. Through multiple catch
URL Encoding and URL Decoding
URL Encoding and URL Decoding  What is URL Encoding and URL Decoding ?   URL encoding is the method of replacing all the spaces and other extra characters into their corresponding Hex Characters and Decoding
Struts2.2.1 handle multiple Submits in your application
Struts2.2.1  handle multiple Submits in your application  In this tutorial, We will discuss about the handling the multiple submits... at a time and other can not aquired and on multiple submit generates error
Friendly URl
Friendly URl  creating a SEO friendly URL
URL problem
URL problem  Hi. I have created a webpage for my project website. in that i have used frameset to split the page. Now if i click any link in the page its navigating to the another page. but the problem is here in the url its
exception handling
exception handling  explain about exception handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
hide url
hide url  how i can hide url i have lot of jsp pages when i call one jsp in address another jsp page name also displayed in the address bar? url not visible to endusers please tell me any answer what i should do
Assigning URL
url to my attendancetemplate.jsp file, please help me if anyone knows, am
event handling
event handling  diff btwn event handling in ASP.net and in HTML
Handling Multiple Catch Clauses
Handling Multiple Catch Clauses   ... block.In java when we handle the exceptions then we can have multiple catch blocks... of multiple catch blocks for a single try block.  
exception handling
exception handling  could you please tell me detail the concept of exception handling
File Handling
File Handling  how we do file handling of parsed XML code bu DOM in java
php download file from url
php download file from url  how to download multiple files in PHP using the URL's
exception handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception
Append Arguments to the URL
Append Arguments to the URL  Hi, How to append the query string to the Current Url when i click on a link. AM using Spring MVC i.e. My URL : http://localhost:8080/Sample/SampleApp?id=1 In my page having multiple links (a href
exception handling
exception handling  What is an exception and what are the advantages of exception handling mechanism.   Java Exception Exception... the working code and the error-handling code can be disintegrated. It also gives us
AdminStrator handling
AdminStrator handling  Hi...Deepak,I want code for adminstrator like adminstrator can handle multiple clients i.e. if adminstrator is adding any file then making it available for all the clients.How to make this availability
long url to short url for jsp or servlet
long url to short url for jsp or servlet  I have to convert a url "http://localhost:8080/Popup/popup?phone=111111111". I am unable to do the same. Please any help
 

 

 

DMCA.com