• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

What, besides servlets and jsp, may be used for web-application?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure that I chose the correct branch, and the question may be stupid, but I'll try to ask.
Imagine, that we have a web-application (which opens in browser).
Java is used on server side (we have an application server, for example Glassfish).

Question.
Does it mean that servlets (or jsp) are neceessarily used? Or is there another way to generate html pages? (The problem is that I've heard about many technologies, like ejb and others, but didn't use them).
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any Java technology will be based upon Servlets and JSP (though some frameworks may provide their own alternative to JSP). EJB is not a replacement, but just another part of JEE.
 
Ekaterina Galkina
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your reply.

Bear Bibeault wrote:(though some frameworks may provide their own alternative to JSP). .


could you please tell which frameworks may provide their own alternative to jsp (for example)?
 
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While Servlets are involved nearly all the time they may be hidden. Iif you use an action-based framework like e.g. Spring Web MVC you won't program servlets manually, you use the framework's own classes (e.g. Controller in case of Spring Web MVC). You still can decide what presentation layer you want to use. JSP is one possibility but it could be a totally different templating engine (e.g. Freemarker, Tiles, Velocity).

If you use the component-oriented framework like Wicket you use HTML and backing classes. You won't see any servlets there (while there still is a servlet or filter serving your requests, but framework managed).

When using GWT you will produce client-side JavaScript out of your Java code that can communicate to the server in different ways but typically all will be servlet powered (a custom GWT RPC servlet which eases developement or somethinglike REST which can faciliate servlets too, if Java based).

So Java (the ecosystem) allows a lot of choices and provides a lot of frameworks. Most (all?) of the web application frameworks use servlets internally, but you won't see them or use "raw" servlets mostly. JSP can be replaced much easier.
 
Ekaterina Galkina
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks you, I'll look at these frameworks (especially Spring mvc) closer.

Now I'm puzzled, when ejb is needed.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB, Enterprise Java Beans, are part of JavaEE. They are (part of) a framework to build enterprise-y applications. These applications don't need to have a web frontend.

Servlets and JSP were intended as (one kind of) frontend for JavaEE application. But you can use these without the need for EJB in a container that does not know about EJB (a servlet container like Tomcat). In fact this allows for loose coupling between business layer and presentation layer and additional security. As EJB were not quite ... fun to program in earlier iterations, people built other application frameworks that could be used within a simple servlet container (frameworks like Spring). So you can have one without the other, mutually.
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hauke Ingmar Schmidt wrote:EJB, Enterprise Java Beans, are part of JavaEE. They are (part of) a framework to build enterprise-y applications. These applications don't need to have a web frontend.


Not true.
EJB are/can be used to execute the business logic in Java web applications (though you need an application server or an embedded EJB container inside the web container).
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Todd wrote:

Hauke Ingmar Schmidt wrote:EJB, Enterprise Java Beans, are part of JavaEE. They are (part of) a framework to build enterprise-y applications. These applications don't need to have a web frontend.


Not true.
EJB are used to execute the business logic in Java web applications (though you need an application server or an embedded EJB container inside the web container).



Hm. They can be used this way, but it is not the only way. EJB are not mere web adapter for business logic implemented by another system.
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I was talking about is your sentence:

These applications don't need to have a web frontend


It is not true that enterprise application don't need to have a web front end.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Todd wrote:What I was talking about is your sentence:

These applications don't need to have a web frontend


It is not true that enterprise application don't need to have a web front end.



Then maybe I just got caught in the subtleties of the English language and some false friends...

What I wanted to express is: These application may have a web frontend, but it is not mandatory. They can have different or multiple frontends as well. EJB are not bound to servlets/JSP, it is only one possibility.

(May, need, must, need, have... I need to do some vocabulary brush-up.)
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Todd wrote:What I was talking about is your sentence:

These applications don't need to have a web frontend


It is not true that enterprise application don't need to have a web front end.


Huh? There are plenty of enterprise apps that do not have a web front end. What are you talking about?
 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe we lost in words.
