Jump to content

Compiled languages and PHP


Synook

Recommended Posts

Have you ever tried using JAVA from console?
Yeah :) System.out.println("Hello 2D World!"); and much more.
JSP works on the same principle - the standard output is the HTTP page, instead of the console screen. And instead of having only JAVA code, you have, yes, similarly to PHP and ASP.NET - HTML with embedded server side script. So, whatever you can do in a console, you can do the same in JSP.
So in the end, say if my application uses only the console, and if I make sure to insert the appropriate <?jsp ... ?> tags (php style) within html, I can copy/paste my java application into the web and it will work instantly the same as in my local application? Or is there difference between used libraries, or even language? I tried once to convert PHP to Java, and I ended up changing a lot of the language constructs to deal with the differences. But is the script in JSP not that different to java?
Link to comment
Share on other sites

I'm not sure how the I/O works with JSP, but AFAIK, it's slightly different than a JAVA console program. Still, even though the actual syntax is different, the basic idea is the same - an input arrives in some form, you process it with JAVA code, and output some text (that can happen to be HTML, an image or something else) in some fashion. See a JSP tutorial if you're interested.

Link to comment
Share on other sites

I've actually read that JSP online tutorial and I have started reading the Head First JSP and Servlets book. You can write embedded java code within your JSP page kind of like in php. There are different JSP tags that allow for embedding different types of java code within your page (directives, scriptlets, declarations, etc). However, that online tutorial shows how to use JSP in a spaghetti code manner where all your business logic is mixed in with your client-side code, kind of like when you first learn php. If you create a Java web app within an IDE like NetBeans, it sets up your JSP application with a bunch of folders for organizing your files and using a MVC design pattern where you can have your JSP pages as your views and your java files will be used for your servlets (controllers) and models. Using an IDE like Netbeans made it pretty easy to set up and run, since trying to set up a web server and a servlet container (tomcat) can be really confusing especially for beginners like me. Now what I don't know is what the IDE did behind the scenes to make it easy for developers to set up a Java web app. If I had to create one, I wouldn't know how to do it without NetBeans :)

Link to comment
Share on other sites

thanks for the diagram. so what are steps 3 and 6? the module that routes to the php or jsp interpreter?Btw, I was using the word container because that's how it is referenced on the home site and in the head first jsp servlets book. But in any case, looks like it plays the same role as the php interpreter.
The words container and wrapper have to be two of the most abused words in the history of internet languages. I have stumbled on these numerous times in numerous contexts and proceed with trepidation with each new encounter. The problem is that developers, designers, and users are often careless readers and usually very bad writers. Although it is common to assign specific meaning to a general use word, the problem begins when someone else assigns other specific meaning to the same word in a different context. He does this, because he does not properly understand how the word was used in its original context, or because he likes the term and has no respect for the author of the original formulation. This same phenomenon repeats itself over and over again until any specific meaning that the word once had is so diluted that it is better discarded all together and returned to the language from which it was taken for general use.Another word with which I have had similar trouble is the term property. It is likely that a linguist interested in computer language could write a book about these sorts of abuses and other similarly related phenomena in the IT industry. In short, IT is a linguistic jungle. It is why I prefer primary source computer manuals -- despite, their totally unaesthetic use and overly structured appearance.Roddy
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...