Disclaimer: If there is a similar question, I haven't found it and I apologize.
The thing is, I am in the middle of a hackaton with an inexperienced team. I am familiar with java, but there for frontend and they work in java. The thing is - nobody knows how to connect frontend and backend of a web app which we have to build.
Is there a way to make java communicate directly with javascript, maybe through a library or java class? I am asking that because we want to design a web app only in CSS/JavaScript.
If there is no way, could we make an invisible Java Applet which would be a "medium" between java and javasript, but does not require space on the page or interfere with design in any way?
I apologize again if the question is a closed discussion, or just plain ignorant, we're note here to win, but to learn without completely disgracing ourselves :)
Typically you would define a REST endpoint in Java, then communicate with the Java using an AJAX call from the Javascript.
Related
I am decent (or so I like to think) when it comes to making java swing applications, but I want to make the jump to web applications.
The problem lies with the fact that there's so much going on and so much different terminology being thrown around. I have no idea where to begin and it seems very daunting.
I've read up on a few things such as JSP and GWT, but I still can't seem to be able to make the jump. My question is: is there a specific flow used when making a web application to make everything seem to connect better, and if possible, could you recommend a good starting point for someone like me that comes from a solely desktop gui environment and wants to start developing web apps? Thanks for the help!
Both Swing and Web application still rely upon java keywords and terminology. java web technology work better when you use a framework . I suggest you start with Spring. It has MVC library that you can use, plus spring mvc has a large community online. However, Java Servlet is quite similar with what you have learn in java.
I'm pretty new to web development, so I had some basic questions to get me pointed in the right direction.
For the last week I've been learning the rails framework, and from what I understand, this framework is great for building a website, but you still need javascript to build nice front-end interface/apps that run in the browser. Is this understanding correct? If not, why does javascript appear to be so essential to almost al websites? In other words, what can you do with js?
Also, I was wondering if it is necessary for me to learn javascript now that there are tools like GWT that compile Java into js. I ask because, I am proficient in Java but have no knowledge when it comes to javascript. How far can GWT take me before I need to learn javascript, or do I have to learn javascript at all?
If someone could point me int he right direction by answering these questions, I'd be very grateful.
Thanks
GWT compiles Java to JavaScript, but you still will need to learn about web development.
I have seen many projects going wrong with GWT because people just started writing Java code and did not care about the underlying platform (the browser) at all.
If you don`t want to care about the browser use some plugin technology (if you are an app inside a controlled environment), otherwise first learn about how to build apps with HTML + JS + CSS.
Eventually you will discover that GWT is a great toolkit for writing fast JavaScript apps in Java, that packs many best practices for building web apps inside the toolkit. It has good abstractions, but every abstractions leaks so you will need to have good knowledge of the browser. You will save on things like keeping away from the bad parts of JavaScript.
I'm working with GWT now, and I haven't had to use Javascript at all yet. I'd say for most websites, GWT should be fine.
I'm trying to access Java from actionscript 3, so is it possible to call a Java class in actionscript 3?
If it is then how?
We need more information. Directly from flash, no. Is this a regular swf or an AIR app? Is it a java process running, or is it an applet on the same page? If it's a swf and an applet, it should be possible to bridge communications via javascript.
Actually there is an open source project which does just that. I'll be damned if I can recall the name offhand though.
You might also take a look at http://www.gotoandplay.it/_articles/multiplayerCentral/tutorials/pro_javaInAS.php
But again - as these guys have correctly stated above - all we really can do is throw random shotgun tidbits of information at you without a more specific question. What's you goal? What do you want you app to do? have you got some code you code post?
Have a look at Flerry which uses Air's NativeProcess API.
But I doubt that it will be possible to call Java from a non Air application because of flash player restrictions.
If you don't mind going with .NET - I heard someone say good things about WebORB.NET integration server. Wish I could be of more help Java wise.
I just started working on a project which will about making a big website.
With big i mean:
Webshop
Forum
Normal Website (Information pages etc..)
At first i just wanted to pick a decent open-source webshop and just built my site around it.
But then i started thinking about how to expand etc.
I started to think how i would like this website to be acces from a mobile phone. Not just with a browser but with an App. (I have decent experience in making apps for Android & Iphone). So the real question is:
Would it be smart to make the "Core" of my whole website in Java and use services to acces it and thus allowing different frontends to use the same "Core". Like:
- PHP for browser frontend
- Java (android) for the android App
- Objective C for the IPhone App.
And let them all just communication to the "Core" through REST (Json).
What will be the advantages / disadvantages with this approach and will there be a significant delay in rendering eg. a webpage (http request to php, then php making calls to java server (different physical server) then accessing the database and then returning it all, so php can format it to HTML).
Hope hearing some answers or suggestions!
I would skip the Java layer and make the "core" PHP. There is a wealth of tools and frameworks (like Zend FW) for building thoses components in PHP. Design your application around a REST interface and allow your mobile apps to use REST.
Better yet, use Rails. It's so easy to design and set up a REST interface.
I think your solution is “smart”. The only changes I suggest are:
Use the same platform to build both the "core" and the "browser frontend." This way you will have more productivity.
Keep the "core" and "browser" frontend on the same server, if possible in the same process. Unless you have a reason do it differently. This will reduce problems with performance, latency and so on.
If you're already familiar with Java I would suggest you look at something like GWT (or GWT + third-party libraries like Ext GWT or Smart GWT) for your front-end. I don't see the point in picking another language for the front-end unless you really want to learn something else (e.g. PHP as you suggest in your question).
I think the rest of your approach is sound (i.e. Java on the backend, providing RESTful services, etc.)
I have just been looking at the GWT and i am impressed by what i have seen but i do not really understand how it is used to when creating web applications.
For example, when im programming in PHP or JSP creating a simple app that lets users register, adds the detailes to a database and then allows them to login is pretty simple but i was wondering how GWT does this?
When doing this in GWT, would GWT widgets be used to construct a frontend(client) that accepts user input and then sends it to a server which is written using pure Java, the Java then does all of the data processing and database interfacing?
If my understanding is correct, is GWT just a way to write javascript frontends in an easier way?
Have you looked into the GWT Overview? I think this line explains it the best:
The GWT SDK contains the Java API
libraries, compiler, and development
server. It lets you to write
client-side applications in Java and
deploy them as JavaScript.
Basically, you write your code in Java, all the while using the GWT to create complex UI's, etc. When you "compile" it, it is highly optimized JavaScript that translates well to multiple browsers, including web platforms.
Whatever language you want to use server-side does not matter - ASP.NET, PHP, etc - it will all work with GWT because GWT is, ultimately, JavaScript.
Basically, Google is trying to make it simple to develop web applications in a familiar language, and doing all the underlying work for you. I'm sure there is someone else who can further expand on the capabilities and advantages of GWT, but I hope this helps!
Exactly. "In the end, it's just JavaScript", you can "Use the backend language of your choice"