Featured
-
How to split a String
Below I have written a code to split a string.
by shahbaz.ahmmod -
Send Push Notification with Custom Data to iPhone device from Java Server Side
This blog will help you to send Push Notifications
by babita.dhami -
Tomcat and Eclipse Integration Error : “Unknown version of Tomcat was specified”
If you are adding Server in Eclipse for Tomcat, an
by chandan.ahluwalia -
Spring MVC and MongoDB
Repository Class Using MongoDB : Spring has th
by sumit.vyas -
How to create DLL file from java?
Hello Guy's This Blog will guide how to create D
by bhagwan.khichar
Tags
Simple Spring MVC project
Dear programmers,
Please follow the following steps to create a simple Spring MVC project in your favourite IDE.
1. Create a dynamic web application (maven-archetype-webapp) project.
2. Add Spring dependencies :
...
Sample application using JQuery, Spring MVC @RequestBody and JSON together
See the below steps to create sample application using JQuery, Spring MVC @RequestBody and JSON :
1- Define dependency for Spring, JSON in pom.xml as below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/...
Spring MVC: Difference between context:annotation-config and context:component-scan
Difference between <context:annotation-config/> vs <context:component-scan/>:
<context:annotation-config/> : <context:annotation-config/> is used to activate all the annotations that are present in java beans and thos...
Spring MVC @PathVariable Uses
Sometimes we need to pass parameters along with the url to get the data. In Spring MVC framework, we can customize the URL in order to get data. For this purpose @PathVariable annotation is used in Spring framework.
For example you want to wr...
Spring MVC 3 and handling static content - am I missing something?
We can handle static content for example: js,css,images in Spring MVC by using mvc:resources element. mvc:resources element is used to point to the location of static content with a specific public URL pattern.
For example define the bel...
Spring MVC : How to perform validation?
Here I'm giving the example of validating form fields in a Spring Web MVC application using Bean Validation API. We'll develop a login form in Spring MVC in which we'll apply validation constraints on two fields email and password.
We use the ...
Spring Security: Obtaining current username (i.e. SecurityContext) information in a bean?
Instead of calling static method inside the controller like below:
@RequestMapping(value="/welcome", method = RequestMethod.GET)
public String getUserDetails(ModelMap model) {
Authentication authentication = SecurityContextHolder.getCont...
Sprint Security: Getting Active user's UserDetails
We can easily get active user's UserDetails in Spring Security. Spring Security provides "org.springframework.security.core.Authentication" which provides the required API for retrieving the logged in user details. The methods of this class are g...
Spring MVC @PathVariable getting truncated
We generally face a problem when we hit server with path variable that contains special character like dot(.) it gets truncated.
For Example: If you have the mapping
@RequestMapping(value = "/findMe/{emailId}", method = RequestMethod.GET)
...
What's the difference between @Component, @Repository, @Controller & @Service annotations in Spring?
When we define the annotations @Component, @Service, @Controller, @Repository with the classes, Spring automatically scan and identifies those classes and register the Bean definition with the ApplicationContext.
Difference between @Component...
What is @ModelAttribute in Spring MVC?
@ModelAttribute implies to a property of the Model object in Spring MVC. This annotation workes only if your calss is Controller class i.e. declares with @Controller annotation.
It is also used to define the command object that we declared by ...
Spring 3 MVC accessing HttpRequest from controller
Spring 3 MVC accessing HttpRequest from controller
To access HttpRequest from controller you just need to define HttpServletRequest and HttpServletResponse as parameters in a function signature of your Controller. by doing this you allowing Sp...