I'm looking a way to take a string (for example from a cell in excel, but it does not have to be from excel) and paste it in a form in a web page.
I prefer to do it in java but I didn't find anywhere how it's can be done in java.
Which way it's can be done?
Thanks.
Shaked.
You could consider using Selenium. It lets you pre-define a set of actions for a browser, including going to a certain page, fiddling with form fields, and submitting the form.
It is possible to program this with Java, and as you may know, you can also use Java to read from files on your computer.
Related
I am working on selenium. I need to print an html link in the form of link/hyperlink.
For example:
System.out.println("https://www.google.co.in");
Reporter.log("https://www.google.co.in");
The above one prints the google link in text format but how can we print above one as in hyperlink/link format.
Is there any possible way to do this in selenium and also in java?
If you use System.out.println(...) then you can only output raw text to the standard output. Now, if you want to be able to click on links in this standard output it is very important to know, how you're viewing this output. The standard way would be on the console or, with logging, maybe in a log file.
Links have to be supported by whatever displays those links if you want to be able to click them; some consoles do that automatically but many don't. And the same goes for text viewers. This has nothing to do with Java or Selenium.
What may make sense is if you're creating HTML files and viewing those with Selenium; in that case, you could of course create links, as any HTML browser will support them. But I doubt that's what you're currently attempting. (Correct me if I'm wrong.)
in my project I need to read some web pages. Usually it is pretty easy: I read the source code using java classes, parse the output and save interesting data.
But sometimes it is harder; for example reading Google pages. I think it is because of javascript. Do you know to get the real web page code, I mean without javascript? For example if I analyse the page using the Firebug extension of Firefox I read exactly what I need: javascript is correctly replaced by its results. Any idea to do it using Java?
Thanks in advance
The data I want is visible from the browser, but I can't find it from the html source code. I suspect the data was generated by scripts. I'd like to grad such kind of data. Is it possible using Jsoup? I'm aware Jsoup just does not execute Javascript.
Take this page for example, I'd like to grab all the colleges and schools under Academics -> COLLEGES & SCHOOLS.
If the dom content is generated via scripts or plugins, then you really should consider a scriptable browser like phantomjs. Then you can just write some javascript to extract the data.
I didn't check your link, and I assume you're looking for a general answer not specific to any page.
After scouring the web I have edited my question from the one below to what it is now.
Ok I seem to understand that I don't need all the capabilities of excel right now. I think i am satisfied having a data grid to display data. Basically i am working on Struts 2 and I wat my jsp page to have an excel like feel and hence looks like even a datagrid is sufficient. I came across This Technology
I am not sure whether I must go ahead and use it. Any other suggestions, alternatives are welcome
The older version of the question
"I have a java web application running on windows currently. I may host it in future in a Linux Server.
My application allows people to upload data. I want to display the data they have uploaded in an excel file and render it in a portion of my webpage.
How do I go about this ?"
Basically you would need to read the excel files, get the data in some kind of java objects, and then show it back to user as a normal HTML page with tables etc..
If you want to show the excel files in such a way that your users are also able to edit these then you need to look into javascript / ajax to make a UI as per your needs.
An easy and open source way of reading the uploaded excel files in java is via Apache POI. It is capable of reading .xls files as well as the newer OOXML .xlsx files.
http://poi.apache.org/spreadsheet/
They have very helpful examples which can get you started within 10 minutes..
http://poi.apache.org/spreadsheet/quick-guide.html
If you can allow data to go to another site, then you can use ZOHO. Their online Excel Editing is reasonably good and you don't really have to do anything much.
Maybe you can try http://www.jxcell.net:
It is a java spreadsheet component which allow you to edit your Excel via web page.
I have an excel file that pulls in data via data connection from bunch of CSV files. The CSV files are generated every now so often by a JAVA program.
Is it possible to refresh the data too via. JAVA program? I see JXCELAPI and JOI are there, but briefly looking at their documentation doesn't indicate my use case is even possible.
In short, I need API that could achieve this effect: clicking on menu Data->Refresh All.
Thanks,
_Madhu
You could try XLLoop. This lets your spreadsheet talk directly to a java server (or a number of other languages) via function calls.
So you can have your spreadsheet call eg GetMyData("somedata") and it will load the data directly from your server whenever you re-calc (ie. Shift-F9).
BTW, I work on the project so let me know if you have any questions.
This tutorial sounds like it might help: Accessing Excel from Java
You could also try Obba which is another solution to access a Java library via Excel cell functions (UDFs)...
However, what you describe could also be done by a very small vb/vba macro which checks/polls for modification of these CVS files. I don't know if this is suitable in your situation, but there is an event listener for that: http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.changed.aspx#Y0