• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scripts Vs. Java for web tools

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An easy to use servlet container (web server that can run servlets) written in Java is Apache Tomcat.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic