ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1722)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
We can write any Java Logics in our JSP. Then why we are 
using servlets(Controller Layer) to interact with the DAO ?
 Question Submitted By :: Core-Java
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
ya u can write your java logics in scriptlet part of jsp or
u can use jsp action tags to implement the business logic.
but its not the good practice to implement the business
logic in jsp's.mainly the use of jsps is to seperate the
presentation logic and business.. so its better to use
jsps only for presentation purpose..u can write business
logic in action classes or in the servlets..
 
Is This Answer Correct ?    11 Yes 0 No
Sujatha
 
Answer
# 2
JSPs are translated into Servlets which renders data from
the DAO/Back-End classes on the client page. The job of
Servlet/Servelet Container is to facilitate/give developer
an option to manipulate what servlet container does as well
as use the request/response/session etcetera objects.
 
Is This Answer Correct ?    3 Yes 1 No
Kaushik
 
 
 
Answer
# 3
yes you are right but why we write all the business logic in
jsp ,becuse we just in a first step to follow the mvc
architectuer like in struts so thats why we don't want to
write java code in jsp
we just use jsp for a view and he servlet for the
controller for business logic
oherwise you wan o right all business in jsp so is up to you
noone sop you do this
thanks amit singh
amitsing2008@gmail.com
 
Is This Answer Correct ?    4 Yes 2 No
Ami Singh
 
Answer
# 4
it reduces coupling so that code changes can be done easily 
Is This Answer Correct ?    1 Yes 1 No
Guest
 
Answer
# 5
ya u can write your java logics in scriptlet part of jsp or
u can use jsp action tags to implement the business logic.
but its not the good practice to implement the business
logic in jsp's.mainly the use of jsps is to seperate the
presentation logic and business.. so its better to use
jsps only for presentation purpose..u can write business
logic in action classes or in the servlets..
 
Is This Answer Correct ?    0 Yes 0 No
Madhuri
 
Answer
# 6
ya u can write your java logic's Jsp or u can use Jsp action
tags to implement the business logic. But if u do like this
your source code may be viewed and used by the others, for
restricting or preventing your source code we are using mvc
architecture like in struts so that's why we don't want to
write java code in Jsp.
 
Is This Answer Correct ?    0 Yes 0 No
Babu
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Why we need Finally with try? pls expain with ur example.. BitWise 2
Q) I have a ArrayList object, in that object i have added 5 integer values, 5 float values, 5 string values. Now question is how can delete particular type of data ( i.e all int values or all float values or string values) in that list object at a time? Aricent 3
how to run servlet program between two computer through the internet ? TCS 2
can we write a program with out a class in core java? Wipro 11
Can you have a constructor in abstract class? HCL 18
explain the concept of inheritance with an example? Polaris 7
What is Applet Flickering ? Persistent 1
How are Observer and Observable used?   3
What are Interceptors?   1
what is the use of Clonable,and serializable interface?   1
What is the purpose of setAutoCommit() ? Google 1
What are wrapper classes? Noah-Solutions 11
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com