Programmatically obtain a request-mapping URL for a module in Spring

Java-Design-and-Development

In this article, we will discuss how to programmatically obtain a request-mapping URL for a module in Spring. Java developers know that all versions of Spring from version 3.0 onward, allow the developer to manage handler mapping by defining it in the controller class using an @RequestMapping annotation as an alternative to the XML configuration file.In addition to this capability, developers can also annotate the controller class for top-level request-mapping URL. In that case, the class level URL will be prefixed to the method-level URL to form a complete URL and send a request to the controller.Normally, developers establish one controller per module. But, sometimes they need to obtain the class-level request-mapping URL programmatically. In this article, we will provide an example of this technique, and show you how it can be achieved in Spring.

For our example, we’ll use a module called ‘Employee’. For this example, we’ll need to display an employee’s personal details, in addition to other information, on the main employeeDetail page. We’ll separate the main page into several small jsp pages. The file that will display the employee’s personal information is empPersonalDetails.jsp and that page must be included in the main page (employeeDetails.jsp), using action.

Let’s assume that you have used apache tiles to provide consistent layout for each such sub-page (due to some requirement or just for decorative purpose) and you want to include that through a controller call. To accomplish that, you will use code similar to what we have detailed below:

###

Java Ain’t Just a Cup of Joe

Java-Design-and-Development

We all know that Java is more than a cup of ‘Joe’. In the technology world, Java is, of course, an object–oriented programming language with a built–in application programming interface (API), and a rich set of APIs and its platform independence, Java can stand alone as a platform in and of itself.

Java provides a wide range of ready–to–use technologies and frameworks. If your enterprise wants to build an application or a software product in Java, it is important to use a professional team of Java experts. These experts can ensure business success and customer satisfaction with skilled technical feasibility services,a thorough command of architecture, product design, development, maintenance and support and even, (for those nightmarish redesign projects) software re-engineering and Ux design services.

###

Continuous Integration Ain’t What it Used to Be (With Jenkins, It’s EASIER)

In a previous article, entitled, “Continuous Integration: How to Avoid ‘Integration Hell’, we discussed the general issues and considerations of the continuous integration environment and projects. In this article, we will discuss Jenkins (previously known as Hudson), which is one of the most popular continuous integration (CI) tools, and how you can achieve Continuous Integration using this tool.
The Jenkins tool is an open source Continuous Integration tool which is written in Java, and runs in a servlet container like Apache Tomcat. It can be used to build software written in various languages such as Java, .Net, PHP, C++ etc. This open-source, free software is available under MIT License.

###

Continuous Integration: How to Avoid ‘Integration Hell’

PDMS

If you have worked on a software development team, you will recognize these scenarios:

  1. You have a large team of engineers developing a software application. While committing the code in the repository, one of the developers forgets to commit one or two files. When other team members take the repository updates, they find problems in the code due to the missing file changes, and they have to spend a long time debugging the problems.
  2. Your engineering team is developing a software product. Your Business Analysis team needs frequent updates of the code to validate the changes or demonstrate new features to the customers. Preparing a new build and deploying it on the staging server for a BA team takes a significant amount of a developer’s valuable time.

###

No Fuss! No Muss! Implement Validation Using JSR-303 Annotations in Spring

Java-Design-and-Development

Every designer and developer knows that user input Validation is a vital part of development for any application. Since the inception of the various MVC frameworks like Struts, Spring, JSF etc., the method of implementing validation has been included in application design considerations. These frameworks set the standards for implementing validation by providing the necessary supporting classes, and certainly, having clean design for validation has its benefits with respect to application maintenance.Prior to the release of version 3.0 of Spring, validation implementation required that the validator class is registered using a Spring configuration XML file. In addition, developer had to validate the fields and ensure error registration using ValidationUtils in the validate() method of the validator class. After the introduction of annotations in Spring 3.0, implementation of validation was simpler and cleaner. Developers can reduce the code by using the Hibernate Validator framework along with Spring. As of this writing, the latest version of the Hibernate Validator Framework is 5.0, which is the reference implementation of JSR-303). The following illustrates the implementation of constraints and validation using JSR-303 annotations:

JAR Dependencies: You’ll need to put the JAR files from Hibernate Validator Framework in the application classpath, which is WEB-INF/lib in a Java Web Project. Hibernate Validator 5.0 ships with a number of various JARs. While some are optional, the following are required JARs for validation implementation.
hibernate-validator-5.1.0.Final
validation-api-1.1.0.Final
classmate-1.0.0
jboss-logging-3.1.3.GA

Annotate model properties: Once you have entered the above JARs in the classpath, you can use the annotations provided by them. The following is an example of a model class where you would need to annotate the properties with required constraints. Note how @Size and @NotEmpty are used.

###

Java Will Perk Up Your Business and Customers Faster Than a Caffeine Fix!

Java

Every consumer and business employee uses the internet, and whether the task is related to product or service purchases, entertainment, or information sharing or collaboration, every internet user has seen the logo for Java on a site or in a window for a version upgrade.Java is an object–oriented programming language with a built–in application programming interface (API). The reason Java is so popular among developers and site designers is its rich set of APIs and, more importantly, its platform independence. Java can stand alone as a platform in and of itself and that is important in today’s open access world. Businesses and consumers do not want restrictive silo-based applications or sites that limit their independence, accessibility or mobility. Java provides a wide range of ready–to–use technologies and frameworks, and that foundation allows developers to build enterprise, internet, intranet and embedded applications, and provides and supports many tools and frameworks.

###