Raphael JS and Java web app - java

I want to use the Raphael Javascript framework to create some charts based on dynamic data coming from my Java web application. Is the only way to access this data from my web application through the use of hidden fields on my page which I can then lookup inside the Rapahel JS code?

A typical approach would be for the web application to send a JSON file which your javascript would use to drive the Raphael library.
Reference:
Using JSON in jQuery.
Ajax Tutorials

As Brock says above, then look at: http://www.highcharts.com/
Why reinvent the wheel? Unless you want the experience. Graphing is fun.

Related

Web Data Extraction and Form filling

I am currently beginning the development of a (UI?) backup from a Webplatform. It is not our platform and I don't have access to the source.
I just have the HTML-rendered view of the Form-Data of the elements I entered.
So the task is to browse to the HTML, store the data (XML/JSON) and then login to the site to fill out the forms again to resubmit the data...
At the moment I'm prototyping with C++ QtWebEngine.
What' the best way to do such a task? What are good frameworks for "browsing" the web and analysing HTML?
Solutions in c++/java/javascript (or a firefox-addon?) are preferred.
Thanks for your help!
same as DSL language interpreter use "Document Object Model (DOM)"
my advice : C# webform app and webbrowser control:
webbrowser.navigate([url])
WebBrowser.DocumentCompleted Event
WebBrowser.Document (read document and help about "System.Windows.Forms.HtmlDocument" )
maybe need inject some java script in
/*
please don't use this info for hack and attack
*/
You could definitely do something like this using Firefox's Addon SDK. In particular you should look into the PageWorker module that allows you to load and run JS code against web pages without showing the page - everything happens in the background.

jQuery and JSON to retrieve data from database in Java web app?

I am doing a Java web application project wherein it one of its purposes is to display all data from the database. It uses the Hibernate, Struts2 and Spring frameworks. However, I want the application to retrieve the data using jQuery and JSON. Would that even be possible?
How would I do that? And are there any tools needed to achieve that? I can't find any tutorials online. Hope someone could help! thanks.
Java script can be used in any HTML widgets. It is not necessary that should be spring , struts ,etc. ultimately all these frame works will spit the HTML outputs. So what you have to learn is how can you invoke a java script function in the HTML widget. For your refrence I would to give some example
<spring:bind path="accountForm.account.someData">
<SELECT name="<c:out value="${status.expression}"/>" size="1" onChange=dynDisplay();>
</spring>
So Here I am calling a method called dynDisplay() on selecting of the widget someData.like this you can call any function and perform any task using javascript or jquery.
Yes it is possible, and actually the best scope, i recommend you to read the following tutorials and examples and then come up with a solution:
To convert java objects to json and viceversa use Jackson
http://www.mkyong.com/java/how-to-convert-java-object-to-from-json-jackson/
A great tutorial on Spring MVC and Hibernate integration:
http://www.beingjavaguys.com/2014/08/spring-restful-web-services.html
To get a json response out of a web service with jquery
http://api.jquery.com/jquery.getjson/
Finally a simple Struts 2 and Spring integration example
http://www.mkyong.com/struts/struts-spring-integration-example/

Web interface for a Java application

