hope im in the right forum... i do code some applications in java .. and wanted to do some upgrades into doing some jsp or servlets ... but first thing before diving into the ocean .. what are the pros and cons of both.. what is the differences of the two and lastly how about considering applets??? any lights to shed on me... thanks in advance
You might want to wander up the page to the Servlet and JSP forums (forae?) for this topic. In short, Servlets are pure Java code. Most people nowadays like to use them to receive incoming GET or POST requests from a browser. JSPs look like HTML with some Java or tags here and there, and work well for generating the response that goes back to the browser. There are frameworks like Struts that formalize these rules nicely. Sun has a J2EEpatterns page that talks about this stuff (plus much more about EJB). Here's how most of them work: Browser -> Servlet : GET URL or POST form Servlet looks at the request and picks a handler. The system I'm working on now has an "ActionID" on every request, and that maps to a Java Handler class. Servlet -> Handler : Handle this request Handler -> Business objects : call appropriate methods, return some interesting data Handler stuffs the data on the Session Handler returns to Servlet. Servlet figures out what page to show next. This might be mapped from ActionID again, or the Handler might have specified a page. Servlet forwards to a JSP page. JSP page gets the data from the Session and generates HTML. Sun Patterns Page - follow the "catalog" link.
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
Welcome to the Ranch "java Bhoy"! You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it. In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Thanks! bear JSP Forum Bartender
The only thing I'd add to Stan's reply is that it is usually not recommended to put data onto the session unless it needs to persist beyond the scope of the current request. It's much more common (and preferred) to use the request scope to 'pass' data from the controller servlet to the JSP page unless usch persistance is necessary.
cleaner design for large projects: 1) Servlet as controller which invokes the services based on incoming request. 2) JSP just for rendering purposes(including some level of using server side parameters etc). Dan.