Hauke said:

These applications don't need to have a web frontend


This is generalization, some do need web front end and some don't.
Maybe it is a matter of miscommunication
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

John Todd wrote:Maybe it is a matter of miscommunication


Indeed, I think so. In this context "don't need" means: they may have, but not necessarily so. In other words: some do, and some don't.
 
Ekaterina Galkina
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks to you all.
Is it common to have web-based front-end and business logic on ejb?
In case if servlets are used separately (without ejb), who/what implements business logic? Does developer jus tcodes his own java classes (not using ejb) ?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB isn't nearly as widely used as servlets/JSP. It's perfectly possible (and more common, I'd say) to create your own data layer based on JPA, JDBC or some other DB access library.
 
Ranch Hand
Posts: 45
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If we are just using applications for simple things and not big enterprise applications I would say using EJBs would be overkill.You can encapsulate the business logic using POJOs and data model using JavaBeans But if you are using some complex stuff like JMS, web-services then EJBs save you a lot of work.
 
Ranch Hand
Posts: 137
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats appropriate, But EJB is nowadays a tiring job for any developer to code specifc segments of functionalities (Transactions/Security/Concurreny/JNDI Lookup) and at the same maintain better design approach. which is a cumbersome. So, todays trends provides Spring Framework, that comes up all-in-one plate to pick/use features which you need. Services are already in place , we just need to provide our implementations, and at the same mainatin design protocols like coupling throught DI/IOC , AOP , WebMVC, DAO integration with ORM , integration with struts/velocity/jsf... and lots more. !! Go through Spring Framework concepts , it will fetch you how to place ut problem state into designated places and make them feel/work in a better fashion , i mean in OOP's way!
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sidharth Pallai wrote:But EJB is nowadays a tiring job for any developer to code specifc segments of functionalities ... [snip] ... and lots more


This sounds a bit as if you may not have kept up-to-date with what's happened in JEE 5/JEE 6 - which introduced a lot of the concepts you're talking about to JEE, for example in the shape of JPA. There's nothing wrong, of course, with checking out Spring, but it's not as light-weight as it used to be, and JEE has gained considerably on it. Plus, some of its constituent pieces (like JPA) can be used in web apps without having to run a full JEE server.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sidharth Pallai wrote:Thats appropriate, But EJB is nowadays a tiring job for any developer to code specifc segments of functionalities (Transactions/Security/Concurreny/JNDI Lookup) and at the same maintain better design approach. which is a cumbersome. So, todays trends provides Spring Framework, that comes up all-in-one plate to pick/use features which you need. Services are already in place , we just need to provide our implementations, and at the same mainatin design protocols like coupling throught DI/IOC , AOP , WebMVC, DAO integration with ORM , integration with struts/velocity/jsf... and lots more. !! Go through Spring Framework concepts , it will fetch you how to place ut problem state into designated places and make them feel/work in a better fashion , i mean in OOP's way!



Wow! No disrespect but what century are you from man?. Spring is an awsome framework at least you got that one right. But Jave EE 6 has introduced some fantastic features and EJBs are now pojos. I hope this doesn't offend you as that is not my intention but I suggest you please read about the latest JAVA EE specification before making those claims as they are now entirely outdated.
 
Gabriel Emanuel Sosa Zimmerman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ekaterina Galkina wrote:I'm not sure that I chose the correct branch, and the question may be stupid, but I'll try to ask.
Imagine, that we have a web-application (which opens in browser).
Java is used on server side (we have an application server, for example Glassfish).

Question.
Does it mean that servlets (or jsp) are neceessarily used? Or is there another way to generate html pages? (The problem is that I've heard about many technologies, like ejb and others, but didn't use them).



You may want to have a look at JSF 2. It's a great specification that builds on servlets but doesn't require you to write them yourself. It's somehow like jsp but with a rather different approach. It's a component based framework and uses facelets for templating. If you need a hand with this, just pm me.
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic