Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

Different components needed to build Java Web App - Beginner Question

Thread view: 
Agapito - 03 Aug 2007 09:48 GMT
Dear All

I am doing research on the best components to use for building a Web Java
Application that is using a database backend.

So far, this is what I have understood:

1. All my pages will be in JSP. User will enter his choices and the form
button (submit) will invoke related servlet.

2. I should use servlet to connect to database and get results and generate
a JSP with dynamic content.

3. To enable activity of different user interface components (buttons,
textbox, listbox, etc) I should use either Java Server Faces or Struts.

4. For server, I plan to use Sun Application Server PE 9.

I will be deeply grateful for help and clarification, to help me use the
best choices available:

Question 1: Is my understanding correct ? Or there are better ways to go
about building the site?

Question 2: except coding html directly into code of a servlet to generate
JSP, are there any other or better ways to do so?

Question 3: Many advise using Java Server Faces instead of Struts, claiming
that it includes all Struts functionality and more ... is this the case ?

Most appreciate your help ....
Agapito
Amit Jain - 03 Aug 2007 13:28 GMT
Before starting any web application you must need to understand
MVC(Model View Controller), so I would like to suggest one book
"Servlet & JSP Head First". This book explain everything.

Thanks
Amit Jain - 03 Aug 2007 13:33 GMT
Question 2: except coding html directly into code of a servlet to
generate
JSP, are there any other or better ways to do so?

Your question is little confusing, servlet never generate JSP remember
JSP code is translated into servlet which is stored in the work
directory of Tomcat.

First go through Life Cycle of Servlet and JSP things get clear to
you.
go through "Head First" first.

Thanks...
Amit Jain - 03 Aug 2007 13:47 GMT
Question 3: Many advise using Java Server Faces instead of Struts,
claiming
that it includes all Struts functionality and more ... is this the
case ?

http://websphere.sys-con.com/read/46516.htm
david.karr - 03 Aug 2007 16:03 GMT
> Question 3: Many advise using Java Server Faces instead of Struts,
> claiming
> that it includes all Struts functionality and more ... is this the
> case ?
>
> http://websphere.sys-con.com/read/46516.htm

Note that this article is almost 3 years old.  Many things have
changed since then.
Agapito - 03 Aug 2007 15:07 GMT
>Question 2: except coding html directly into code of a servlet to
>generate JSP, are there any other or better ways to do so?

> Your question is little confusing, servlet never generate JSP remember
> JSP code is translated into servlet which is stored in the work
[quoted text clipped - 3 lines]
> you.
> go through "Head First" first.

First of all thank you very much for your reply ....
What I meant by my question is , in a servlet , we usually code something
like this:

out.println("<html>");
out.println("<head>");
// some code
out.println("</head>");
out.println("<body>");
//some code
out.println("</body>");
out.println("</html>");

I could have a page with some frames or images and it could take time if I
want to code everything through HTML (worse if I change something - I will
have to change code in all servlet codes !) , so I wonder if there is a way
to do this in a different way ?

Agapito
milesd - 03 Aug 2007 15:47 GMT
>>Question 2: except coding html directly into code of a servlet to
>>generate JSP, are there any other or better ways to do so?
[quoted text clipped - 26 lines]
>
> Agapito

You need something to serve the webpages. This will be something like the
apache webserver.

Something to parse/process the Java - Java Application Server.

The best thing to do is take a look at Getting Started with Web Applications
- starting with Servlets, JSP, and JSF.

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/About.html

and

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Overview2.html

and

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Overview3.html

These describe what is needed to build a Java Web Application.


Miles.
Lew - 03 Aug 2007 23:18 GMT
"Agapito" wrote:
>> What I meant by my question is , in a servlet , we usually code something
>> like this:
[quoted text clipped - 12 lines]
>> have to change code in all servlet codes !) , so I wonder if there is a
>> way to do this in a different way ?

Yes, it's called "JSP" or "Java Server Pages".  We almost never code something
like what you showed as a servlet; it's very bad practice, actually.  We code
layout in JSPs, and navigation and controller logic in servlets (along with a
few special functions).

So your example would be more like:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>The Right Way To Do JEE Web Apps - A Separate View</title>
</head>
<body>
   <img src="images/some.png" />
   <h1>The Right Way To Do JEE Web Apps - A Separate View</h1>
   <div>
     <%-- some text and markup and some dynamic content --%>
   </div>
</body>
</html>

Signature

Lew

Arne Vajhøj - 04 Aug 2007 00:36 GMT
> Dear All
>
[quoted text clipped - 25 lines]
> Question 3: Many advise using Java Server Faces instead of Struts, claiming
> that it includes all Struts functionality and more ... is this the case ?

It sounds OK.

But be aware that you will need to learn a lot !!

I would recommend JSF over Struts.

And I would recommend JBoss (or maybe Geronimo) over
SUN Application Server.

Arne
Lew - 04 Aug 2007 03:20 GMT
> I would recommend JSF over Struts.

While the article cited upthread that compares the two is perhaps a bit old,
its points are still valid.  JSF is a way more flexible framework, although
sometimes I miss the comforting autocracy of Struts.  It also seems to support
more than one style of web-app development.  I've been learning JSF recently.
 The basics are quick enough to pick up, but there are subtleties and
opportunities galore.

> And I would recommend JBoss (or maybe Geronimo) over
> SUN Application Server.

The Sun App Server these days is precisely the open-source Glassfish JEE
server, but with a different installer.  I've only played with Glassfish a
tiny bit, and JBoss not at all.  What do you see as the relative advantages?

Signature

Lew

Arne Vajhøj - 12 Aug 2007 04:32 GMT
>> I would recommend JSF over Struts.
>
[quoted text clipped - 4 lines]
> learning JSF recently.  The basics are quick enough to pick up, but
> there are subtleties and opportunities galore.

Additionally JSF fits better with portals and there are a lot more
AJAX stuff available for JSF.

>> And I would recommend JBoss (or maybe Geronimo) over
>> SUN Application Server.
[quoted text clipped - 3 lines]
> a tiny bit, and JBoss not at all.  What do you see as the relative
> advantages?

The main reason is CV benefits not technical.

There are much better chance to have to work with JBoss or
Geronomi (or one of its commercial offsprings) than with
Glassfish/SUN.

Arne
David Segall - 04 Aug 2007 13:43 GMT
>Dear All
>
>I am doing research on the best components to use for building a Web Java
>Application that is using a database backend.
If you have some Java experience start here
<http://developers.sun.com/jscreator>. JSF is _much_ easier to learn
than Struts. Make sure you know some Java before you attempt the
intimidating combination of Java, HTML, and client/server programming.
Agapito - 08 Aug 2007 04:37 GMT
I would like to thank you all for your help and replies :-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.