Java to JSP?

I haven’t done Java in a long time - bare with me.

I have a Java program that I need put on the web. How does one do this? This program will supposedly read a smartcard and get information from it. I need this information then sent to my script upon form submission.

How do I go about this?

You need a webserver. Such as Tomcat or Glassfish, which require it to be packaged as a WAR.

I have no idea what your project looks like, but if it isn’t already set up to be packaged as a WAR it’s probably going to be a simple task. It’s going to require some learning and boilerplating. Java is not good at just throwing simple scripts on the web, it’s more for large established apps. Looking for shortcuts to do this is probably just going to lead you down a path of overly complicated convoluted middleware that doesn’t get you anywhere. If it’s not a native web app, your best bet is probably going to be to write your own PHP script (or whatever your main language is) to interface with the Java app.

here’s a decent StackOverflow question

edit:

Also, forget about JSPs. They used in conjunction with Servlets, they probably don’t work the way you think they do. I’m only saying this because I’ve seen other people unfamiliar with the Java landscape get confused by this.

Unfortunately due to the nature of this program, this can only be done in Java or .NET. You will have to trust me when I say there is no other language possible.

And .NET is ruled out due to the servers we run. We have 1 server that can run .NET and that’s not one I’m allowed to do willy nilly tests on. This will have to be Java.

Ignorance here - is it possible to just have this script and run it as a Java applet? I know security concerns would normally go against this; however this will be a closed application.

You’re writing this yourself?

The script is already made. I just need to make it workable on the web. However that goes. The program doesn’t look to be built to allow it to be ran on the web (took a year of Java and this doesn’t look like it has web capabilities.)

Does it have a WEB-INF folder? If it does, then it probably can be. If not, then probably not.

As far as running it from PHP (or something else), that assumes it has a CLI. You would use something like exec() or an equivalent.

Could you rephrase this? Beginner ignorance.

Edit- reading that thread now. One moment.

Most Java Web apps have a folder in them named WEB-INF. It’s just a folder, it contains some stuff that tells it how to be a web app.

Unfortunately no.

The script I found is simply from a PDF documentation guide with a sample demo. It has some include statements, then begins writing some classes and println’s.

The exec function looks promising though. I’d just make my .java file into a .jar and php exec it? Any other strings attached?

Edit-going to lunch. Chicken parm is calling my name.

Pretty much. It interfaces with it just like you would on the command line. As far as strings attached, Not that → I ← know of, but there may be. I’ve only done that a couple times.

Stupid tourist season…still no chicken parm…

I’m working on that now; I’ll report back if I have any issues. Thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.