50% Off/-

50% Off/-

Php

50% Off/-

50% Off/-

Web

50% Off/-

50% Off/-

Latest Added Tutorials

Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure. The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect. Aspects enable the modularization of concerns such as transaction management that cut across multiple types and objects. (Such concerns are often termed crosscutting concerns in AOP literature.) Lets start how to configure load time weaving in Spring framework. applicationContext.xml Configuration <bean id=...Continue Reading
@InitBinder annotations is used to resolve type mismatch and bind exceptions occured in a form application. In this tutorial, we will try to explain how to use @InitBinder annotation to catch submitted collections in a form application. Lets create a JSP file as follows: <form:form commandName="belge" action="/kullanici/belge/kaydet"> <form:select multiple="true" path="belgeSatirlar[0].gumrukKodlari"> <c:forEach items="${gumrukler}" var="gumruk"> <option value="${gumruk.kod}">${gumruk.aciklama}</option>...Continue Reading
Question: I have this in web.xml <filter> <filter-name>encoding-filter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding-filter</f...Continue Reading
<tx:annotation-driven transaction-manager="transactionManager"/> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="packagesToScan" value="com.codesenior.telif.local.model"/> <property name="hibernateProperties"> <props>
Custom Logout and Logout Success URL: <logout logout-url="/logout" logout-success-url="/problemSolution/index?logout"/> Note: /logout url is used by Spring Security. This url doesn't refer to any .jsp pages, so you can set any value. index.jsp page: <c:url var="logoutUrl" value="/problemSolution/logout"/> <form action="${logoutUrl}" id="logout" method="post"> <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/> </form> <a href="#" onclick="document.getElementById('logout').submit();">L...Continue Reading
File Uploading is a very common in any web application. In this tutorial, we will introduce three different file upload operations: single file upload, multipe file upload, and ajax based file upload. First of all, there are some pre-request steps needed: 1. Create a Maven project 2. Add Spring Framework dependencies 3. Add Javax Servlet and JSTL dependencies 3. Add Apache Commons dependencies After initialization web application, directory structure of the application will look below image: Necessary Dependencies As stated above, we need...Continue Reading
For most developers, writing almost the same code for every DAO in an application has become indespensible. To solve this problem and to rescue developers from copying and pasting same codes into every dao classes, we will use DAO pattern. In this tutorial, I will show you how to create dao pattern in a spring application. The foundation of using a Generic DAO is the CRUD operations that you can perform on each entity. Generic Dao Implementation Model Class Hibernate ORM framework uses model classes for database tables. Therefore we need to creat...Continue Reading
In some cases we need to use Converter: Case 1: To help simplifying bean configurations, Spring supports conversion of property values to and from text values. Case 2: In a form, sometimes it is necessary to convert a text value to specific object, For example in a combo box there are multiple String values stored. Each value can be converted to related objects. There are three steps to create Converter: 1. Create Converter class 2. Create conversion service bean in the spring config file then register the converter class 3. Refer to this bean f...Continue Reading
In Spring MVC, sometimes we want to show user-friendly exception messages to the user after an error occured. To do this, handle exceptions in the same controller as shown below: @RequestMapping(value = "home/addAdmin", method = RequestMethod.GET) public String viewLogin(Model model) { model.addAttribute("admin", new Admin()); model.addAttribute("roles", adminRoleService.getAll()); return "/admin/home/addAdmin"; } @RequestMapping(value = "home/addAdmin/submit", method = RequestMethod.POST) public String addAdmin(@RequestParam(value = "pass...Continue Reading
To solve Spring resource bundle UTF-8 problem, you should add spesific message bundle bean as follows: <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="classpath:messages" /> <property name="fallbackToSystemLocale" value="true" /> <property name="fileEncodings" value="UTF-8" /> <property name="defaultEncoding" value="UTF-8" /> <property name="cacheSeconds" value="3600"/> </bean> Also, you should save .properties f...Continue Reading
Supported method return types The following are the supported return types: A ModelAndView object, with the model implicitly enriched with command objects and the results of @ModelAttribute annotated reference data accessor methods. A Model object, with the view name implicitly determined through a RequestToViewNameTranslator and the model implicitly enriched with command objects and the results of @ModelAttribute annotated reference data......Continue Reading
The following are the supported method arguments: Request or response objects (Servlet API) Choose any specific request or response type, for example ServletRequest or HttpServletRequest. Session object (Servlet API) of type HttpSession. An argument of this type enforces the presence of a corresponding session. As a consequence, such an argument is never null. Note Session access may not be thread-safe, in particular in a Servlet envi......Continue Reading
In Spring Web Applications, there are two types of container, each of which is configured and initialized differently. One is the "Application Context" and the other is the "Web Application Context". Lets first talk about the "Application Context". Application Context is the container initialized by a ContextLoaderListener or ContextLoaderServlet defined in the web.xml and the configuration would look something like this......Continue Reading

© 2019 All rights reserved. Codesenior.COM