Solved

JS Or Sevlet Or JavaBean

Posted on 2002-07-07
10
289 Views
Last Modified: 2010-04-01
Hi all,

I am having a problem on choosing a right programs to perform my business logic. I don't know either use JSP or Java Beab or servlet to code my program.

For my u understanding, so far I am holding a concept to choose my program. That's, when I need to perform some application logic or calculation, then I will used Servlet to perform that function. When I need user to enter some input or want to have user interaction,then I will choose jsp. aND For JavaBean, I will only use it when I want to connect to database.

Am I right? Please correct me if I am wrong and please add-on other ideas which you think it's right.

TQ.
0
Comment
Question by:foongkim1
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 1

Expert Comment

by:manshan
ID: 7136856
JSP - use this for user interaction and dynamic contents

Servlets - serverside authentication, database etc...

Bean - u can use it or database, for ur business logic, etc...

hope this helps...
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7137861
0
 
LVL 1

Expert Comment

by:mraible
ID: 7138187
Based on J2EE and Best-Practices with Struts, you might want to perform your business logic in a "Business Delegate" that your servlet calls.  This BD can then be used to talk to whatever persistence mechanism you choose to use.

If you're using EJBs, you might just call the EJB and pass your view layer's values to a Session Bean.  The Business Delegate creates a nice layer of abstraction and can be used by Swing clients, command-line clients, or by Servlet clients.

However, if you're just creating a web app and never have plans for having anything other than a servlet as a client, you can do this in your servlet - it will save you time.

Struts is a great MVC architecture.  If you're writing servlets, beans and JSPs, you're almost a fool not to use it ;)  http://jakarta.apache.org/struts.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:foongkim1
ID: 7142563
cheekycj, thanks for suggesting me the url. And I am really appreciate your help for another time. I will check around in that web-sites.

mraible, basically I am totaly don't undertstand what u said. I don;t know EJB, Session Bean ether. Anyway, I will go to have a look on the struts u explained here. TQ.

But, cheekycj and mraible, is that my assumption on Servlet, JSP and javaBean correct?
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
ID: 7143547
your assumption is pretty much what most people use.

Some more info on MVC:
http://java.sun.com/blueprints/patterns/j2ee_patterns/model_view_controller/


http://www.iplanet.ne.jp/developers/ias-samples/jps1.1.1/docs/patterns/MVC.html [has jsp/servlets in its explanation]

what it comes down to is this:

javabeans == Model
   This is what you will to represent objects/data etc from various resources like the Database, xml, etc.  You can write your jdbc/transaction code at this level (that is your choice) or implement a Data Access Object Design Pattern.  JavaBeans is a poor choice of terminology it is more a value bean or a simple object that stores values.

servlet = Controller
   This is where all your business logic/functionality resides (some even put jdbc code here but I prefer it in the Model level where I have separate transaction code)

jsp = View
   the Servlets/controller will pass objects (javabeans/model) to your jsp/view and it will have the display logic in it.

This is the ideal way of separating display from functionality so it makes code maintenance and management easier.

HTH,
CJ
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7143550
0
 

Author Comment

by:foongkim1
ID: 7145087
cheekycj, thanks for your information. I found it very usefull for me. Now I am confidence to tell my department that my view on choosing which typeof Java language. Thank you very much.

mraible, the web-sites u provide is not available. Please take note of that. TQ.


 
0
 
LVL 1

Expert Comment

by:mraible
ID: 7145136
The website is available, but EE added a period onto the link, try this:

http://jakarta.apache.org/struts/
0
 

Author Comment

by:foongkim1
ID: 7145350
Yes. Thank you mraible.

by the way, I just post another question regarding Java. "Integer passing with Java". Mind to have a look. Maybe you can help.
:)

TQ
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7151230
Glad I could help and Thanx for the "A".

Good Luck,
CJ
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
default methods vs abstract class 1 114
hashcode is calculated on the basis of value object 2 108
maven project jars 7 53
thymeleaf natural templating vs JSP 2 97
For months I had no idea how to 'discover' the IP address of the other end of a link (without asking someone who knows), and it drove me batty. Think about it. You can't use Cisco Discovery Protocol (CDP) because it's not implemented on the ASAs.…
Knowing where your website is hosted is as important as the features you receive, the monthly fee, and the support you receive. Due diligence should be done when choosing your next hosting provider.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question