java, c# , linux, program devloper: spring framework 카테고리 글 목록http://blog1.phps.kr/blog.visualp.com2021-05-29T01:04:43+09:00Textcube 1.10.7 : Tempo primospring multiple commandNamejava, tomcat, c#http://blog1.phps.kr/7032015-12-14T11:24:18+09:002015-12-14T11:24:16+09:00<pre class="lang-java prettyprint prettyprinted"><span style="font-size: medium;"><code><span class="kwd">[출처] :http://stackoverflow.com/questions/16712462/many-commandname-for-one-form-in-spring-mvc<br />public</span><span class="kwd">class</span><span class="typ">CombinedCommand</span><span class="pun">()</span><span class="pun">{</span><span class="typ">Activity</span><span class="pln"> activity</span><span class="pun">;</span><span class="typ">Etabl</span><span class="pln"> etabl</span><span class="pun">;</span><span class="com">//Getter and setter</span><span class="pun">}</span></code></span></pre>
<p><span style="font-size: medium;">jsp:</span></p>
<pre class="lang-java prettyprint prettyprinted"><span style="font-size: medium;"><code><span class="pun"><</span><span class="pln">form</span><span class="pun">:</span><span class="pln">form
action</span><span class="pun">=</span><span class="str">"${pageContext.request.contextPath}/ajouter_activite"</span><span class="pln">
method</span><span class="pun">=</span><span class="str">"post"</span><span class="pln"> commandName</span><span class="pun">=</span><span class="str">"combinedCommand""></span><span class="pun">...</span><span class="pun"><</span><span class="pln">form</span><span class="pun">:</span><span class="pln">input type</span><span class="pun">=</span><span class="str">"text"</span><span class="pln">path</span><span class="pun">=</span><span class="str">"activity.x"</span><span class="pun">/></span><span class="pun">...</span><span class="pun"><</span><span class="pln">form</span><span class="pun">:</span><span class="pln">input type</span><span class="pun">=</span><span class="str">"text"</span><span class="pln">path</span><span class="pun">=</span><span class="str">"etabl.y"</span><span class="pun">/></span><span class="pun">...</span><span class="pun"></</span><span class="pln">form</span><span class="pun">:</span><span class="pln">form</span><span class="pun">></span></code></span></pre><p><strong><a href="http://blog1.phps.kr/703?commentInput=true#entry703WriteComment">댓글 쓰기</a></strong></p>Spring MVC: Multiple Row Form Submit using List of Beansjava, tomcat, c#http://blog1.phps.kr/6902015-06-22T10:59:16+09:002015-06-22T10:59:13+09:00[원문]<br /><a href="http://viralpatel.net/blogs/spring-mvc-multi-row-submit-java-list/">http://viralpatel.net/blogs/spring-mvc-multi-row-submit-java-list/</a><br /><br />[정리]<br /><br />ArrayList 형태의 DTO 또는 VO 객체를 생성후<br /><br />그 beens 객체를 jstl foreach로 반복 해주면 됨 .<br /><br /><br /><p><strong><a href="http://blog1.phps.kr/690?commentInput=true#entry690WriteComment">댓글 쓰기</a></strong></p>spring 외부 이미지 경로 숨기기 , 접근 금지java, tomcat, c#http://blog1.phps.kr/6892015-06-18T17:05:26+09:002015-06-18T17:05:23+09:00<p><원문>http://nimba.tistory.com/m/post/457</p>
<p> @RequestMapping(value = "/servicelogo/{path1}/{file_name:.+}", method = RequestMethod.GET, produces = "application/octet-stream")<br /> @ResponseBody<br /> public FileSystemResource getPublicFile2(<br /> @PathVariable("file_name") String fileName,<br /> @PathVariable("path1") String path1,<br /> HttpServletResponse response) throws Exception {<br /> Map<String, Object> condition = new HashMap<String, Object>();<br /> if(path1.equals("front")) {<br /> condition.put("front_logo_img", fileName);<br /> } else if(path1.equals("print")) {<br /> condition.put("print_logo_img", fileName); <br /> } else {<br /> condition.put("front_logo_img", fileName);<br /> }<br /> <br /> String serverFileName = Admin2Service.getServiceLogoFileName(condition);<br /> logger.debug("serverFileName= "+serverFileName);<br /> <br /> if(serverFileName == null || serverFileName.length()==0 || serverFileName.equals("")) serverFileName = "temp.jpg";<br /> <br /> String uploadDir = "/upload/serviceLogo";<br /> File f = new File(messageBundle.getMessage("file.uploadPath") + uploadDir + "/" + serverFileName);<br /> <br /> response.setContentType("application/octet-stream");<br /> return new FileSystemResource(f);<br /> }</p><p><strong><a href="http://blog1.phps.kr/689?commentInput=true#entry689WriteComment">댓글 쓰기</a></strong></p>mybatis , 멀티 파라메터 전달 ,anotation parameter injectionjava, tomcat, c#http://blog1.phps.kr/4622012-02-23T17:23:54+09:002012-02-23T17:23:51+09:00Currently multiple parameters must be declared in the mapper interface using @Param annotation:<BR><BR>public interface SomeMapper {<BR> public SomeClass getWith2Params(@Param("p1") int p1, @Param("p2") String p2);<BR>} <BR><BR>And then in mapper file:<BR><BR><select id="getWith2Params" resultType="SomeClass"><BR> SELECT *<BR> FROM SomeTable<BR> WHERE p1 = #{p1} AND p2= #{p2}<BR></select><BR><BR>Unlike single parameter, multiple parameters are not declared in the same place where they are used and this makes the coding less productive,<BR>maintainable and readable. <BR><BR>An alternative to annotation for having full declaration and usage in the mapper file would be something like:<BR><BR><select id="getWith2Params" parameters="int p1; string p2" resultType="SomeClass"><BR> SELECT *<BR> FROM SomeTable<BR> WHERE p1 = #{p1} AND p2= #{p2}<BR></select><BR><BR>or <BR><BR><select id="getWith2Params" parameters="int; string" resultType="MyClass"><BR> SELECT *<BR> FROM SomeTable<BR> WHERE p1 = #{1} AND p2= #{2}<BR></select><BR><BR>This way all information regarding the query is kept in one simple<BR>place, the mapper file, and no annotation would be required.<BR><BR>------------<BR><BR>@Param usage may also be simplified overriding it with a no-argument version:<BR><BR>public interface SomeMapper {<BR> public SomeClass getWith2Params(@Param int p1, @Param String p2);<BR>} <BR><BR>And using parameter position in the query:<BR><BR><select id="getWith2Params" resultType="SomeClass"><BR> SELECT *<BR> FROM SomeTable<BR> WHERE p1 = #{1} AND p2= #{2}<BR></select><BR><BR>Or even (if possible) extracting the name of the parameters from @Param annotation:<BR><BR><select id="getWith2Params" resultType="SomeClass"><BR> SELECT *<BR> FROM SomeTable<BR> WHERE p1 = #{p1} AND p2= #{p2}<BR></select><BR><BR>instead of repeat declaring the name of the parameter.<BR><BR><BR><BR><BR><p><strong><a href="http://blog1.phps.kr/462?commentInput=true#entry462WriteComment">댓글 쓰기</a></strong></p>mybatis , select query , return arraylistjava, tomcat, c#http://blog1.phps.kr/4612012-02-23T16:33:12+09:002012-02-23T16:33:09+09:00<DIV style="TEXT-ALIGN: left" dir=ltr trbidi="on">In mybatis passing array list is as simple as passing a map into <BR><BR>please follow the below codes<BR><BR><INS><EM><STRONG>Any Dao method like</STRONG> </EM></INS><BR><BR> List<domain.blog.Post> selectPostIn ( List<String> params );<BR><BR><STRONG><INS><EM>And the Dao.xml</EM></INS></STRONG><BR>
<BLOCKQUOTE><select id="selectPostIn" resultType="domain.blog.Post" parameterType="java.util.List"><BR> SELECT * FROM POST P WHERE ID in <BR> <foreach item="item" index="index" collection="<B style="COLOR: blue">list</B>" open="(" separator="," close=")"><BR> #{item}<BR> </foreach><BR></select></BLOCKQUOTE>Just make sure collection name should be "<STRONG><SPAN style="COLOR: blue">list</SPAN></STRONG>" only<BR>You can pass a List instance or an Array to MyBatis as a parameter object. When you do, MyBatis will automatically wrap it in a Map, and key it by name. List instances will be keyed to the name “list” and array instances will be keyed to the name “array” <BR><BR>I have tried with list its working</DIV><p><strong><a href="http://blog1.phps.kr/461?commentInput=true#entry461WriteComment">댓글 쓰기</a></strong></p>spring 3.0 utf-8 filterjava, tomcat, c#http://blog1.phps.kr/4572012-02-17T10:48:36+09:002012-02-17T10:48:33+09:00<P>web.xml에 추가해주세요<BR><BR><filter><BR> <filter-name>encodingFilter</filter-name><BR> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><BR> <init-param><BR> <param-name>encoding</param-name><BR> <param-value>UTF-8</param-value> <BR> </init-param><BR> <init-param><BR> <param-name>forceEncoding</param-name><BR> <param-value>true</param-value><BR> </init-param><BR> </filter><BR> <filter-mapping><BR> <filter-name>encodingFilter</filter-name><BR> <url-pattern>/*</url-pattern><BR> </filter-mapping></P><p><strong><a href="http://blog1.phps.kr/457?commentInput=true#entry457WriteComment">댓글 쓰기</a></strong></p>