Java EE is already the perfect solution for complex business/enterprise systems and provides all the tools and foundations required to deliver scalable, performant applications for a wide variety of customers and clients.
But how does the end user experience stack up? How easy is it to navigate through your Website? Is your code full of nasty navigation logic? Are your links clear, transparent, and informative? Do you find yourself adding ‘?query=parameters’ in order to serve dynamic content from your application? Can you ensure that you are not leaking information in your URLs, and that your applications are secure from URL-based attacks? Are your old links making it difficult to migrate or integrate a legacy application to a new one?
These are all things that URL rewriting can help with, and if you are uncertain about any of these questions, this talk is for you. Watch this session from JAXConf 2012 and see what’s possible with the power of URL-rewriting.
For more information on the [[Rewrite]] project, visit the project homepage at [[Rewrite | OCPsoft]], and be sure to check out all of the other cool Java open-source projects while you’re here.
Getting started with Hibernate and JPA (Java Persistence API) can be tricky, but this step-by-step tutorial explains exactly what needs to be done to set up your application to use this technology. This chapter covers very basic mapping and persistence.
When we are finished with this tutorial, we will have a standalone Java SE application with database connectivity. This article is part of a series: Guide to Hibernate Annotations
I’m about to show you a pattern that will make your heart sing. I have to thank Brian Leathem
for his original idea to use CDI events in the ValueChangeListener, but when combined with a little
Lincoln Baxter, III
speaks on the well and lesser known uses for URL-rewriting in modern web applications, how it can be used to increase security, enhance usability, and how it can supplement any new or existing application – no matter the language or technology.
The PrettyFaces team is pleased to announce the release of PrettyFaces 3.3.0. PrettyFaces is an OpenSource Servlets extension with enhanced support for JavaServer Faces – JSF 1.1, 1.2 and 2.0 – enabling creation of bookmark-able, pretty URLs. PrettyFaces solves the “RESTful URL” problem elegantly, including features such as: page-load actions, seamless integration with faces navigation, dynamic view-id assignment, managed parameter parsing, and configuration-free compatibility with other web frameworks.
Features & Enhancements:
- Performance improvements when running JSF 2.0 in project stage ‘development’
- Regular expression performance improvements provided by Yann Simon.
- Ambiguous View IDs are now resolved automatically when using pretty:mappingIds in action method navigation, <h:link> and <h:button> component outcomes
- Ambiguous View IDs may now be resolved manually for outbound URL rewrites by adding ‘?com.ocpsoft.mappingId=…’ to URLs before calling HttpServletResponse.encodeURL(…)
- Dynaview URLs* are now resolved during rendering of links and navigation cases, and are now as functional as traditional mappings.
- Fixed bug that caused path parameter validators to be ignored (#102)
- Handle java.lang.ClassFormatError during initialization of bean name resolvers (#101)
- Also check Weld 1.1.x specific servlet context attribute while search for BeanManager
- Mapping inheritance now working correctly for mappings using the same viewId
– Previously, DynaView URLs would only function on inbound requests, and once the method was evaluated, the value would be processed and then abandoned. For example, when rendering <h:link /> components, users would actually see the dynaview method definition rendered as their url! That is not a good experience, so in resolving the problem, we simple evaluate the dynaview method a second time (or as many times as necessary) in order to render the desired link target. And we do this using…
Do you have an existing Maven-based Java EE application that you’d like to clean up a bit in the browser? Do your URLs look too much like this:
And not enough like this?
Are you building a new application, and don’t want to sacrifice anything when it comes to usability or SEO capabilities? Well, URL-rewriting is your answer, and it’s easy to get started, even easier using JBoss Forge.
I was recently asked the question, “Is it possible to create a modular JSF application, where JAR-files act as plug-ins and allow xhtml views, images, css, navigation rules, and managed beans to be added as modules to the application?”
The answer to this question is, “of course,” but there is no pre-set way of accomplishing such a task, so you’ll have to be a little creative. I’ve come up with a conceptual architecture that “would work,” if properly implemented, but keep in mind that this is just something I threw together in a few minutes of thinking about the problem.
A recent thread came up on the JSF 2 forums: “Why can’t I use @Inject in a PhaseListener? This CDI stuff is so confusing.
FIrst, before I start explaining: this is
possible, but there’s a little background you should probably know. The answer to the question “why can’t I use CDI in JSF PhaseListeners?” is: because JSF 2 was completed just a few short months before JSR-299 and the rest of the Java EE 6 platform specifications were finalized. In my opinion – because of the current state-of-affairs in the JCP –
it was just not a safe bet to promise integration with other technologies that might not have been finalized in time. Fortunately, however, JSF goes to extra lengths in providing extension points – solving this with an extension was not too difficult.
So Java EE 6 is out, and you’ve decided to give it a go. You’re trying to port an existing application over to the new stack (or are trying to create a new one for the first time,) but exceptions are bursting through the seams and you just can’t seem to get things to work. If you’re familiar with Spring and Hibernate (with all the joy that is OpenSessionInView or
OpenSessionInConversation,) more than likely the problems you’re having are related to the Java Persistence API (
JPA), combined with Enterprise Java Beans (
EJB). Contexts and Dependency Injection (
CDI) should be a familiar face if coming from Spring, but things are subtly different in the world of Java EE.
Here’s a simple tip for all of you AJAX lovers using JSF 2.0. It is
possible to render components that live outside of the form where your AJAX tag lives; actually, it’s possible to render any component by using it’s fully-qualified component ID.
Just prefix the target ID with the naming-container separator character, usually “:”, and provide the full name of the component as it is rendered on the HTML page.
<f:ajax execute="validatePasswords password @this" render=":messages" />