Hi Laskowski , Brian and Mike,
Thx a lot for throwing some light on this subject :)
It is indeed a nice information.

I was under the impression that if you are using jsp for u'r development , u need not
worry much about servlet.

Because,If i remember properly , model 1 is something like JSP receives the HTTP 
request

,JSP passes the information to the bean and get it's things done and build the response
object and throw it back.
(I agree that putting the java code in the jsp file is a bad design. Infact i too am 
not

doing that mistake :)
But what i was wondering was why servlet comes at all when u can pass the information u
get from request and session objects of the jsp to a bean and get your things done!!!!)

Thx a lot again for answering these (trivial?) doubts.
I am also quite new to this area of jsp and servlets.
Also , if u could  answer me these questions that would be of great help.


1.IS session handling a must process in all web applications ?
2.If not ,how does one has to decide whether he/she has to handle session tracking in
the application ? or is it a good practice to handle session tracking in all web
applications ?


Regds
Rakesh.




Jacek Laskowski wrote:

> Rakesh Bhat wrote:
> >
> > Hi Laskowski,
> >
> > As I understand , one uses JSP over Servlet because writing a JSP code is simpler
> > compared to Servlet.Right ?
>
> Yes, but watch out you can fall into a trap and you may mess up your JSP
> and HTML so nobody will know what is in.
>
> > They are 2 different server side technologies.
> > I agree that JSP finally compiles into a Servlet.But , i don't understand why one
> > will use JSP and servlet together ?
>
> See below.
>
> > When you use JSP , all the objects like request , session... are available
> > implicitly which you get in servlet by extending HTTPServletRequest class. right ?
>
> True.
>
> > So why one will use Servlet with JSP? As I understand one uses Java code in a
> > separate bean because he/she wants to hide the business logic. Right ? Why to keep
> > the same code in a servlet ?
>
> Who told you that the same code should be in JSP and servlet as well ? I
> didn't.
>
> > Is my thinking correct or am i missing here something ?
>
> Yes, you're almost correct:) Take a look at the series of Java code and
> give yourself an answer on the question which one is simpler to read and
> maintain. I think that you didn't work on large project(s) which use
> loads of JSP, Servlets and (probably) EJBs. In such projects, you
> wouldn't be able to write all the code because of time you would spend
> on it. Another aspect is knowledge you could bring to a project. One is
> very familiar with HTML code, another with JSP Tags, and another with
> servlets, yet another with EJB and so on. Having such people in one
> place, you could start coding without a need to infere with each other.
> Everybody could work in his/her own way and during last days of
> development all the code could be bring together and it should work. Of
> course, you would have to define objects which could fly from one side
> to another, but that's it, nothing more, nothing less. The best thing is
> that you could fire one of developers and hire another one who has
> experience in doing one thing, say, HTML+CSS+Java Script or Java
> programming in general or JSP/Servlet programming or...
>
> That's not new thing in programming. The term Model-View-Controller is
> known since the beggining of Smalltalk (actually I'm not sure about an
> origin of that term, but I found MVC mentioned as Smalltalk's term). So,
> what is behind MVC. If you look at Swing API, you'll see at a glance
> that e.g. JTable is based on another class - TableModel. TableModel
> holds a data and let you manipulate that. If that data needs to be
> displayed, you should construct a table with a model as just mentioned
> TableModel. It's very simplified model, but your should get a clue:)
>
> Let see some examples, so you'll get more feeling about JSP and how one
> can mess it up.
>
> 1. First example where you see some JSP and HTML code in one file (very
> bad design):
>
> <html>
> <body>
> <table>
> <%
>   // Vector of Men
>   Vector v = getSomeDataFromSomewhere();
>   for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
>     Man m = (Man)e.nextElement();
>     String firstName = m.getFirstName();
>     String lastName = m.getLastName();
> %>
> <tr>
>   <td><%= firstName %></td><td><%= lastName %></td>
> </tr>
> <%
>   }
> %>
> </table>
> </body>
> </html>
>
> 2. Second example where you see only HTML code with some new tags
>
> <%@ taglib uri="/tags" prefix="my" %>
> <html>
> <body>
> <table>
> <my:show name="man">
> <tr>
> <td><jsp:getProperty name="man" property="firstName"></td>
> <td><jsp:getProperty name="man" property="lastName"></td>
> </tr>
> </my:show>
> </table>
> </body>
> </html>
>
> Now, it's time to answer some questions:
>
> 1. How do you fell how much time HTML guru will have to spend to learn
> 1st and 2nd example ?
> 2. What about (cheap) HTML editors with some fancy coloring stuff ? Do
> they know about JSP tags ?
> 3. Which parts of file can be changed and what the impact is thereafter
> ?
> 4. Do you see that 2nd example is divided, so JSP stuff is done by JSP
> guru and the another by HTML guru. They can work separately. Just give
> specification about new tags to HTML developer and you can change Java
> code with no impact on HTML presentation.
>
> I hope it's not too long and it's easy to read and understand:)
>
> >
> > Thx in advance
> > Rakesh.
>
> Jacek Laskowski
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to