How to setup java web architecture on hosting slice/dedicated server? - java

I want to build web application that is based on java technology (tomcat )
Can I get please suggestions on how to set up the servers (apache – mod_jk – tomcat ? )
And what are the right frameworks to use or not .
For memory and ease of work from the development side ( to use plain jsp or mvc frame works? )

Although you didn't ask for alternatives to tomcat, if you are starting to look into web development you should have a look at Caucho's Resin. I find it is a better alternative than tomcat and makes it very easy to setup a system for test and development. It is completely built in Java and the open source version is free.

From development point of view always use an IDE such as Eclipse or Netbeans, makes the job easier n much faster. Here's a nice tutorial to get you started on developing web applications on Eclipse with Tomact integration - WTP Tutorials

Related

learning java/spring from python/django

I am required to pick up java (with basic previous experiences) + 1 specific application framework, having spending most of my times in Python and Django. Chose Spring mainly due to my requirements.
May I know what could be the equivalent of Django's development server in Java so I can easily run and check my Java code?
You can deploy a web app using Spring to any Java EE app server. I'd say that the simplest choice would be Tomcat, the Apache servlet/JSP engine.
I would also suggest Jetty which is a lightweight servlet container like Tomcat, but keep in mind the problems regarding deployment of Java EE applications mentioned in this thread Can Jetty be used as a Java EE lightweight application server?.
Another alternative is Glassfish.
If you are working with netbeans then Glassfish is a good fit since there is very good integration between the two.

Building my first Java Web Application

I have to build a java web application and I'm not sure where to start.
I have a good amount of experience with java but I would like to know if anybody can point me to a good example of how to integrate java into a web page?
I searched google without much luck. Is there a decent example on how to do this? Is it similar to adding a flash object with an object tag? Thanks
You can start creating sample web application based on html and servlets, This site will guide you in doing so.
http://www.servletworld.com/servlet-tutorials/simple-servlet-example.html
You will need
JDK
Apache Tomcat(jars will be in tomcat so no need to download separatly)
There's an app for that.
http://www.appfuse.org
AppFuse is an open source project and application that uses open source tools built on the Java platform to help you develop Web applications quickly and efficiently. It was originally developed to eliminate the ramp-up time found when building new web applications for customers. At its core, AppFuse is a project skeleton, similar to the one that's created by your IDE when you click through a wizard to create a new web project.
You ahould start searching about :
Servlets (and Apache Tomcat)
JSP
Java Faces (and Apache MyFaces)
Existing web frameworks
I think the easiest is to download Netbeans for Java EE with Glassfish, install it and use a wizard to create your first Hello World web application.
Then I recommend learning Spring MVC - I think it is the easiest to start with and very flexible so you can add more and more functionalities later. For templating, I recommend FreeMarker or Velocity.

where we put ejb program in tomcat 6.0 and how to deploy?

I do not have eclipse. and I am having Tomcat 6.0.I write the programs in notepad. and I was successfully run the servlet programs. but I am not know about EJB. that is "where we put the .class files(In which directory)?". and "how to run and how to deploy the EJB programs?" please give sample example. please help me.
Tomcat 6.0 is not an EJB container. EJB's are a rather advanced topic. Do not haste into it. You can jump a mighty long way with servlets without ever needing EJB's or EJB containers.
If you need more services to base your app on, look at Spring, which offers (almost) everything an EJB capable container offers and allows your programs to run on Tomcat 6.
Also Java is a bit verbose to use notepad for non trivial projects. You might consider to upgrade to an environment which gives better support. I am partial to IntelliJ myself, but netbeans and eclipse are nice too for that kind of development.
If you like to stick to notepad approach, you might take a look at grails. It offers all the services but uses groovy as the programming language which makes things a lot more compact allowing to develop JVM based web apps using a lean editor.
You can run only web applications with Tomcat . For application s developed using EJB Use JBOSS. But JBOSS may be very slow. So while development use glassfish. Tomcat is only for jsp and servlets. When it comes to EJB its enterprise application and have to use EJB container like JBOSS or some other EJB container.

