• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scripts Vs. Java for web tools  RSS feed

 
Rooks Forgenal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone. Let me start off by saying I am new to applications that run in the browser. That sentence is not very precise but it is what I mean.

I am currently following a few basic steps to achieve the desired effect. The effect being the user thinks they are running an application on their computer when really the application is run on the server and they are given the results. Here is what I do.

1. Use a browser to follow a path directly to a Perl or PHP file. The address takes me to a server and finally opens a script file. However, because the server is setup for Perl and PHP it runs the srcipt instead.
2. I use Perl and PHP to assembly my HTML on the server and it is sent back to the browser as a functioning webpage with which the user may interact.
3. The user then checks some boxes, fills in some criteria and otherwise directs the perceived application on what they want it to do. Then they hit a GO button. The browser posts that information back to the script on the server, and that script uses the information to access a database, collect its results and return a newly manufactured HTML page complete with the desired information.

I wish to use Java somehow to assembly my HTML on the server using nothing but a browser, a link and a file. I was wondering if it works the same way as the scripts do. Can I have a *.class file on a server, direct a browser to it, have the server run the java to produce the HTML and have the server send me back the custom web page in return or do I have to keep using these scripting languages?

Is it possible to see a simple hello world written in Java that might achieve this goal?

RF
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, in its simplest form, and the Java term for that is "servlet".

You have to run a program (a "web application server") on your server which receives the HTTP requests, directs them to a suitable servlet for processing, and returns the resulting output (usually HTML) to the browser.

I could post the simple servlet which returns "Hello World" to the browser but that wouldn't tell you much. By which I mean, you wouldn't be able to copy it from the forum and paste it anywhere until you had done the groundwork of setting up the web app server. Which isn't a trivial task.

So... your google keyword is "servlet". Have at it and let us know if you have questions about what you find.
 
Rooks Forgenal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the nicest way anyone has ever told me to "Google it". Thank you.

Let's pretend that the part where I setup a web application server has been done for me. (because it has)
The person who set this up is unwilling to show me the simplest form of a servlet because this person is a Perl purest and servlets have no place in this person's world. The only reason it is setup and running is for legacy code support.

If I might be permitted to make an analogy: I think forks are very useful, but why should I eat my soup with one?

RF
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rooks Forgenal wrote:because this person is a Perl purest and servlets have no place in this person's world.

Yeah. Know the type.

If I might be permitted to make an analogy: I think forks are very useful, but why should I eat my soup with one?


I think more appropriate analogy for using Perl for modern web applications would be using a hammer to saw a board, but hey, to some carpenters, everything looks like a nail.

Servlet tutorials are all over the webs, make sure you find a modern one. This is especially important when you get to JSPs. Most JSP tutorials will teach you as if it's still 1998.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An easy to use servlet container (web server that can run servlets) written in Java is Apache Tomcat.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!