Struts2

Struts 2 File Upload Example

<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<p>In this example you will learn how to do file upload with the help of the built-in <i><b>FileUploadInterceptor<&sol;b><&sol;i>&period; To do this first we need to get the file form the user&period; We use the Struts 2 tags to build our form&period; The encoding type of the form should be set to<i><b> multipart&sol;form-data<&sol;b><&sol;i> and the HTTP method should be set to post&period; The <i><b>index&period;jsp<&sol;b><&sol;i> page contains the following code&period;<&sol;p>&NewLine;<p>Create two JSP file in <b>WebRoot <&sol;b>folder&period;<b> index&period;jsp <&sol;b>will display a form to user to upload image&period; On submit&comma; the file will be uploaded and saved on server&period; User will be sent to<b> success&period;jsp <&sol;b>file where File details will be displayed&period; Copy following code into it&period;<&sol;p>&NewLine;<&sol;div>&NewLine;<h2><b>index&period;jsp<&sol;b><&sol;h2>&NewLine;<pre class&equals;"highlight">&lt&semi;&percnt;&commat; page contentType&equals;"text&sol;html&semi; charset&equals;UTF-8"&percnt;&gt&semi; &NewLine;&lt&semi;&percnt;&commat; taglib prefix&equals;"s" uri&equals;"&sol;struts-tags"&percnt;&gt&semi; &NewLine;&lt&semi;html&gt&semi; &NewLine;&lt&semi;head&gt&semi; &NewLine;&lt&semi;title&gt&semi;Upload User Image&lt&semi;&sol;title&gt&semi; &NewLine;&lt&semi;&sol;head&gt&semi; &NewLine; &NewLine;&lt&semi;body&gt&semi; &NewLine;&lt&semi;h2&gt&semi;Struts2 File Upload &amp&semi; Save Example&lt&semi;&sol;h2&gt&semi; &NewLine;&lt&semi;s&colon;actionerror &sol;&gt&semi; &NewLine;&lt&semi;s&colon;form action&equals;"userImage" method&equals;"post" enctype&equals;"multipart&sol;form-data"&gt&semi; &NewLine; &lt&semi;s&colon;file name&equals;"userImage" label&equals;"User Image" size&equals;"10"&sol;&gt&semi; &NewLine; &lt&semi;s&colon;submit value&equals;"Upload" align&equals;"center" &sol;&gt&semi; &NewLine;&lt&semi;&sol;s&colon;form&gt&semi; &NewLine;&lt&semi;&sol;body&gt&semi; &NewLine;&lt&semi;&sol;html&gt&semi; &NewLine;<&sol;pre>&NewLine;<&sol;div>&NewLine;<div id&equals;"ads-id" align&equals;"center"><&sol;div>&NewLine;<p>There are couple of points worth noting in the above example&period; First of all&comma; the form&&num;8217&semi;s enctype is set to <b>multipart&sol;form-data<&sol;b>&period; This should be set so that file uploads are handled successfully by the file upload interceptor&period; The next point noting is the form&&num;8217&semi;s action method upload and the name of the file upload field &&num;8211&semi; which is <b>userImage<&sol;b>&period; We need this information to create the action method and the struts configuration&period;<&sol;p>&NewLine;<p>Next let us create a simple jsp file <b>success&period;jsp<&sol;b> to display the outcome of our file upload in case it becomes success&period;<b> <&sol;b><&sol;p>&NewLine;<h2><b>success&period;jsp<&sol;b><&sol;h2>&NewLine;<pre class&equals;"highlight">&lt&semi;&percnt;&commat; page contentType&equals;"text&sol;html&semi; charset&equals;UTF-8"&percnt;&gt&semi; &NewLine;&lt&semi;&percnt;&commat; taglib prefix&equals;"s" uri&equals;"&sol;struts-tags"&percnt;&gt&semi; &NewLine;&lt&semi;html&gt&semi; &NewLine;&lt&semi;head&gt&semi; &NewLine;&lt&semi;title&gt&semi;Success&colon; Upload User Image&lt&semi;&sol;title&gt&semi; &NewLine;&lt&semi;&sol;head&gt&semi; &NewLine;&lt&semi;body&gt&semi; &NewLine; &lt&semi;h2&gt&semi;Struts2 File Upload Example&lt&semi;&sol;h2&gt&semi; &NewLine; User Image&colon; &lt&semi;s&colon;property value&equals;"userImage"&sol;&gt&semi; &NewLine; &lt&semi;br&sol;&gt&semi; &NewLine; Content Type&colon; &lt&semi;s&colon;property value&equals;"userImageContentType"&sol;&gt&semi; &NewLine; &lt&semi;br&sol;&gt&semi; &NewLine; File Name&colon; &lt&semi;s&colon;property value&equals;"userImageFileName"&sol;&gt&semi; &NewLine; &lt&semi;br&sol;&gt&semi; &NewLine; Uploaded Image&colon; &NewLine; &lt&semi;br&sol;&gt&semi; &NewLine; &lt&semi;img src&equals;"&lt&semi;s&colon;property value&equals;"userImageFileName"&sol;&gt&semi;"&sol;&gt&semi; &NewLine;&lt&semi;&sol;body&gt&semi; &NewLine;&lt&semi;&sol;html&gt&semi; &NewLine;<&sol;pre>&NewLine;<&sol;div>&NewLine;<p>Following will be the result file <b>error&period;jsp<&sol;b> in case there is some error in uploading the file&colon;<&sol;p>&NewLine;<h2><b>error&period;jsp<&sol;b><&sol;h2>&NewLine;<pre class&equals;"highlight">&lt&semi;&percnt;&commat; page contentType&equals;"text&sol;html&semi; charset&equals;UTF-8" &percnt;&gt&semi; &NewLine;&lt&semi;&percnt;&commat; taglib prefix&equals;"s" uri&equals;"&sol;struts-tags" &percnt;&gt&semi; &NewLine;&lt&semi;html&gt&semi; &NewLine;&lt&semi;head&gt&semi; &NewLine;&lt&semi;title&gt&semi;File Upload Error&lt&semi;&sol;title&gt&semi; &NewLine;&lt&semi;&sol;head&gt&semi; &NewLine;&lt&semi;body&gt&semi; &NewLine;There has been an error in uploading the file&period; &NewLine;&lt&semi;&sol;body&gt&semi; &NewLine;&lt&semi;&sol;html&gt&semi; &NewLine;<&sol;pre>&NewLine;<&sol;div>&NewLine;<h2><b>Create action class&colon;<&sol;b><&sol;h2>&NewLine;<p>Next let us create a Java class called <b>FileUploadAction&period;java<&sol;b> which will take care of uploading file and storing that file at a secure location&colon;<&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;dineshonjava&period;struts2&period;action&period;upload&semi; &NewLine; &NewLine;import java&period;io&period;File&semi; &NewLine; &NewLine;import javax&period;servlet&period;http&period;HttpServletRequest&semi; &NewLine; &NewLine;import org&period;apache&period;commons&period;io&period;FileUtils&semi; &NewLine;import org&period;apache&period;struts2&period;interceptor&period;ServletRequestAware&semi; &NewLine; &NewLine;import com&period;opensymphony&period;xwork2&period;ActionSupport&semi; &NewLine; &NewLine;&sol;&ast;&ast; &NewLine; &ast; &commat;author Dinesh Rajput &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;public class FileUploadAction extends ActionSupport implements ServletRequestAware &lbrace; &NewLine; private static final long serialVersionUID &equals; 1L&semi; &NewLine; private File userImage&semi; &NewLine; private String userImageContentType&semi; &NewLine; private String userImageFileName&semi; &NewLine; &NewLine; private HttpServletRequest servletRequest&semi; &NewLine; &NewLine; public String execute&lpar;&rpar; &lbrace; &NewLine; try &lbrace; &NewLine; String filePath &equals; servletRequest&period;getSession&lpar;&rpar;&period;getServletContext&lpar;&rpar;&period;getRealPath&lpar;"&sol;"&rpar;&semi; &NewLine; System&period;out&period;println&lpar;"Server path&colon;" &plus; filePath&rpar;&semi; &NewLine; File fileToCreate &equals; new File&lpar;filePath&comma; this&period;userImageFileName&rpar;&semi; &NewLine; &NewLine; FileUtils&period;copyFile&lpar;this&period;userImage&comma; fileToCreate&rpar;&semi; &NewLine; &rcub; catch &lpar;Exception e&rpar; &lbrace; &NewLine; e&period;printStackTrace&lpar;&rpar;&semi; &NewLine; addActionError&lpar;e&period;getMessage&lpar;&rpar;&rpar;&semi; &NewLine; &NewLine; return INPUT&semi; &NewLine; &rcub; &NewLine; return SUCCESS&semi; &NewLine; &rcub; &NewLine; &NewLine; public File getUserImage&lpar;&rpar; &lbrace; &NewLine; return userImage&semi; &NewLine; &rcub; &NewLine; &NewLine; public void setUserImage&lpar;File userImage&rpar; &lbrace; &NewLine; this&period;userImage &equals; userImage&semi; &NewLine; &rcub; &NewLine; &NewLine; public String getUserImageContentType&lpar;&rpar; &lbrace; &NewLine; return userImageContentType&semi; &NewLine; &rcub; &NewLine; &NewLine; public void setUserImageContentType&lpar;String userImageContentType&rpar; &lbrace; &NewLine; this&period;userImageContentType &equals; userImageContentType&semi; &NewLine; &rcub; &NewLine; &NewLine; public String getUserImageFileName&lpar;&rpar; &lbrace; &NewLine; return userImageFileName&semi; &NewLine; &rcub; &NewLine; &NewLine; public void setUserImageFileName&lpar;String userImageFileName&rpar; &lbrace; &NewLine; this&period;userImageFileName &equals; userImageFileName&semi; &NewLine; &rcub; &NewLine; &NewLine; &commat;Override &NewLine; public void setServletRequest&lpar;HttpServletRequest servletRequest&rpar; &lbrace; &NewLine; this&period;servletRequest &equals; servletRequest&semi; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p>In above class file we have declared few attributes&colon;<&sol;p>&NewLine;<ul style&equals;"text-align&colon; left&semi;">&NewLine;<li><b>private File userImage&semi;<&sol;b> -&gt&semi; This will store actual uploaded File<&sol;li>&NewLine;<li><b>private String userImageContentType&semi; -&gt&semi; <&sol;b>This string will contain the Content Type of uploaded file&period;<&sol;li>&NewLine;<li><b>private String userImageFileName&semi; -&gt&semi; <&sol;b>This string will contain the file name of uploaded file&period;<&sol;li>&NewLine;<&sol;ul>&NewLine;<p>The fields <b>userImageContentType <&sol;b>and <b>userImageFileName <&sol;b>are optional&period; If setter method of these fields are provided&comma; struts2 will set the data&period; This is just to get some extra information of uploaded file&period; Also follow the naming standard if you providing the content type and file name string&period; The name should be <b>ContentType<&sol;b> and <b>FileName<&sol;b>&period; For example if the file attribute in action file is private File <b>uploadedFile<&sol;b>&comma; the content type will be <b>uploadedFileContentType <&sol;b>and file name <b>uploadedFileFileName<&sol;b>&period;<br &sol;>&NewLine;Also note in above action class&comma; we have implemented interface <i><b>org&period;apache&period;struts2&period;interceptor&period;ServletRequestAware<&sol;b><&sol;i>&period; This is to get <b>servletRequest <&sol;b>object&period; We are using this path to save the uploaded file in <i><b>execute&lpar;&rpar;<&sol;b><&sol;i> method&period; We have used <i><b>FileUtil&period;copyFile&lpar;&rpar;<&sol;b><&sol;i> method of <b>commons-io<&sol;b> package to copy the uploaded file in root folder&period; This file will be retrieved in JSP page and displayed to user&period;<&sol;p>&NewLine;<h2><b>Configuration files&colon;<&sol;b><&sol;h2>&NewLine;<p>Following are the Struts2 configuration properties that control file uploading process&colon;<&sol;p>&NewLine;<&sol;div>&NewLine;<p><b>struts&period;xml<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">&lt&semi;&quest;xml version&equals;"1&period;0" encoding&equals;"UTF-8" &quest;&gt&semi; &NewLine;&lt&semi;&excl;DOCTYPE struts PUBLIC &NewLine; "-&sol;&sol;Apache Software Foundation&sol;&sol;DTD Struts Configuration 2&period;0&sol;&sol;EN" &NewLine; "http&colon;&sol;&sol;struts&period;apache&period;org&sol;dtds&sol;struts-2&period;0&period;dtd"&gt&semi; &NewLine; &NewLine;&lt&semi;struts&gt&semi; &NewLine; &lt&semi;constant name&equals;"struts&period;devMode" value&equals;"true" &sol;&gt&semi; &NewLine; &lt&semi;package name&equals;"upload" extends&equals;"struts-default"&gt&semi; &NewLine; &lt&semi;action name&equals;"userImage" class&equals;"com&period;dineshonjava&period;struts2&period;action&period;upload&period;FileUploadAction"&gt&semi; &NewLine; &lt&semi;interceptor-ref name&equals;"fileUpload"&gt&semi; &NewLine; &lt&semi;param name&equals;"maximumSize"&gt&semi;2097152&lt&semi;&sol;param&gt&semi; &NewLine; &lt&semi;param name&equals;"allowedTypes"&gt&semi; &NewLine; image&sol;png&comma;image&sol;gif&comma;image&sol;jpeg&comma;image&sol;pjpeg &NewLine; &lt&semi;&sol;param&gt&semi; &NewLine; &lt&semi;&sol;interceptor-ref&gt&semi; &NewLine; &lt&semi;interceptor-ref name&equals;"defaultStack"&gt&semi;&lt&semi;&sol;interceptor-ref&gt&semi; &NewLine; &lt&semi;result name&equals;"success"&gt&semi;success&period;jsp&lt&semi;&sol;result&gt&semi; &NewLine; &lt&semi;result name&equals;"input"&gt&semi;index&period;jsp&lt&semi;&sol;result&gt&semi; &NewLine; &lt&semi;result name&equals;"error"&gt&semi;error&period;jsp&lt&semi;&sol;result&gt&semi; &NewLine; &lt&semi;&sol;action&gt&semi; &NewLine; &lt&semi;&sol;package&gt&semi; &NewLine; &lt&semi;&sol;struts&gt&semi; &NewLine;<&sol;pre>&NewLine;<p>Note that in above entry we have specified two parameter to <b>fileUpload <&sol;b>interceptor&comma; <b>maximumSize <&sol;b>and <b>allowedTypes<&sol;b>&period; These are optional parameters that we can specify to interceptor&period; The <b>maximumSize <&sol;b>param will set the maximum file size that can be uploaded&period; By default this is 2MB&period; And the <b>allowedTypes <&sol;b>param specify the allowed content types of file which can be uploaded&period; Here we have specified it to be an image file <b>&lpar;image&sol;png&comma;image&sol;gif&comma;image&sol;jpeg&comma;image&sol;pjpeg&rpar;&period;<&sol;b><&sol;p>&NewLine;<p>The file upload interceptor also does the validation and adds errors&comma; these error messages are stored in the <i><b>struts-messsages&period;properties<&sol;b><&sol;i> file&period; The values of the messages can be overridden by providing the text for the following keys&colon;<&sol;p>&NewLine;<ol style&equals;"text-align&colon; left&semi;">&NewLine;<li><b>struts&period;messages&period;error&period;uploading<&sol;b> – error when uploading of file fails<&sol;li>&NewLine;<li><b>struts&period;messages&period;error&period;file&period;too&period;large<&sol;b> – error occurs when file size is large<&sol;li>&NewLine;<li><b>struts&period;messages&period;error&period;content&period;type&period;not&period;allowed<&sol;b> – when the content type is not allowed<&sol;li>&NewLine;<&sol;ol>&NewLine;<&sol;div>&NewLine;<h2><b>Following is the content of <i>web&period;xml<&sol;i> file&colon;<&sol;b><&sol;h2>&NewLine;<pre class&equals;"highlight">&lt&semi;&quest;xml version&equals;"1&period;0" encoding&equals;"UTF-8"&quest;&gt&semi; &NewLine;&lt&semi;web-app xmlns&colon;xsi&equals;"http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;XMLSchema-instance" xmlns&equals;"http&colon;&sol;&sol;java&period;sun&period;com&sol;xml&sol;ns&sol;javaee" xmlns&colon;web&equals;"http&colon;&sol;&sol;java&period;sun&period;com&sol;xml&sol;ns&sol;javaee&sol;web-app&lowbar;2&lowbar;5&period;xsd" xsi&colon;schemaLocation&equals;"http&colon;&sol;&sol;java&period;sun&period;com&sol;xml&sol;ns&sol;javaee http&colon;&sol;&sol;java&period;sun&period;com&sol;xml&sol;ns&sol;javaee&sol;web-app&lowbar;3&lowbar;0&period;xsd" id&equals;"WebApp&lowbar;ID" version&equals;"3&period;0"&gt&semi; &NewLine; &lt&semi;display-name&gt&semi;Struts2FileUpload&lt&semi;&sol;display-name&gt&semi; &NewLine; &lt&semi;filter&gt&semi; &NewLine; &lt&semi;filter-name&gt&semi;struts2&lt&semi;&sol;filter-name&gt&semi; &NewLine; &lt&semi;filter-class&gt&semi; &NewLine; org&period;apache&period;struts2&period;dispatcher&period;FilterDispatcher &NewLine; &lt&semi;&sol;filter-class&gt&semi; &NewLine; &lt&semi;&sol;filter&gt&semi; &NewLine; &lt&semi;filter-mapping&gt&semi; &NewLine; &lt&semi;filter-name&gt&semi;struts2&lt&semi;&sol;filter-name&gt&semi; &NewLine; &lt&semi;url-pattern&gt&semi;&sol;&ast;&lt&semi;&sol;url-pattern&gt&semi; &NewLine; &lt&semi;&sol;filter-mapping&gt&semi; &NewLine; &lt&semi;welcome-file-list&gt&semi; &NewLine; &lt&semi;welcome-file&gt&semi;index&period;jsp&lt&semi;&sol;welcome-file&gt&semi; &NewLine; &lt&semi;&sol;welcome-file-list&gt&semi; &NewLine;&lt&semi;&sol;web-app&gt&semi; &NewLine;<&sol;pre>&NewLine;<p>Now Right click on the project name and click<b> Export &gt&semi; WAR <&sol;b>File to create a War file&period; Then deploy this WAR in the Tomcat&&num;8217&semi;s webapps directory&period; Finally&comma; start Tomcat server and try to access<br &sol;>&NewLine;<b>URL <i>http&colon;&sol;&sol;localhost&colon;8080&sol;doj&sol;index&period;jsp<&sol;i>&period; <&sol;b><br &sol;>&NewLine;This will give you following screen&colon;<&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2013&sol;07&sol;11111&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<h2><b>Image Upload Screen in case of error-<&sol;b><&sol;h2>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2013&sol;07&sol;2222222&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<&sol;div>&NewLine;<h2><b>Image Upload Screen on success-<&sol;b><&sol;h2>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2013&sol;07&sol;33333&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<&sol;div>&NewLine;<h2><b>Another Image Upload Screen on success-<&sol;b><&sol;h2>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2013&sol;07&sol;44444&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<h2><b>Download Source Code&plus;Libs<&sol;b><br &sol;>&NewLine;<b><a href&equals;"https&colon;&sol;&sol;sites&period;google&period;com&sol;a&sol;dineshonjava&period;com&sol;dineshonjava&sol;dineshonjava&sol;Struts2FileUpload&period;zip&quest;attredirects&equals;0&amp&semi;d&equals;1" target&equals;"&lowbar;blank" rel&equals;"noopener">Struts2FileUpload&period;zip<&sol;a><&sol;b><&sol;h2>&NewLine;<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"background-color&colon; pink&semi; border-width&colon; thin&semi; text-align&colon; center&semi;"><b>&lt&semi;&lt&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;struts-2-result-types&sol;">Previous<&sol;a> &lt&semi;&lt&semi;   &vert;&vert; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;struts-2-baby-step-to-learn&sol;">Index <&sol;a>&vert;&vert;   &gt&semi;&gt&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;struts-2-database-access&sol;">Next<&sol;a> &gt&semi;&gt&semi;<&sol;b><&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<&sol;div>&NewLine;<div class&equals;"wp-post-navigation"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-pre"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;struts-2-result-types&sol;">Previous<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-next"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;struts-2-database-access&sol;">Next<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;<&sol;div>&NewLine;<script type&equals;"text&sol;javascript">&NewLine;jQuery&lpar;document&rpar;&period;ready&lpar;function&lpar;&dollar;&rpar; &lbrace;&NewLine; &dollar;&period;post&lpar;'https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-admin&sol;admin-ajax&period;php'&comma; &lbrace;action&colon; 'mts&lowbar;view&lowbar;count'&comma; id&colon; '385'&rcub;&rpar;&semi;&NewLine;&rcub;&rpar;&semi;&NewLine;<&sol;script>

Dinesh Rajput

Dinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. It has a series of articles related to Java technologies. Dinesh has been a Spring enthusiast since 2008 and is a Pivotal Certified Spring Professional, an author of a book Spring 5 Design Pattern, and a blogger. He has more than 10 years of experience with different aspects of Spring and Java design and development. His core expertise lies in the latest version of Spring Framework, Spring Boot, Spring Security, creating REST APIs, Microservice Architecture, Reactive Pattern, Spring AOP, Design Patterns, Struts, Hibernate, Web Services, Spring Batch, Cassandra, MongoDB, and Web Application Design and Architecture. He is currently working as a technology manager at a leading product and web development company. He worked as a developer and tech lead at the Bennett, Coleman & Co. Ltd and was the first developer in his previous company, Paytm. Dinesh is passionate about the latest Java technologies and loves to write technical blogs related to it. He is a very active member of the Java and Spring community on different forums. When it comes to the Spring Framework and Java, Dinesh tops the list!

Share
Published by
Dinesh Rajput

Recent Posts

Strategy Design Patterns using Lambda

Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…

4 years ago

Decorator Pattern using Lambda

Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…

4 years ago

Delegating pattern using lambda

Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…

4 years ago

Spring Vs Django- Know The Difference Between The Two

Technology has emerged a lot in the last decade, and now we have artificial intelligence;…

4 years ago

TOP 20 MongoDB INTERVIEW QUESTIONS 2022

Managing a database is becoming increasingly complex now due to the vast amount of data…

4 years ago

Scheduler @Scheduled Annotation Spring Boot

Overview In this article, we will explore Spring Scheduler how we could use it by…

4 years ago