How to start a web application with eclipse

I love eclipse and java. And i want to code my entire web application using eclipse .. right from designing html files to servlets.. I have zero experience in developing web apps .. So How to to setup eclipse for web apps and How do i get started ???
Google even autocompletes this question so you know it's a popular query!
There is very little information that you are providing, and there are actually tutorials for creating web applications with Eclipse and Java. You will want the JavaEE version of Eclipse as a starting point.
If you want to try using a web framework that works with Java I recommend Struts, although this may be too big if you're wanting to develop small web applications (and it's not exactly the easiest thing to start with).
I also recommend installing Apache Tomcat as your server because it's free and easy to use. Here's a good starting tutorial:
http://www.xwt.org/tutorial/eclipse/
Firstly, make sure you've got the Java EE eclipse binary : http://www.eclipse.org/downloads/
As has been mentioned, there are various google-able tutorials on how to set up, deploy and manage web applications under eclipse.

Java EE App Server Hello World

I am fairly comfortable with standalone Java app development, but will soon be working on a project using a Java EE application server.
Does anyone know of a straightforward how-to tutorial to getting a hello-world type application working in an application server? I'm (perhaps naievly) assuming that the overall approach is similar between different frameworks, so I'm more interested in finding out the approach rather than getting bogged down in differences between the different frameworks.
If you are not aware of a good guide, then could you post bullet-point type steps to getting a hello-world running?, i.e.
Download XX
Write some code to do YY
Change file ZZ
Other steps...
Note: Just because I have a windows machine at home, I would prefer to run if this could be run on windows, but in the interest of a better answer, linux/mac based implementations are welcome.
I would choose JBoss AS or GlassFish for a start. However I'm not sure what you mean by Java EE "Hello World". If you just want to deploy some JSP you could use this tutorial (for JBoss):
http://www.centerkey.com/jboss/
If you want to get further and do the EJB stack and/or deploy an ear-file, you could read the very good JBoss documentation:
Installation Guide
Getting started
Configuration Guide
In general you could also just do the basic installation and change or try the pre-installed example applications.
I currently have JBoss installed (on windows). I develop with Eclipse and use the Java EE server integration to hot deploy or debug my code. After you get your first code running you realy should have a look at the ide integration since it makes development/deploy roundtrips so much faster.
The JavaEE (they dropped the 2) space is pretty big. A good tutorial to start is the one from Sun. For a simple hello world application, the web container only would suffice. A well known servlet jsp container is tomcat. See here for installation instructions. Try installing it with eclipse and create a web project. This will generate some files for you that you can look at and edit. Also starting and stopping the application server is simpler.
Another option is to get Oracle JDeveloper (free to download and use - it's a full featured IDE that includes some neat extras like the SQL workbench and BPEL designer).
As a learning tool, it is quite good, not only for the tutorials available from Oracle, but it includes a range of "cue-card" lessons in the tool itself to teach many common techniques.
cue card view http://tardate.heroku.com/images/jdev-cuecards.jpg
If you haven't gone near NetBeans in a while its catching up with Eclipse very fast and worth a look, especially when starting Java EE.
Version 6.x installs Tomcat and/or Glassfish for you and then provides wizards to create/deploy/redeploy applications.
The initial tutorial on Web Applications is here and a more complex example here.
As JeroenWyseur puts it, Java EE is a fairly big space. In addition to what he said, you should try to get more details of what exactly you'll be doing: servelts & co, EJB (entity, session, message beans?) and try to get familiar with that.
It should be clear for you that your code runs in a managed environment, which imposes a lot of constraints. in order to make sure you understand what happens you should get familiar with the concept of deployment. Then, if you do EJBs, transaction management is important too. If you don't understand exactly what happens when a bean or a servlet is deployed, how transactions are managed, how beans are invoked, you're going to have a hard time.
A book that helped me a lot back in the time is Mastering EJB, by Ed Roman.
Also, getting familiar with RMI will help you understand EJBs.

Categories

Resources