Integrating managed web-content into existing J2EE app - java

I'm looking for a java based CMS application that will allow me embed specific UI 'component's or 'regions' (eg. newsfeed, page-section, video, etc.) into pages of an existing J2ee web application. The idea is to mix managed content with custom web-application function, where the 'dominant' web-application is our custom application but it integrates these components for which the content can be manged by A CMS. I have looked through a number of CMSs (Jahia, Magnolia, Alfresco, Nuxeo, Walrus and a couple more), but haven't found anything that readily provides managed components that I can integrate easily. Integration can be at the controller, jsp or even client (Ajax/iframe) level, but I am trying to stay away from introducing portlets into my stack.
I am currently using Spring and Struts2.
Thanks

I believe the Portlet Framework suits your needs here. Many CMS's support this specification and the main point is to absolve you from doing the low level, often very messy integration you're talking about. I use Liferay 6 with moderate satisfaction.

Related

Migrate JSF application to JavaFX

I'm interested how I can migrate JSF application to JavaFX 2.0 Application? I want to preserve the managed beans where I have integrated the business logic. Can I somehow use the managed beans as backed and use JavaFX for presentation layer?
What are the options?
Options:
Use CaptainCasa, which is a framework for taking JSF pages and rendering them in a JavaFX client.
Do as Alexander recommends and rewrite a lot of your app to switch the view, control and navigation management to JavaFX.
Host the existing JSF application in a WebView, incrementally enhancing and migrating parts of it to pure JavaFX on an as required/time permits basis.
I'm not a JSF expert, nor do I know your application, so I can't really recommend what might be the best approach for you. Definitely option 3 is the easiest.
Read JavaFX in Front of JavaServer Faces: CaptainCasa for more information on CaptainCasa.
WebView is not a full browser engine only an HTML viewer, so if you need a bit more functionality, you could adapt something like Willow or WebFX to handle some of the page navigation aspects that a browser normally would do.
I assume you want to keep the managed beans running on a server rather than integrate them into your client, in which case you are going to need to develop a communication layer to communicate between the clients and the server. You could use REST for this as demonstrated in the Henley data sales sample app, though it may be easier to use something like the Hessian system outlined in this blog.
I've found another option to evaluate the trouble - try to lookup in google the next request:
"JSF site:fxexperience.com"
fxexperience.com - site-blog, which supported by JavaFX developers, and except other posts, they weekly provide link batches on different interesting resources.
For instance, I've found such link : http://www.jsfcentral.com/articles/jsf_and_javafx.html
I expect, if decision exists, it could be found there.

JSF or JSP 2 Tag Files for new project

I have a requirement to amalgamate functionality from some parked Java side-projects into a new application and am trying to make a decision on some of the third-party libraries to use, specifically relating to the UI. I would be very interested to get some feedback from tech arch oriented members on their views in relation to recent java framework trends and experiences.
The legacy projects are a mixed-bunch, all web-based, lots of business logic around CRUDable objects with searches. One uses an in-house framework - very fast, scalable, but with the disadvantages associated with in-house work - learning curve for new devs etc. Another, a Tapestry 5 app - very robust, terrific integration with XFire / CXF for generating web services, rapid UI generation, but with a good learning curve for non-Tapestry types. The third, a Spring 3 app, using JSP 2.0 Tag Files for view layer, with some sprinklings of JQuery for presentation / ajax.
I'm very familiar with Spring and find tag files for the UI with Tiles very effective in terms of low-complexity and performance. I have also recently wrapped up a project that used RichFaces 4 which was successful and came in on time. I like the rich UI that comes for free with RF / IceFaces etc., and have noticed that JSF in its more recent versions has retired JSP altogether.
To cut to the chase, is the restriction of using a component based UI library with clearly defined but unmodifiable behaviour like RF / IF a better fit for a new app than a roll-your-own solution, with tag files / JQuery. I'm more familiar with the latter, but don't want to go down the wrong path at this early stage of a project by adopting an out of date approach. I want to continue using Spring 3 Controllers for RESTful, bookmarkable application entry points - do IF / RF mix with Spring or does a JSF approach remove the MVC obligation completely from Spring?
If the MVC obligation is removed from Spring:
how would the JSF lifecycle integrate with Spring - would it be self-contained and just use IOC for wiring Spring services?
is there good integration with a IF / RF approach for generating web services etc.?
what kind of support do IF / RF have for tablet / mobile?
is Spring needed at all - would managed beans do the trick?
To cut to the chase, is the restriction of using a component based UI library with clearly defined but unmodifiable behaviour like RF / IF a better fit for a new app than a roll-your-own solution, with tag files / JQuery.
It is not one or the other. Java Server Faces is a Component Based Web Framework that allows for the synchronization of server and client state on requests and responses to allow for things like a phase and event model in your applications. Many JSF components utilize jQuery inherently and expand upon rich client controls by wrapping them in server side behavior. It is not unmodifiable behavior by any stretch, just that there is a bit of a learning curve to customize things in a very specific way.
JSF is currently the Oracle recommended approach to Java EE web development.
do IF / RF mix with Spring or does a JSF approach remove the MVC obligation completely from Spring?
how would the JSF lifecycle integrate with Spring - would it be self-contained and just use IOC for wiring Spring services?
JSF is inherently its own MVC framework and with managed properties already has its own baked in Dependency Injection. Core Spring is primarily Depedency Injection so one would think that they are at odds but surprisingly they go together well.
Recent versions of Spring have provided their own EL Resolver implementation for JSF that allows JSF Managed Beans to be handled as Spring beans. This class can even be backfitted into older versions of Spring, which I have done and noticed no issues.
Spring MVC is primarily built on JSP technology, but it is not a core part of Spring. You simply need not include it in a JSF web application if you don't wish to serve JSP pages.
is there good integration with a IF / RF approach for generating web services etc.?
When it comes to web services in a JSF application it is best to remember that JSF doesn't have to define limitations on your web app, nor does it have to define it in its entirety. JSF is merely the front end for JSF page requests. Knowing this your same web application can also serve SOAP or REST based web services of their own, or simply handle these web services at data sources on the server side in your business logic. Another way still is to call external web services from Javascript on your page. Nothing in JSF precludes you from incorporating any element of HTML, Javascript or even newer HTML5 technology.
what kind of support do IF / RF have for tablet / mobile?
Not sure what IF and RF have but I know that Primefaces has an impressive control set for mobile applications that is worth checking out.
is Spring needed at all - would managed beans do the trick?
No absolutely it is not needed. I happen to like Spring though so I use it.

Which front end technology with Java EE backend

There are so many languages in web development that sometime I get confused which one to learn and start with. I like Java, but dont like JSP for presentation, are there any front-end technologies that best suits with Java/Java EE backend for web application development?
The web-layer technology that is promoted in recent JavaEE versions is JSF. It uses facelets instead of JSP for its views.
JSP with JSTL is pretty fine though, I don't see a reason to drop it. You can use it with any web framework, like spring-mvc, struts, or other frameworks with different rendering technologies like GWT, Vaadin, Wicket, etc.
With most things it depends on what your project requires. Here are two powerful web techologies you may find useful.
Vaadin (Front and backend integrated as pure Java)
For rich, AJAX heavy applications Vaadin can be a great fit.
Advantages:
- Rapid development for complex interaction between UI components and backend beans
- Pure Java solution, no need to worry about creating markup or maintaining massive javascript files
- Good documentation
- Many powerful components out of the box and through the open source community
Disadvantages:
- There can be a steep learning curve to understand the various components
- Extending/changing some features (such as how a UI table retrieves data from a data source) can be very difficult
- If your application needs to be highly scalable, keep in mind this framework is stateful
- Handling back button on browser and dynamic URLs is extra work
Spring MVC (Front is JSP or HTML, backend is Spring MVC)
If you want to maintain total control and scalability, Spring MVC with or without JSP is your best bet. Here's a good hello world and more spring mvc tutorials are available on that site.
Advantages:
Relies primarily on open standards
Highly scalable
Helps enforce proper MVC in your code
RESTful framework, allows the developer to easily handle dynamic URLS and GET/POST separately
Retain total control by creating the HTML/CSS/JS
Note: For a HTML/CSS/JS solution, I recommend starting with something like Zurb Foundation or Twitter Bootstrap. It will save a lot of time compared to starting from scratch. Download the latest and import it into your webapp folder to get a quick boost on your project.
Disadvantages:
- Managing AJAX calls can become challenging on large applications
- A more indepth knowledge of HTML/CSS/JS will be required (compared to Vaadin)
I think Spring MVC with ExtJS is the best option as ExtJS MVC really make the code readable and easy to manage. Similarly, IC of spring MVC will also make life easier for developer. I would recommend to look into Play framework. Play for java is good but if you want to dig more then obviously it will give you hard time as it mainly developed for Scala.
Depending of the front end type you want to write, there are several options. If you can accept the style and model, have a look at SmartGWT. if you want a more GMail-like experience plain GWT 2.2 is pretty nice.

Frameworks for developing a web UI on Linux (preferably with Java)

I'm asking this question because I'm having some difficulty choosing a framework (or selection of technologies) that I can learn and use for developing a web-based UI for a small Java application:
For background information relating to the app I'm developing please read this question:
So, developing the Java application is going ok and now I'm in a position where I would like to develop a web-base UI for it.
The application and database (MySQL) currently run on a Debian Linux box, as such I've decided that it would sense to use Tomcat to run the Web App. The Web App is to serve the following purposes:
1. Manage the execution of the App by CRUDing data from the MYSQL database.
2. Display status information about the app (i.e. what orders it's placed, what orders are pending, etc.)
3. Produce on demand reports on stuff like the running profit and loss, historic and realtime prices and pricing analytics
So far so good now here's the problem:
There are a bewildering number of choices for how to develop the UI, to name a few I've looked at:
JSPs + Spring MVC
JSPs + Sping WebFlow
JSPs + JSF + Facelets
Wicket
JSPs + JSTL
etc, etc...
The choices seem endless. Is there's a clear industry standard for developing web based UIs using Java related technologies? If so what is it? Ideally I would like to learn a framework which I can use in the majority of real world jobs (and preferably one which can be used from Eclipse).
Thanks and Kind Regards
Personaly, I prefer another approach,
I would go for Eclipse of course, Spring (or other IOC container), Hibernate / JPA + JAX-RS or JAX-WS for the server layer, but not nessecarily JSF / JSP for UI.
For presentation layer, I would rather go with Flex, GWT, or a JQuery in an SOUI approach. (the service layer returns incremental updates in the form of XML or JSON, I swore not to mention the term AJAX)
Your service layer would serialize partial object graphs by demand from the presentation layer, which will act as a disconected client (work on an "offline" dataset , and update dirty on demand)
But that is just my wet dream, and in my current project I'm stuck with Spring MVC, and JSP + JSTL
I would give Jboss SEAM a test drive, just because Gavin King is behind it, but I think its JSF based.
I don't know why I don't see JSF as a SOFEA / SOUI approach, as JSF and AJAX go together well, but for some reason, JSF didn't win my enthusiasm as much as the above suggestions (Flex as a favorite)
See my related question: Web architecture: MVC, Lazy initialization, Data transfer Objects, Open Session In View, is there a consensus approach?
Is there's a clear industry standard for developing web based UIs using Java related technologies?
Well, Sun's Java EE standard is Java Server Faces (JSF) but the version 1.x of JSF is IMHO a kind of failure. This explains why they are so many alternative out there. But NO, there is no clear winner.
Ideally I would like to learn a framework which I can use in the majority of real world jobs (and preferably one which can be used from Eclipse).
Actually, Matt Raible has done very famous presentations on presentation frameworks that you'll find in Comparing JVM Web Frameworks Presentation (the latest version goes beyond Java frameworks only). Really, have a look at both of them, this is very, very good material (with real life metrics).
Personally, I'm a JSF 1.x skeptic so I would not go in this direction (there isn't lots of demand for JSF in my country anyway) but rather choose an alternative. I think that Struts 2, Spring MVC, Stripes (this one is my preferred one), Wicket (this one is getting more and more attention) are all decent choices, they'll all get the job done, the 2 first one being I believe more asked on the job market (but not the smartest). For the final choice, I'd follow Matt's advice: Eliminate, Don't Include. If the popularity on the jobs market is an important criteria, then I guess Stripes and Wicket will get eliminated. If configuration verbosity is a concern, Stripes wins. If you're looking for a kind of Swing experience, Wicket is your friend.
Now, I need to mention that the freshly released JSF 2 and CDI (JSR 299) should be a big improvement (according to the people who worked on it). As I said, I'm a JSF skeptic and I need to take a second look (because Gavin says so). But I still didn't so I can't say anything for now and I won't make any bet on the adoption and future market demand of this new version. But it's worth noting that JSF 2 with CDI should be a really new and different experience.

Java development for the web [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm looking to start developing for the web using Java - I have some basic Java knowledge, so that's not a problem, but I'm at a loss when it comes to deciphering the various technologies for use in web applications.
What options are available to me? How do they work? Are there any frameworks similar to Django/Ruby on Rails which I could use to simplify things?
Any links which could help with understanding what's available would be much appreciated.
Java frameworks come in two basic flavors. One is called the "Action" Framework, the other the "Component" Framework.
Action frameworks specialize on mapping HTTP requests to Java code (actions), and binding HTTP Requests to Java objects. Servlets is the most basic of the Action Frameworks, and is the basic upon all of the others are built.
Struts is the most popular Action framework, but I can't in good conscience recommend it to anyone. Struts 2 and Stripes are more modern, and very similar to each other. Both are light on the configuration and easy to use out of the box, providing very good binding functionality.
Component Frameworks focus on the UI and tend to promote a more event driven architecture based on high level UI components (buttons, list boxes, etc.). The frameworks tend to hide that actual HTTP request from the coder under several layers. They make developing the more advanced UIs much easier. .NET is a component framework for Windows. On Java, the popular component frameworks are JSF (a standard) and Wicket.
As a rule, if you're creating a "web site". that is something more akin to presenting information (like a blog, or a community site), the Action frameworks work better. These sites tend to be simpler, get bookmarked often, require "pretty URLs" etc. This is generally easier to do with an Action framework.
Component frameworks are much better for things like back office applications with lots of UI elements and complicated workflows. You'll find, particularly with tooling, that these style of apps will go together faster using a component framework. But component frameworks have more complicated request workflow, sometimes relying on hidden state, lots of POST actions, etc. Many have "horrible" URLs, and sometimes create pages that are difficult to bookmark.
Both frameworks can be used for both tasks, just some are more suited to the task than others.
None of these frameworks directly address persistence, but many have extension modules or idioms that work tightly with JPA/EJB3 or Hibernate.
Your basic java web technology is servlets. Servlets let you write Java code that responds to various HTTP events (doGet, doPost, doPut, etc). They're generally used for controllers in the MVC architecture.
Link: http://java.sun.com/products/servlet/
JSP lets you write HTML with embedded Java instead of the other way around (in servlets). JSP has been extended via JSF to incorporate more recent architectural advances. This is in the same line as PHP and ASP. This is the view portion of the MVC architecture.
Link: http://java.sun.com/developer/technicalArticles/GUI/JavaServerFaces/
A lot of more complex applications utilize Enterprise Java Beans (EJB) for session management, clustering, etc. This isn't a web technology, per se, but you see it go hand-in-hand when dealing with more complex webapps. Alternatives include frameworks such as Spring.
EJB: http://docs.jboss.org/ejb3/app-server/tutorial/
Spring: http://www.springframework.org/
Also, you'll want to familiarize yourself with ORM technology (after servlets and JSP/JSF). The leading ORM framework is currently Hibernate. This lets you map SQL tables to java objects and interact with them accordingly. This is more advanced stuff so save it for when you're trying to get your head around EJB/Spring, etc.
Link: http://www.hibernate.org/
edit: I forgot to define ORM. It stands for Object Relational Mapping/Mapper (whatever version of "Map" you feel like using :)
Start with JSP backed by logic in Java classes. Or use servlets.
The advantage of using JSP and Servlets is that you gain knowledge of what all the frameworks do under the hood. And that understanding is crucial to figure out how to do X in that particular framework.
Furthermore, JSP is very easy. You can easily see what you're doing and very easily see it when you mess up the view with business logic.
And quite a lot of frameworks (Struts, Spring MVC) use JSP as their view technology. It's a natural first step in web development using Java.
I don't know if there's anything quite as nice as Django for Java, but Spring has a light-weight web framework built on J2EE
http://www.springframework.org/about
A flexible MVC web application
framework, built on core Spring
functionality. This framework is
highly configurable via strategy
interfaces, and accommodates multiple
view technologies like JSP, Velocity,
Tiles, iText, and POI. Note that a
Spring middle tier can easily be
combined with a web tier based on any
other web MVC framework, like Struts,
WebWork, or Tapestry.
something like grails ?
there is also the projects from spring
You'll need to start with servlets and JSP. There are many web frameworks in Java and all of them are based on these two technologies.
You could try Jboss Seam : http://www.seamframework.org/Documentation/GettingStarted
If you are using Eclipe as your IDE there is good integration via Jboss Tools or you can use the Seam-Gen tool that comes with Seam. This allows you to define a database table (or tables) and with a few easy commands, build an entire runnable web project from it. It's a nice way to get the ball rolling.
Also Java Server Faces
http://en.wikipedia.org/wiki/Java_Server_Faces
This is a very open-ended question. The short answer is "yes" there are frameworks, libraries and standards to do everything from writing things at the HTTP request level up to content management systems in Java.
You can also use other languages (e.g. Python, Ruby, etc) on the JVM for that matter.
For some of the Java-only technologies, investigate JSP/Servlets, Struts, Struts2 (which is the updated version of Webwork), Spring MVC, Tapestry, web4j, Wicket.
There are other frameworks built on the JVM but use languages other than Java such as Grails.
To get started I would download Eclipse (latest version) and Tomcat. Create a new web application in Eclipse. There are guides that can get you started.
Start with learning how JSPs and Servlets work, these are a bit low level and aren't really a framework, but will let you get up and running quickly. From there investigate and choose your framework.
Spring MVC is pretty easy to get set up and going. I'm certain there are others.
If you already know Ruby On Rails, you can use it with JRuby and deploy to a Java server (like Tomcat) with Warbler.
In pure Java, Wicket has a good approach and is getting quite popular.
Before studying those frameworks, why not study first where it all started? Try programming with servlets first, so you could a peek at the core of most of those java web frameworks. It would help you understand J2EE better.
J2EE is the standard. You can use this to build apps with Java Server Pages, Servlets and EJBs.
Struts is also a very popular framework that uses JSPs and Servlets. Its a bit tricky to get setup but it is a very good option for mid size sites.
http://en.wikipedia.org/wiki/Struts
In general Java is more component-based, i.e. you don't have frameworks that do it all for you (you'll probably have to pick a database access framework yourself, for example). For Data Access I'd recommend Hibernate or iBATIS.
For the front-end there are literally hundreds of frameworks around. Investigate JSF, Wicket, Struts 2, Stripes - whichever one you use depends on your specific needs as they all have different strengths.
And for a business layer I'd recommend the Spring Framework, which is very comprehensive and has a great reference guide / tutorial :)
I learned Java in college back when it was in version 1.1.5. I recently started trying to program for the web, but it didn't make sense until I read Head First Servlets and JSP. There are way more things involved in web development with Java than I ever realized, and without this book, I would have quit and just used PHP.

Categories

Resources