Results 1 to 8 of 8
Like Tree1Likes
  • 1 Post By gimbal2

Thread: Relation between Jsp and servlet

  1. #1
    jasminemullai is offline Member
    Join Date
    Oct 2013
    Location
    Puducherry
    Posts
    5
    Rep Power
    0

    Post Relation between Jsp and servlet

    Out of these things which are true?

    1. a servlet can alone handle requests without jsp

    2. a jsp can alone handle requests without servlet

    3. a servlet need jsp to handle client requests

    4. a jsp need servlet to handle client requests

    I have some idea of how a jsp and servlets work, but i need the exact answer for this pls

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    926
    Rep Power
    2

    Default Re: Relation between Jsp and servlet

    Well, these are fundamental JSP/servlet questions so write your answers down, and we'll tell you if they are correct or wrong and why.

  3. #3
    jasminemullai is offline Member
    Join Date
    Oct 2013
    Location
    Puducherry
    Posts
    5
    Rep Power
    0

    Default Re: Relation between Jsp and servlet

    Quote Originally Posted by SurfMan View Post
    Well, these are fundamental JSP/servlet questions so write your answers down, and we'll tell you if they are correct or wrong and why.
    Hi surfman, you're correct

    I give my point of understanding on those things, tell me they are correct / wrong and your explanations to suggest me

    My answers are c and d
    A servlet needs a jsp to get the input from the user.
    At the same time a jsp needs a servlet to handle the requests based on the user input.

    Suggest me if im wrong

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,776
    Rep Power
    5

    Default Re: Relation between Jsp and servlet

    Wrong. Although it is actually good design to apply 3 & 4, it is not a necessity. Try researching what a JSP actually is. The answer will surprise you.
    jasminemullai likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    926
    Rep Power
    2

    Default Re: Relation between Jsp and servlet

    I don't want to sound pedantic, but *why* do you think C and D? Could you describe how a request to a JSP/servlet works?

  6. #6
    jasminemullai is offline Member
    Join Date
    Oct 2013
    Location
    Puducherry
    Posts
    5
    Rep Power
    0

    Default Re: Relation between Jsp and servlet

    hmm ok dude,
    In my understanding, a jsp we use as a presentation layer to get data from the user and we send the data to the servlet to process it. JSP is compiled to become a servlet where the functionality of dynamic content is handled by service method. May be it sounds odd, but this is how a guy got trained in core java and advanced java in 45 days and deployed in project got understand from that

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,776
    Rep Power
    5

    Default Re: Relation between Jsp and servlet

    JSP is compiled to become a servlet
    Bingo, well done. So essentially a JSP IS a servlet, only the way you write it is different and it is indeed intended to make it less error-prone to create a servlet for presentation purposes. But it is still a servlet, so you can't state that you NECESSARILY need to use a JSP for presentation purposes. You can do the same by creating your own servlet and outputting gobs of HTML to the response, like people did before the whole JSP standard was created. Of course you shouldn't do that, but that's not what the question is about apparently unless it is worded really poorly.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    jasminemullai is offline Member
    Join Date
    Oct 2013
    Location
    Puducherry
    Posts
    5
    Rep Power
    0

    Default Re: Relation between Jsp and servlet

    Ya i accept that , but im not even sure about the answers

    But it was 1 and 4 i concluded from your explanation
    Last edited by jasminemullai; 10-28-2013 at 10:34 AM.

Similar Threads

  1. Help with Relation Algebra
    By pepsipwns in forum New To Java
    Replies: 19
    Last Post: 11-14-2012, 06:18 PM
  2. relation doesnt work
    By Nigel in forum New To Java
    Replies: 3
    Last Post: 03-12-2011, 07:02 PM
  3. Funny Abstract Relation Name in JPA:What Does That Mean?
    By mbaocha in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 11-16-2009, 07:22 AM
  4. Relation between 2 views
    By tojas in forum SWT / JFace
    Replies: 0
    Last Post: 04-19-2009, 03:22 AM
  5. Relation between Polymorphism and Inheritance
    By janakiram.attuluri in forum Advanced Java
    Replies: 1
    Last Post: 12-26-2007, 11:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •