Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What is the difference between an Applet and a Servlet and what are a few examples on how each of them are used? I am new to networking am I am wondering how these things are different.
From Wikipedia: A Java applet is a small application which is written in Java and delivered to users in the form of bytecode. The user launches the Java applet from a web page, and the applet is then executed within a Java Virtual Machine (JVM) in a process separate from the web browser itself. Applets are used to provide interactive features to web applications that cannot be provided by HTML alone. They can capture mouse input and also have controls like buttons or check boxes. In response to user actions, an applet can change the provided graphic content. This makes applets well-suited for demonstration, visualization, and teaching.
A servlet is a Java programming language class used to extend the capabilities of a server. Although servlets can respond to any types of requests, they are commonly used to extend the applications hosted by web servers. Servlets are the Java counterpart to other dynamic Web content technologies such as PHP and ASP.NET. In other words, a Servlet is an object that receives a request and generates a response based on that request.
An Applet is for client side execution, generally graphical components.
Servlet is for server side execution, with no graphical components, but can return HTML or any kind of data (generally called a service).
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Can C++ be used as back-end and Javafx as front-end in the same Application?
And if I do this will the application be an executable (.exe) ? Otherwise is there any way to make it an Executable (.exe) ?
**Edit: Reason - I've got some problem in developing GUI applications with C++. **
You could create a server/client system, where the server is C++ and the client is Java, communicating with some sort of IPC between them. Once there is a disconnect between components, they can be any combination of languages. I'm currently working on a system, where the front end is C# (GUI) and the back end is VB.
Keep in mind that a GUI is about displaying information. There is no rule that says that processing and displaying needs to happen in the same application; written in the same language.
In other words: you "only" need an abstraction layer that allows you to retrieve data from the C++; and to use services on the side.
Your C++ side could provide a RESTful API; or you use JNI to make native calls. Various possibilities, but all of that: advanced topics.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm thinking about writing a desktop application that the GUI is made with either HTML or PHP, but the functions are run by a separate Java or python code, is there any heads up that I can look into?
There are a couple of possible options:
Run your backend code as an embedded HTTP-server (like Jetty* for Java or Tornado* for Python). If the user starts the application, the backend runs the server and automatically starts the web browser with the URL of your server. This, however, may cause problems with the operating system firewall (running a server on the local machine)
You could also have a look at CEF (chromium embedded framework). It is made for exactly this purpose (running an HTML-Application inside your code). It uses the same codebase as the chromium (and chrome) web browser. It was developed originally for C++, but there is also a Java binding: java-cef
Oh and by the way, PHP is a server-side language. I would not recommend to use it in your scenario (since your backend code is Python or Java).
*I have not enough reputation to add more than two links, so you'll have to google those ones yourself.
You could expose data from Java or Python as JSON via GET request and use PHP to access it. There are multiple libraries for each of these languages both for writing and reading JSON. GET request can take parameters if needed.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to create a static web page (same content to all clients).
In the meantime, I want to run the site as follows:
- Double click on the html file. (So if I'm not wrong, I don't need server side, i.e apache tomcat).
(I want this for now, in order to make progress in logic)
The static web page will contains:
browse button
OK button
(by 1&2) when the user choose a file and click OK I want to open a tcp connection to a remote appliation and exchange some data.
Several Q's:
How can I use java code (to send/recive messages) in HTML files (after the user click on "OK") ?
Do I need to use JSP & TOMCAT ?
(I want somthing that will be use for my interest only, and will not be as a internet web page)
If you reliably want to run code on a web page without interacting with the web server to do so, you need to use a language native to the browser.
As of 2015 that would be Javascript (which is a very different language than Java).
Interacting with the web server is then typically done with AJAX calls, where the part of your code running inside the browser exchange data with the part of your code running inside the web server. The front end code is again typically written in Javascript and the backend code in whatever the web server supports.
Note that after you have done some initial experiments, most likely will need a framework to make this easier to do for non-trivial behaviour.
#1: I am not sure what you are heading for, but Google Web Toolkit could help. Basically it splits your application in a client and server part, all written in java, but the client part gets compiled to javascript. This way you can develop all in java and bootstrap it within ANY html page.
#2: Easiest way would be to write the server in java and host its war-file with a jenkins. But there are much more possibilities including a non java server.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I loved the diversity of java ever since my first time using it. With that said I have tried to use it to its fullest. I am in the development of a computer game, android game, and website. Yay me. My problem is that I've been learning html, css, and a little bit of javascript for use in an eclipse dynamic web project. I don't see where or how java plays into the equation. To summarize I am asking for an explanation of where java would be used inside of a dynamic web project and maybe an example.
What I have now: http://192.168.43.194:8080/Pointlight_Productions/homepage.html
Dynamic web project is an Eclipse term, as far I know. When you create a Dynamic Web Project, you're typically telling Eclipse to manage your project as if it were intended as a web application to be deployed on a Servlet container. Eclipse will compile your source and resources and produce a .war file that you deploy in a Servlet container (Tomcat, Glassfish, etc.)
A Servlet container is written in Java. But this is provided. You write Java server code. In other words, you implement a number of Servlet classes that handle requests and generate responses.
For example, you might want to show a customized page for a user in an HTTP web application. Your Servlet would receive an HTTP request containing the name of the user. Your Servlet (or the services it depends on) would look up the name in some database, retrieve all the information for the corresponding user, and generate an HTTP response, possibly HTML, that would display that information.
Reading:
Our Servlet wiki page
How do servlets work? Instantiation, sessions, shared variables and multithreading
Java EE 7 Tutorials
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need some suggestions if the below idea for my web-service is feasible and if so, some pointers on how to implement the same.
Web-service Request: Request number
Web-service response: Java Jframe popup on users desktop with details of the request queried from the database.
This web-service would get triggered by clicking on an hyper-link in email notification sent to the user.
I cannot write any code on the client side to read the web-service response and then populate the Java frame.
So is it possible for my web-service to pop-up the JFrame on the users desktop when they query the web-service?
If so, how would I configure my response in the WSDL?
The web service runs on the server, the JFrame would run inside a different JVM on the client. So no, the web service can't trigger a JFrame to be shown on the client.
In fact, the web service can't force the client to do anything whatsoever. What the client does with whatever information the web service provides it is totally up to the client, which can be anything, from a Java Swing application (which could use it to display something in a JFrame) to another web service written in Perl (which would likely use it as input for another call or response to something) to an ASP web application (which might display it on a website as a graphic or table of data), to an Oracle SQL query (which may use the result to enter data into a database table which might in turn trigger something else to send an email for example).
That's the very nature of web services, they're utterly agnostic of what and who calls them.