Java Forum / General / January 2005
Need help with Tomcat/JSP website design
zenshade - 20 Jun 2004 03:30 GMT I have been tasked with creating a website for my company. It basically just needs to hold some documents with emergency contact numbers and instructions. Also, though, these documents need to be updated via the website and saved to the server. My experience with web site design is rather limited (mostly just simple html), but I do know that javascript alone will not cut it. Though not strictly required (I could get away with using PHP or perl cgi), I'm choosing to use Tomcat and JSP since these are technologies my company uses for other projects. I guess I'm just looking for something like an architectural project outline, pitfalls to watch out for, and suggestions how to quickly get the site up and running. I've got Tomcat installed and working, so mostly I need help with the JSP side of things, i.e. is JSP going to be enough, or will there also have to be some servlet programming, etc. Or, are there any packages out there to do this rather quickly and painlessly?
Job Numbers - 20 Jun 2004 03:52 GMT >I have been tasked with creating a website for my company. It > basically just needs to hold some documents with emergency contact [quoted text clipped - 11 lines] > be some servlet programming, etc. Or, are there any packages out there > to do this rather quickly and painlessly? Heh, the thing you want to ask yourself is, do you want to get it done or done right? I mean, you could just do the whole thing in servlets, but then you'll have html, programming logic and sql in the same spots. If you do it in jsps only, then you basically have a bunch of code in your html (like php). Neither solution is very good, but even splitting them up into jsp/servlet isn't very smart either since you'll be doing way too much coding. On the other hand, using a bunch of frameworks and things to make your life easier will take more time, but the solution will be "right".
Now, if you don't know java (not javascript - that has nothing to do with it), then you have to learn that first. In the end, you should know the following: - java the language - servlets, then jsp (since jsp's are basically servlets with a different implementation focus - the view). You'll find that servlets on their own are just for controlling/briding your application to your jsps and not much else. - Springframework (www.springframework.org): an open source framework that makes web stuff really nice, flexible and seperates concerns very well - but learn only when you know the core stuff - hibernate (www.hibernate.org): a framework that maps your objects to the database for you and does so transparently with very little effort or overhead - I'd still only recommend using this when you know sql and jdbc (java's way of doing sql). - an application server, like orion/resin/tomcat (you can't deploy your software without an app server to put it on, so spend some time learnign this). - your database. if you don't know databases, you can't store persistent information. To be honest, most web projects aren't worth doing unless you are backed with a database. Try mysql first since it's really lightweight and easy, then move to postgres when you graduated from that. - jakarta-commons: there are a lot of common programming tasks that you are bound to do over and over eventually. Look at apache jakarta commons for some libraries to make these tasks easier. - sitemesh: if you are going to be doing web things, you definately want this. It allows you to decorate html (or whatever) pages with a common layout, thus making it a lot easier to code up specific pages since you don't have to include the header and footer on every page and you can do this on non-jsp pages as well.
If this isn't what you signed on for, then let them know. Granted you don't need some of the things on this list, but people with experience would just dive into these things because they already know the concepts and it would definately save them time. If you have no idea of the core concepts that make up these tools (which basically means you haven't done a lot of programming), then you can try to rough it with the very basics (keep it simple, just use what java gives you).
However, doing what should be simple is actually not that simple unless you know what you are doing. It's just how it is. That's why people like PHP, because it is easier getting the small projects going, but in the end, you are just doing scripts that don't really mean anything, have poor reuse, execute slower when they grow and generally are a mess when they get big. That's the tradeoff. Do it right (java) or do it fast (php).
zenshade - 20 Jun 2004 13:13 GMT > Heh, the thing you want to ask yourself is, do you want to get it done or > done right? ... On the other hand, using a bunch of frameworks and things to make > your life easier will take more time, but the solution will be "right". I definitely want to do things right (assuming I can cram enough of the requisite knowledge into my head within a few weeks); there's a high probability that this project could grow into many other areas.
> Now, if you don't know java (not javascript - that has nothing to do with > it), then you have to learn that first. In the end, you should know the > following: > - java the language I've only used Java on a few CIS lab projects, so I wouldn't say that I knew it very well. On the other hand, I do know some other object oriented, imperative languages (c++, python, perl), so the learning curve is not steep at all.
> - servlets, then jsp (since jsp's are basically servlets with a different > implementation focus - the view). You'll find that servlets on their own [quoted text clipped - 7 lines] > overhead - I'd still only recommend using this when you know sql and jdbc > (java's way of doing sql). This is exactly the kind of advice I was looking for. Thank you so much.
> - an application server, like orion/resin/tomcat (you can't deploy your > software without an app server to put it on, so spend some time learnign > this). I've spent the last few days wrestling with tomcat. It's workin' :).
> - your database. if you don't know databases, you can't store persistent > information. To be honest, most web projects aren't worth doing unless you > are backed with a database. Try mysql first since it's really lightweight > and easy, then move to postgres when you graduated from that. Have SQL, will travel.
> However, doing what should be simple is actually not that simple unless you > know what you are doing. It's just how it is. That's why people like PHP, > because it is easier getting the small projects going, but in the end, you > are just doing scripts that don't really mean anything, have poor reuse, > execute slower when they grow and generally are a mess when they get big. > That's the tradeoff. Do it right (java) or do it fast (php). How about do it fast while also doing it as right as possible, within some time constraints? I'm not looking for long term shortcuts, because I do need and want very much to learn the right way, but I also need to be able to have a preliminary but mostly functional site within a week or two at most. In other words, I don't have time to fully digest Java the language nuances, servlets, and JSP's, and then frameworks. Can you recommend a somewhat safe path that doesn't lead through a dark, entangled forest I'd have to take a few months to hack my way out of before seeing any results?
Sam - 22 Jun 2004 16:56 GMT > How about do it fast while also doing it as right as possible, within > some time constraints? I'm not looking for long term shortcuts, [quoted text clipped - 5 lines] > through a dark, entangled forest I'd have to take a few months to hack > my way out of before seeing any results? Why not Struts? It's a framework that has been around for a while and is widely used. You could probably download some sample code and modify it to do a simple update in a short amount of time. It's built around the MVC paradigm, and designed to incorporate tag libraries. You could get into the framework wars, but I don't think you can go to far wrong with Struts, and then branch out from there if need be.
Sam90
Sudsy - 22 Jun 2004 17:36 GMT <snip>
> How about do it fast while also doing it as right as possible, within > some time constraints? I'm not looking for long term shortcuts, [quoted text clipped - 5 lines] > through a dark, entangled forest I'd have to take a few months to hack > my way out of before seeing any results? In that case, you could just use a servlet/JSP combination. You'll have to perform your own session management but you could readily migrate to Struts down the road. - your URLs map to servlets - the servlets perform the necessary work, and - forward to a JSP for display
Roedy Green - 20 Jun 2004 04:08 GMT >Or, are there any packages out there >to do this rather quickly and painlessly? Nothing you said requires JSP, Servlets or anything other than a vanilla HTTP server.
 Signature Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Job Numbers - 20 Jun 2004 04:14 GMT >>Or, are there any packages out there >>to do this rather quickly and painlessly? > > Nothing you said requires JSP, Servlets or anything other than a > vanilla HTTP server. No, they need to update the info, which means you need a database, which means you need to write software to read from and to the database.
Roedy Green - 20 Jun 2004 05:36 GMT >No, they need to update the info, which means you need a database, which >means you need to write software to read from and to the database. Not necessarily. You might do that statically as I do, and upload the results every hour or so.
I saw a demo of a tool for collaborative website generation. It sounds very much like what you need. It was a Canadian company.
I ask around to see if anyone remembers what it was called.
 Signature Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Roedy Green - 22 Jun 2004 02:04 GMT >I saw a demo of a tool for collaborative website generation. It >sounds very much like what you need. It was a Canadian company. > >I'll ask around to see if anyone remembers what it was called. see http://mindprod.com/jgloss/publishbutton.html
There were two demos. I'm not sure if that's the one I saw. The other website http://www.xceedx.com/ is not responding.
 Signature Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Sudsy - 20 Jun 2004 05:48 GMT >>>Or, are there any packages out there >>>to do this rather quickly and painlessly? [quoted text clipped - 4 lines] > No, they need to update the info, which means you need a database, which > means you need to write software to read from and to the database. No, you need J2EE! (ROTFLMAO)
There are many ways of achieving persistence short of running a database. What about java.util.pref.Preferences or XML? There's more than one way to skin a cat. [Please don't call PETA or the ASPCA on me for that comment! :-( ]
Job Numbers - 20 Jun 2004 05:49 GMT >>>>Or, are there any packages out there >>>>to do this rather quickly and painlessly? [quoted text clipped - 11 lines] > There's more than one way to skin a cat. > [Please don't call PETA or the ASPCA on me for that comment! :-( ] I guess, just setting up hibernate with hsql or mysql is pretty damn simple and I could have the whole thing running a few hours.
Sudsy - 20 Jun 2004 08:52 GMT > "Sudsy" <bitbucket44@hotmail.com> wrote in message <snip>
>>>No, they need to update the info, which means you need a database, which >>>means you need to write software to read from and to the database. <snip>
> I guess, just setting up hibernate with hsql or mysql is pretty damn simple > and I could have the whole thing running a few hours. Sigh! Never approach a battle of wits unarmed. What if the OP doesn't have access to, or any desire to, use a database? You claim that "you need a database". No, you don't. I offered a couple of alternative approaches. You responded that you "could have the whole thing running a few hours". Using an outside join perchance? Roedy called it correctly. Perhaps you should offer your considerable consulting experience to the OP?
Juha Laiho - 20 Jun 2004 13:32 GMT look-on@mindprod.com.invalid said:
>>Or, are there any packages out there >>to do this rather quickly and painlessly? > >Nothing you said requires JSP, Servlets or anything other than a >vanilla HTTP server. ... perhaps using WebDAV functionality for updating the documents?
 Signature Wolf a.k.a. Juha Laiho Espoo, Finland (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++ "...cancel my subscription to the resurrection!" (Jim Morrison)
David Ashe - 20 Jun 2004 15:44 GMT Hi zenshade,
You could use a content management system like magnolia (www.magnolia.info) - its the best i've seen for java, and the install comes with tomcat ready to run.
Otherwise, if this does not suit your needs, i would get eclipse (www.eclipse.org) and use plugins like hibernator, the tomcat plugin and the spring network plugin to make your life a lot easier developing with hibernate, spring and tomcat.
For example, in eclipse you just save the file and its compiled, and if you use the tomcat plugin your file is updated automatically ready to roll.. a lot easier and quicker than making a change, saving the file, running a compile script and [restarting tomcat or reloading the context]!!
here is a good tutorial on hibernator - http://www-106.ibm.com/developerworks/db2/library/techarticle/0306bhogal/0306bho gal.html
and a good one on eclipse and tomcat - http://www.3plus4software.de/eclipse/tomcat_en.html
all of these tools are open source and free.
hope this helps!
dave realisation
Jim Cochrane - 20 Jun 2004 18:41 GMT > Hi zenshade, > [quoted text clipped - 6 lines] > spring network plugin to make your life a lot easier developing with > hibernate, spring and tomcat. (Sorry for the tangent.) How good (easy to use for a developer, powerful, aiding in producing a high-quality product, etc.) are these tools - The spring framework and hiberate (or whatever it's called)? I'm looking at potential tools for an "open source for government" project (Java-based web applications) and these sound like good candidates.
We also may use the eXo platform. Will these two tools integrate well with eXo?
(These questions are for David and for anyone else who can contribute, of course.)
Thanks!
 Signature Jim Cochrane; jtc@dimensional.com [When responding by email, include the term non-spam in the subject line to get through my spam filter.]
Michael Borgwardt - 21 Jun 2004 08:51 GMT > (Sorry for the tangent.) How good (easy to use for a developer, > powerful, aiding in producing a high-quality product, etc.) are these > tools - The spring framework and hiberate (or whatever it's called)? I don't know anything about Spring, but at my company, we've had very good experiences with Hibernate. It's stable, full-featured, performant and very well-documented for an open source project.
Alex Hunsley - 03 Nov 2004 17:18 GMT > I have been tasked with creating a website for my company. It > basically just needs to hold some documents with emergency contact [quoted text clipped - 11 lines] > be some servlet programming, etc. Or, are there any packages out there > to do this rather quickly and painlessly? It sounds a little like you're trying to stroke a kitten with a hammer: overkill. If you need a database backed site, consider looking at existing content management systems rather than trying to write one from scratch in a very short amount of time (when you're not experienced in the field either)...
alex
tatem@tatemweb.com - 05 Jan 2005 18:21 GMT Helpful website resources from Tatem Web Design
Top Professional Website Templates: http://www.tatemweb.com/Templates.html
Website Hosting Plans (Unix And Windows Plans available) Starting at $14.95 per month http://www.tatemweb.com/index-3.html
Froogle and Yahoo Product Datafeeds http://www.froogledatafeeds.com Regards, Matt Tatem Webmaster/CEO http://www.tatemweb.com
Free MagazinesGet 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 ...
|
|
|