I recently developed a whole system in Java that connected to a database and exports and imports the table content to an excel sheet. I used SWING for the user interface. the user will interact with it for authentication and file management.
Apparently the client changed the requirements, He wants everything from a Web Interface. My team leader advised to look through JSP.
What does JSP actually do?
Will I have to rewrite the User Interface in Web if I used JSP?
is there an more effective and efficient solution to do this job?
I would Appreciate a specific answer
I'm not sure what you mean by "specific answer", but here goes:
JSP is a kind of template language, based on Java, and a technology for dynamically generating HTML. It's a server side technology. Look here.
Yes, if you're going for a pure web/HTML solution, you'll need to completely rewrite the UI.
There are other frameworks for creating webapps, such as Vaadin or Play! Framework that may be "better" than JSP, but then there's a whole new API/framework to learn...
What does JSP actually do?
Will I have to rewrite the User Interface in Web if I used JSP?
is there an more effective and efficient solution to do this job?
and
I used SWING for the user interface.
and
exports and imports the table content to an excel sheet.
not, have to look at JavaFX 2
You will certainly need to rewrite the user interface if you convert to JSPs.
JSPs are essentially just a method for dynamically generating HTML (with the option to embed Java code to produce parts of the page).
It is still possible to run Swing applications from a web browser: you might want to take a look at Java Web Start. This will save you from having to do a complete rewrite.
1.) JSP is pretty much like PHP. It is server side scripting. When ever a browser request for a page (JSP page), server (mostly Tomcat or any application server which you deploy your JSP project) will generate HTML content using the JSP code. Mainly JSP consist of part HTML, JavaScipt (if you want dynamic stuff), and Java.
2.) As far as I know if you are aked to do it in JSP then you need to o all the client side work again in JSP. There you will be generating HTML UIs using Java codes. But you can use all the back end codes you used.
You may can use SWING in a Applet.

Web UI for existing Java application

I am trying to build a search engine using java and the lucene API as part of a project. For the last step, we plan to build a web UI (a local host would do) for the same. Are there UI softwares/plugins for eclipse which will allow me to call the functions present in the java classes?
Essentially I would want to have a search box and a search key, pressing which will throw up the search results(which is computed from the java program). javascript cannot call java code I understand. So using that is eliminated?
Any suggestions on what to use will be greatly appreciated. I have pretty poor knowledge in front end design!
Cheers!
AB
If all you have is a simple screen with a entry field and a button and you simply want to return an html table. I would go with a servlet and two jsps. Your servlet can call your search engine and then have the jsp format the data into the table. If you do not know web apis this is probably the easiest entry.
I think, If your using JAVA, that you should look into JSF.
It's a rather easy to maintain and work with library for just the uses you describe.
I recommend these tutorials to get you started: http://www.coreservlets.com/JSF-Tutorial/jsf2/#Tutorial-Intro
There are lots of options to achieve this.
you can create web-ui using jsp.
I have also created same type of project using Lucene, here i have used spring mvc.i have provided all the back-end process as REST api which any web-ui can use.
Please do not look into JSF; it is an overengineered pile for your task.
Sure you can call your java code from javascript, you can make it really simple with something like DWR.
However, for your project I would suggest GWT as then you only deal with Java and it will generate javascript, html and css for you.
For your project you dont really need an "enterprise" level framework like spring or a fullstack JavaEE, you could keep it real oldschool with only JSPs and html/javascript. However thats a bit too flaky for my taste, so go with GWT.
With GWT you basically set it up, define your module, entrance point (look at the hello world), and then you add a layout to your page like something to place the searchbox into and the resultbox to. Then you call your other Java code and classes from there like you normally would.
I would suggest you to use GWT in your application because GWT enables you to call java methods and it will also convert Javascript and css for your Java modules after GWT compile.
GWT reference :- http://code.google.com/webtoolkit/gettingstarted.html
If you're going to use GWT, you could aslo check Vaadin.
Creating a search UI is really simple, and the tutorial show a criteria /result table application taht could be adapted.

Use GWT for Ajax Website

Hello I am programming a website and like how GWT works. My host only supports PHP and no Java and thefore also no GWT. I was wondering if i could user GWT to program a fully Ajax website with php requests to the database so that it can run on my webserver.
Thanks
jan behang
The bridge between GWT and PHP
Google Web Toolkit (GWT) applications, apart from connecting to
servlets in time-honored Java™ fashion, can also use PHP Web services
to send and receive data in XML. You'll explore methods to generate
XML documents and process them, both in the Java language and in PHP.
And also check out Basic tips for using GWT with PHP as well. And also almost forget referencing GWT's own documentation, it will also teach you how to send JSON which is being widely used data format among AJAX developers. Here is the step-by-step explanation how to build the StockWatcher application using GWT with PHP: http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/GettingStartedJSON

Categories

Resources