Author: Mingch

Mingch is a software engineer who helps startups on software development. My expertise offer in mobile development, web development projects, as well as private consultations.

Spring i18N

Register Local Resolver Spring will look for user register localResolver, if not found, spring will use configure AcceptHeaderLocaleResolver as default. AcceptHeaderLocaleResolver HTTP Request header contains information with key accept-language. This information will send by user browser.   SessionLocaleResolver SessionLocaleResolver associate

Spring Upload File

Commons FileUpload multipart request process XML-based Java-based XML-based web.xml <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/mvc-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> mvc-config.xml <bean id=”multipartResolver” class=”org.springframework.web.multipart.commons.CommonsMultipartResolver”> <property name=”uploadTempDir” value=”/tmp”></property> <property name=”maxUploadSize” value=”1048576″></property> <property name=”maxInMemorySize” value=”524288″></property> </bean>   Java-based WebInitializer public class

Spring Tag, JSP Form Reference

Define Namespace and Taglib <!DOCTYPE html> <%@ page language=”java” contentType=”text/html; charset=UTF-8″ pageEncoding=”UTF-8″%> <%@ taglib uri=”http://www.springframework.org/tags” prefix=”spring” %> <%@ taglib uri=”http://www.springframework.org/tags/form” prefix=”form” %> <%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c” %>   Define Form and Object binding <form:form modelAttribute=”user” action=”/your-url-action” method=”post”> <!– continue read