Skip to main content
View by: Most Recent | Topic | Community | Webloggers   
Monthly Archives:    

Blogs by topic Java Enterprise and user mriem

• Accessibility • Ajax • Blogging • Business • Community 
• Databases • Deployment • Distributed • Eclipse • Education 
• EJB • Extreme Programming • Games • GlassFish • Grid 
• GUI • IDE • Instant Messaging • J2EE • J2ME 
• J2SE • Jakarta • JavaFX • JavaOne • Jini 
• JSP • JSR • JXTA • LDAP • Linux 
• Mobility • NetBeans • Open Source • OpenSolaris • OSGi 
• P2P • Patterns • Performance • Porting • Programming 
• Research • RMI • RSS Feeds • Search • Security 
• Servlets • Struts • Swing • Testing • Tools 
• Virtual Machine • Web Applications • Web Design • Web Development Tools • Web Services and XML 


J2EE

Writing your own validator is a straightforward process. It involves implementing the Validator API and making sure you register it properly. Say you want to write a validator that will not allow you to use the string "Hello World" as a value.   package nohelloworld;  public class NoHelloWorldValidator implements Validator {        public void...
on Sep 9, 2012
Say you want to make sure that a value is required. <html xmlns:h="http://java.sun.com/jsf/html"  xmlns:f="http://java.sun.com/jsf/core">  <h:inputText value="#{user.firstName}">   <f:validateRequired/>  </h:inputText> </html> If you want to disable the RequiredValidator on a page you can...
on Sep 7, 2012
If you want to validate input against a regular expression then you would use the RegexValidator. Say you want to make sure only letters are used for a name. <html xmlns:h="http://java.sun.com/jsf/html"  xmlns:f="http://java.sun.com/jsf/core">  <h:inputText value="#{user.firstName}">   <f:validateRegex pattern=...
on Sep 6, 2012
Just like the LongRangeValidator before the DoubleRangeValidator validates if the given value is within the given range, but then a range of doubles. Say you want to make sure your donors can donate as little as 1.00 but at most 250.00. <html xmlns:h="http://java.sun.com/jsf/html"  xmlns:f="http://java.sun.com/jsf/core">  <h:inputText value=...
on Sep 5, 2012
The LengthValidator is one of the standard validators that is specified by the JavaServerFaces specification. It allows you to verify (validate) if the proposed input (submitted value) on a given component is valid. Say you want to make sure the minimum length of a password is 6 characters and up to 12 characters. The example below describe how you would put this into a JSF page to make that...
on Sep 4, 2012
During the JSF lifecycle each input value can be validated. As such the JSF runtime allows you to write validators that will take care of that during request processing. Several standard validators are part of the standard JSF runtime. Note that the specification has been written with extension in mind so it is also possible to write your own validator and hook it up for request processing...
on Sep 1, 2012
 In the previous article we described how to do testing with multiple containers. But since joining the Glassfish team I have wondered how can I test applications against different versions of JSF on Glassfish? As it turns out it is actually quite straightforward. This blog entry shows you how to do it. It will allow you to test using a 2.1.2 version and up. All by using properties passed in...
on Jan 5, 2012
In the previous article we have worked out how to run the integration tests against Glassfish, but what about other versions of Glassfish or even other servers? Well, the infrastructure groundwork has been laid for that. Before we are going to reap the fruits we are going to explain the difference between downloading, installing and configuring your server within Cargo. The main reason...
on Dec 22, 2011
In the previous article we added the Glassfish application server into the mix for testing. This looks all nice,but one might wonder how this would work in a parent project (POM) and child projects setup. Well it is fairly easy to accomplish. We will move all the bits first over to the new parent POM we are going to use. See below for what theparent POM will look like. <?xml version=&...
on Dec 20, 2011
In the previous article we described a setup for integration testing. It did not explain how to do automatic deployment to an application server. Since we want to make it convenient to do integration tests we are now going to add Glassfish into the mix. Note that in the previous article we put the integration testing into a separate profile. We are now going to put it back into the normal build...
on Dec 15, 2011
If you want to do integration testing using HtmlUnit and Maven the following sets you up for easy testing. 1. Create a Maven web application project 2. Add index.jsp page (or whatever flavor of framework you want to use). 3. Add HtmlUnit dependency 4. Write integration test for the index.jsp page 5. Add the profile to support running of the integration tests separate from the main build cycle...
on Dec 13, 2011
The JSF 2.2 ballot was approved, so now it is time to start speaking up about what you think needs to be in JSF 2.2. Obviously it takes a bit of time to start organizing the Expert Group. But nowadays individuals can join too. So there really is no excuse to start contributing. If you do not know how to get started feel free to comment!
on Apr 1, 2011
The JavaEE 7 umbrella JSR has been approved. A step in the right direction. Now we'll just have to see what is going to be included for real :)
on Mar 29, 2011
I am one of the people selected for FishCAT, so let me know what some of the bugs are you think are irritating ;) Or what you think the new version of Glassfish should contain. Or if you already have played around with Glassfish V3 builds, just let me know what worked or did not work for you!
on Aug 21, 2008

Web Applications

If you want to make sure a value is within given Long range then the LongRangeValidator is for you! Say you want to make sure your users are at least 13 but at most 18. <html xmlns:h="http://java.sun.com/jsf/html"  xmlns:f="http://java.sun.com/jsf/core">  <h:inputText value="#{user.age}">   <f:validateLongRange...
on Sep 5, 2012

Web Design

The definition of a Validator according to the Validator interface: void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException The Faces Context is passed in so the validator can introspect various aspects of the request and response. The UI component is passed in because the actual value will be stored in that UI component after it has been...
on Sep 3, 2012

Testing

 In the previous articles we have concentrated on testing using Glassfish. But can you use the same recipe to do testing on Weblogic. The answer is YES, but ..... Yea you know there is always a caveat. First make sure you have Weblogic installed properly. Note I did the testing with the latest 12c version, so your mileage may vary. Download the attached zip file again and follow along. In...
on Jan 13, 2012

Databases

OK, native queries in JPA. Not really well documented. Of course I understand that we really should not be doing that, but hey there are times where it is just plain easier. The following code snippet goes after an Oracle sequence and gets the value. EntityManager em = this.getEntityManager();Query query = em.createNativeQuery("SELECT BLOG_ITEM_SEQ.nextval FROM DUAL");Vector blogItemRow...
on Aug 22, 2007