This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello I am a bit new to java since I was coding in php,vb,asp. I have now got to make a Java+MySQL application/site. I understand JSP is for website like php,asp,cfm. Applet is for embedding in the browser. So what if I need to make an application that is accessed by clients from the server ? Normally these are done using sites via the browser. But i read that using Java Web Start it is possible to run server apps ? How doe this work and what is j2ee ? Thanks for any help ! Anjanesh
You are asking some pretty big questions in your post; so much so that there are books dealing with just the individual parts of your question. Here are some quick summaries for you. But ultimately, you have a lot of research and learning ahead of you to fully answer all your questions.
So what if I need to make an application that is accessed by clients from the server ? Normally these are done using sites via the browser.
You can write Server side code using Servlets, JavaServer Pages (JSP), JavaBeans, Enterprise JavaBeans, and other Java code. These can then interface with other server side Java applications or resources like Databases, Networks, file systems, etc using various Java APIs. All of this is integrated into a Web Application and deployed using a Web Server or Application Server that contains a Java Servlet Container. A client can interact with the Web Application using a standard web browser. Read any of the fine books on Servlets and JSP for more information. Be aware that the Servlet & JSP specifications have changed a lot over the years. The most recent spec is Servlet2.4/JSP2.0, but since it is so new, many of the Web Servers and Application Servers out there only support the Servlet 2.3/Jsp1.2 Spec at this time. (Also only a few books cover the new 2.4/2.0 spec). I would avoid any books or web servers that only support specs older then 2.3/1.2.
i read that using Java Web Start it is possible to run server apps ? How doe this work?
J2EE is Java 2 Enterprise Edition. It is a group of API's that can be used in addition to (or "on top of") Java 2 Standard Edition (J2SE). It contains API's that are usually used for larger applications or server side applications. It contains API's (such as the Java Database Connect (JDBC) API as one example) that are not part of J2SE and are therefore not contained in the Java Runtime Environment (JRE), also now as the Java Virtual Machine (JVM), installed on a typical client.
I have now got to make a Java+MySQL application/site.
If this is your goal, you will likely want to start by learning Servlets & JSP, JSTL (Java Standard Tag Library) and then learn JDBC. Those are all pretty large subject areas. You should be sure to plan for plenty of research and learning time.
Good Luck [ June 08, 2004: Message edited by: Mark Vedder ]
Joined: Oct 21, 2003
Thank you very much for this information. Just one more question. I find java to be extrmely good only when it comes to j2me since it is proved popular on mobile phones. So how can JSP be popular when it takes the time for class conversion from java code which takes a long time to process on the server ? Yes I read that only the first time it is slow since the class file gets stored after the 1st time & gets that file the next time the page is loaded. Still...most hosts have PHP or ASP.NET and very few have JSP. So what can JSP possibly do that PHP can't ? Thanks
I find java to be extrmely good only when it comes to j2me Then you have not explored the true power of java. Ironically J2ME has had the slowest adoption rate of most any Java Technology (in my opinion). Java's power is in its J2SE and J2EE environments and rests on its platform independence, strong Object Oriented nature, easy of multi-threading, robust APIs, and many other things. Since there are dozens of other threads on JavaRanch that tote up the benefits of Java, I will not get into any more detail on the subject.
So how can JSP be popular when it takes the time for class conversion from java code which takes a long time to process on the server ? Yes I read that only the first time it is slow since the class file gets stored after the 1st time & gets that file the next time the page is loaded. This perceived weakness is perpetually harped upon, overemphasized and generally misrepresented by any one -- such as ASP and PHP proponents -- that wishes to try to discredit JSP. First off, I do not know what quantifies as "a long time to process on the server", but the translation and compilation time of a JSP to bytecode is not extraordinarily long, as some critics like to exclaim. Moreover, as you point out, it only happens the first time the page is accessed. Even that can be prevented, as there are tools -- available both separately and in most Servlet Aware Web Servers out there -- that allow you to pre translate and compile your JSP's before deployment. This eliminates any delay, making the pages instantly available to the client. And since Servlets (& thus JSP�s since JSP�s are translated into Servlets) are multithreaded by nature, they are very efficient and fast.
Still...most hosts have PHP or ASP.NET and very few have JSP. I know of plenty of hosting providers that support JSP. I also think you�ll find that more hosting companies provide PHP and ASP because they are more popular choices among small and personal web sites. JSP is very popular among large enterprises (as is ASP) and they will usually have there own datacenters and not use hosting companies.
So how can JSP be popular JSP is popular because it is efficient, powerful, scalable, portable, secure, inexpensive (with free IDE�s, API�s, libraries, servers, frameworks, etc), maintainable, and more.
I have never used PHP and only know a little about it. There are also a thousand debates in forums and articles all over the web comparing JSP, ASP.net, PHP. I tend to find many, if not most, such debates & articles are heavily biased one way or the other making it difficult to separate fact from propaganda & slander. Developers tend to be very passionate about their chosen technologies. I would therefore encourage you to do extensive research into the subject, researching the source of the comments just as much as the comments themselves, before making any conclusions. I think in the end each technology has its advantages. In my opinion based on what research I have done, I think JSP/Servlet/Java lends itself far better to enterprise level systems then PHP does. But then that is just my opinion, and since I work on large enterprise web applications powered by J2EE (including JSP�s), I too may be a little biased.
Joined: Oct 21, 2003
Thank you so much for you replies. This has really helped me getting started with java stuff. Thanks
The "JSP is slow" argument is completely false. In fact, the arguments supplied for it by PHP and CGI proponents in fact discredit their own platforms instead of JSP...
For CGI for example, a new server process needs to be started whenever a request is made and typically the entire script is read from disk again for every request. This is extremely slow compared with JSP/Servlet where the servlet class is read only once into memory and then new threads are forked off for each incoming request.
The only thing where CGI is more efficient is memory use as the act of keeping the Servlets in memory of course requires more memory than reading them anew from disk for every request.