마이바티스에서 수행되어 만들어진 쿼리를 추출하고 싶을 때 사용합니다. @Autowired SqlSession sqlSession 을 사용합니다. 1. Mapper.xml 에 쿼리가 아래와 같다고 가정하고 <select id="selectTest"> select * from test where idx1 = #{param.idx1} and idx2 = #{param.idx2} and userid = #{param.session.userid} and testList in ( <foreach collection="param.testList" item="testList" separator=","> #{testList} </foreach> )</select> 2. 파라미터를 HashMap 형식일 경우(기본적으로 모두 … 계속 읽기 Mybatis 쿼리를 바인딩된 String으로 가져오는 방법
[일:] 2019 11월 1
PDF 파일 처리 – JPG>PDF, PDF+PDF, 비밀번호 주입
import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Image; import com.itextpdf.text.PageSize; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfImportedPage; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfStamper; import com.itextpdf.text.pdf.PdfWriter; public class PdfUtils { private static final Logger logger = LoggerFactory.getLogger(PdfUtils.class); /** * PDF파일에 비밀번호를 주입한다. * @Param input … 계속 읽기 PDF 파일 처리 – JPG>PDF, PDF+PDF, 비밀번호 주입
JAVA URL인코딩, 디코딩 – URLEncoder, URLDecoder
URLEncoder.encode(String encodingString, String charsetName); //인코딩할 문자, 케릭터셋("UTF-8") URLDecoder.decode(String decodingString, String charsetName); //인코딩할 문자, 케릭터셋("UTF-8") 예제 import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; try{ String txt = "아부탱"; String txtEnc = URLEncoder.encode(txt, "UTF-8"); System.out.println(URLEncoder.encode(txt, "UTF-8")); //%EC%95%84%EB%B6%80%ED%83%B1 System.out.println(URLDecoder.decode(txtEnc, "UTF-8")); //아부탱 }catch(UnsupportedEncodingException e){ e.printStackTrace(); }