program to test SMTP server - java

I have a program in Java using subethasmtp(a SMTP server library) to test if I can receive mails from another program correctly. I can get all the information that I want using this program.
Now I need to show all the information in a web page, what is the best way to do it?
I do not want a database to store the data, and I'm not so familiar with the front-end. Is there a way that I can push the information to my web? I want a light solution.
Thanks.

Try http://sparkjava.com/
It's a simple and lightweight Java web framework for rapid development. You can use it to generate a simple HTML page that display the data you have collected.

Related

How to connect an HTML GUI with a Java back-end, without hosting a server?

I am required to develop a MySQL database application with some GUI requirements which are efficiently met with HTML and CSS. So I am using HTML and CSS for the GUI.
I want to use Java programming language for connection with the database and other back-end functionality.
Most importantly, I do not want to host any kind of server.
So somebody has put this idea into my head: Use java for the back-end database connection, write a web service for your code, use HTML5/CSS3 for the GUI, and JavaScript to consume the web-service.
(I hope I got it right and I am saying it right)
Please tell me if this is possible, and if this involves having some sort of a server or not. I want these three things:
Back-end in Java
GUI in HTML
No server
Is there a way?

How does web interface pull data from server?

I'm a student, and I'm trying to learn web development.
For practice, I plan to make a fictional school website and the only feature it has is register students to the school. Student provides his name and when he clicks the "register" button, his name is inserted into the database.
So I made index.html which only has a textbox and a button, and made an insert function in java that inserts student's name into the database.
But the problem is, how does the web part call the insert function written in java?
Is there a way to have java code on server side, and html/javascript/css for front-end for web UI?
I know that the practice question I put out can be done using php, but in the future, I would like to make the front-end using things like Metro UI, and server side code can get complex, so I plan to keep it in java.
You need a server capable of executing Servlets. For example, Apache Tomcat. You will need to install this on your web server to run Java servlets on the server side.
The easiest way to do this is Java Servlets. But if this Site grow up, you have to use , in my opinion, frameworks such as spring, jsf and so on.

Getting Data from java Applet using PHP Zend Framework Webservice

I have to make a web-service in Zend Framework for getting data from java applet.
Basically its a game built using Java Applet. I want to store result in my website's mysql database.
So I am trying to make a web service using Zend_Rest_server which will be accessed by Java applet code and I will get result data through web-service and will store them in MySql database.
Let me know if my concept is wrong. OR if I can do same task in another easier way.
I gone through some online tutorial for Zend_Rest_Sever but all are basic.
I made simple server for getting a variable value. But its not working in java application saying "Path not fond" Might be due to zend framework routing url.
Thanks in advance
Have you set the Zend_Rest_Route(s) needed?
You might want to check this out: http://mwop.net/blog/228-Building-RESTful-Services-with-Zend-Framework

Remotely calling Java from php

I have a java program that runs on a couple different computers and I want to be able to be able to access them remotely. I don't need to do anything crazy, just some very basic input output (get and set type stuff). I could write a client type application and set each program to a server with RMI and do it that way but I will not always be on the same computer and do not want to have to carry the .java file around with me.
I'd prefer to write a simple php webpage that I can access from anywhere and have some very basic buttons that could send the commands to the different Applications and receive back some output.
Problems is that it would probably impossible to get my host to load anything other then php onto the server where I'd host my webpage.
Does anyone have any ideas? I've tried googling it and found a couple things out there that sort of sound like what I need but the more I look into them they seem to not be what I wanted after all.
If you really want to do this right I'd suggest looking at a Java web framework (I use Play! myself) to create a RESTful web service and then sending requests from your PHP code that will fetch JSON data.
A framework like Play will make it very easy to get a REST web service running. Just create some wrappers that invoke your existing java code and call renderJSON to output the result.
From the PHP code you'll issue the request using curl and then read the response using json_decode which will turn it into a handy php variable.
This also has the advantage that either end can be changed without the other noticing, as long as the json data format is kept the same.
Based on the way you described your setup you'll probably run into routing issues trying to reach your Java apps from your PHP host. I'd recommend you try something else: have your Java apps frequently check with your PHP app if there are any updates. You can simply use a Java URL connection and a timer:
http://download.oracle.com/javase/6/docs/api/java/util/Timer.html
http://download.oracle.com/javase/6/docs/api/java/net/URL.html

Sending HTML Form Data to Java

I have a Java program that I'm trying to interact with over the web.
I need to gather form data from the user on a Drupal site that I don't have any control over, send it to the Java program, and send the output back to the user. The Java program needs to load a lot of libraries every time it's run, so it needs to be up waiting for data from the user.
It'd be best for me to just have an HTML form for the input. What's the simplest way to deal with HTML form data using Java?
Also, I'm trying to call the Java program from a shell script. I want the program running in the background though so the libraries are loaded in advance. So ideally, I could use the server I set up for both applications.
Thanks for any help.
It sounds like you really just want to write a servlet (or use a higher level web framework, but a servlet would work fine). That makes it very easy to get web form data - you just ask for values by name, basically.
You could then "script" the application using curl, wget or something similar to make requests to the servlet.
Apologies if this doesn't answer your question - I'm finding it slightly tricky to understand exactly what you're trying to do, particularly as there are multiple layers of web UI involved, as far as I can see.
The easiest way to make POST requests with java is to use the Apache HttpClient or the more recent HttpComponents libraries.

Categories

Resources