JSP or Servlet?

Hi ,

What should we used a servlet or a jsp?
In which type of applications we can find a servlet better to be used?







Please assist
Thanks!

Replies

  • Mahesh Dahale
    Mahesh Dahale
    well, JSP may be great for serving up dynamic Web content and separating content from presentation
    JSP as a high-level abstraction of servlets
    servlets excellent for server-side processing
  • sookie
    sookie
    ce_neha
    Hi ,

    What should we used a servlet or a jsp?
    In which type of applications we can find a servlet better to be used?
    Hi ce_neha,

    If your application is web based like having more focus on UI[User Interface] than Java programming - I will say go for JSPs but if your application is more dependent on Java rather than UI. Go for Servlets.

    And if you say, it is a mix of both then I would always recommend to make your UI in JSP only and do Java programming part in Servlets. It is considered as a bad practice if someone use "Java" in JSPs [scriptlets should be avoided] and "HTML" tags in "Java"

    Hope , I cleared your doubt. If still any doubts, feel free to ask. 😀
  • ce_neha
    ce_neha
    Hi ,

    I read somewhere that "JSP only deals with textual data, you will have to continue to use servlets when communicating with Java applets and applications."

    Please clarify the above statement,what applications are we referring to?
    or explain it with an example.




    Thanks.
  • sarveshgupta
    sarveshgupta
    Will clear your doubt give some time
  • sookie
    sookie
    ce_neha
    Hi ,

    I read somewhere that "JSP only deals with textual data, you will have to continue to use servlets when communicating with Java applets and applications."

    Please clarify the above statement,what applications are we referring to?
    or explain it with an example.

    Thanks.
    Hi ce_neha,

    I think you read it here - #-Link-Snipped-#

    Well they mean to say that JSP just allow you to handle UI part. It will not allow a Java program(Here a servlet specifically) to communicate with other Java programs and its methods. So in that case you will have to go for Servlets only. And again as I said before also. All your Java code should be kept in servlets only. Use JSP only for UI purpose. Though it provides you few feature of incorporating Java code but avoid using it if you are making an application keeping dynamic thing in mind.

    Feel free to ask if still not clear. 😀

    Thanks !
  • callyD
    callyD
    My understanding is JSP is for those who are not hardcore Java programmers. It offers ease of programming. Servlets are for hardcore java programmers. Servlets offer more flexibility to implement complex validation rules.
  • sookie
    sookie
    callyD
    My understanding is JSP is for those who are not hardcore Java programmers. It offers ease of programming. Servlets are for hardcore java programmers. Servlets offer more flexibility to implement complex validation rules.
    Please change your understanding for making better web applications in future. I seriously hate people who add JAVA code in JSP pages. Just because of such understandings and coding practices only, security of web applications become a major issue at times.

You are reading an archived discussion.

Related Posts

Hey....guys i have been given a problem in a competition about reversing.I have to get a code out of an .exe file. Can anybody guide me for this process.
friends i am a b.tech second year student from nit surat...my branch is mechanical and i want to do summer training in 2010...so guys can u please help me with...
Here's some more stuff on the group of cube puzzles: Stacking cubes together is where Erno Rubik started with his eventual design of an N[sup]3[/sup] object, which is cubical because...
Useful for all the computer users, I think most of our CEans already knows this Remote Assistance allows a user to request help from a remote user over the Internet....
To create a backup of files and folders in XP? NTBACKUP does not have the ability to write to CDs directly. You will need to save the backup to hard...