aspose file tools*
The moose likes Servlets and the fly likes Java Technology Guidance. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Java Technology Guidance." Watch "Java Technology Guidance." New topic
Author

Java Technology Guidance.

David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 198

Appologies in advance for possibly posting in the wrong forum, but if you read on you may understand why !

I have for the last 18 months been writing a J2SE (1.5) Java application that runs on a users desktop. It uses Swing & some AWT. I would like to extend the application so that some elements of it can be run from a wireless 802.11b device running Windows (versions vary). I have done some experimentation installing IBM's J9 JVM on a PDA and using RMI to connect to my development machine. I work's, but it was problematic to get the PDA configured with J9 and SWT and ideally I would like a solution that would be very easy to deploy.

So, I think I heading towards a web based application, but I have been totally blown away by the number and diversity of Java based J2EE technoligies out there, servlets, struts, velocity, jsp and so on. Frankly I don't have time to investigate all these possibilities so I am hoping that if I can highlight my requirements someone can prepare a shortlist.

1) Assume PDA has only basic IE funtionality (no JavaScript or applet support). So I guess I'm eliminating Ajax and the like in favour of a total server side solution.

2) I would like to utilise my existing business logic Java class library (.jar) which I've created for the desktop element of the application in the server side logic. I don't mind having to create some form of wrapper's around calls to my existing code, but I don't want two separate versions to maintain.

3) I would like to adopt a technology which is well known, well supported and has a good future (shelf life). I have a habit of learning stuff just as something better replaces it.

4) I would like to be able to develop and deploy using the latest Tomcat server software on my laptop.

5) The application would require user sessions to be persistent (sorry of this is the wrong terminology), so for example they can logon and have their username and password validated by using my existing class library, but have an instance of that class held in server memory so that when they perform a transaction I can use this information to check permissions etc.

I don't mind learning something new, but I would like to have some assistance picking the correct technology in advance.

Many thanks again,

Dave
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
I think a simple web application infrastructure is sufficient for your need.You may consider learning Struts , servlets ,jsp.While writing view components you might see like what all html components are well supported by the mobile browser that you might use.


Rahul Bhattacharjee
LinkedIn - Blog
David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 198

Hi,

Are you saying that a simple solution would require Struts , servlets and JSP ?

Thanks

Dave
David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 198

Perhaps I should elaborate on my question. When you browse through Amazon's bookstore you can find books on each of these subjects, which implies that they are solutions in their own right. Do you know of any good resources (links or books) that would illustrate which bits (servlets, jsp, struts etc) do what. Which my limited knowledge I assume that the servlet is the business logic side of things, whilst struts and jsp are used to build the presentation (html) side of things. If so they does struts incorporate jsp ? If not they when do I use one rather than the other ?

Thanks

Dave
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Just as we often recommend people start Java with a text editor rather than jump into an IDE, I'd recommend starting Java web with naked servlets & JSPs rather than a framework like Struts. Ben Souther, one of the regulars here, has a nifty set of Simple Servlet Examples that start with about the least code you can possibly make run. Invest a day and see if those make sense to you. After you build a few simple pages you may bump into some of the problems Struts was meant to solve. Or not.

BTW: Persistent state to mimic what's held in memory in a Swing app can be hard to scale past a few users. Let's defer that conversation until you have played with servlet a bit.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 198

Thats very helpful. Many thanks. I will start with servlets, however do you mean that the servlet approach may be wrong if I have too many users, or just that it might require a complicated design to get it right.

Thanks

Dave
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

I'm with Stan: deep six behemoths like Struts. Straight Servlets and JSP 2.0 is all you will need.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

Additional thoughts:

You shouldn't need to wrap your business classes if you have already coded them in a UI-agnostic manner. If not, now would be a good time to refactor.

Be sure to follow established code patterns (this article might be helpful) and use a JSP 2.0 engine (Tomcat 5.5).
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

Originally posted by David Garratt:
however do you mean that the servlet approach may be wrong if I have too many users


No, he was talking about persistence. Servlets/JSP scales well to many users.


that it might require a complicated design to get it right.


The urge today seems to be to create over-complicated and over-engineered Rube Goldberg designs to solve simple problems. Hence the popularity of large frameworks.

I'd advise to keep things simple until or unless you have a good reason to go complicated. A simple front controller and native servlets and JSP is all that is needed for the vast majority of web apps.
David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 198

Could I also ask you to consider jsf for my needs. I get the impression that it allows user interfaces to be built from a standard set of components, what would the advantages/disadvantages be for me with this ? Sorry if I'm drifting off topic but I would like to keep the same thread/topic running.

Dave
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61656
    
  67

You won't get a JSF endorsement from me. I put it into the "more complex than it's worth" category.
David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 198

Enough said :-)

Thanks

Dave
 
Consider Paul's rocket mass heater.
 
subject: Java Technology Guidance.