자바스크립트2013. 7. 1. 14:21

1. 메뉴에서 [파일] - [다른이름으로 저장]

2. 저장시 mht 가 html로 저장한다

3. 저장한 파일을 열어서  아래와 같은 부분을 삭제한다

 <SCRIPT type="text/javascript">
 document.oncontextmenu = new Function ('return false');
 document.ondragstart = new Function ('return false');
 document.onselectstart = new Function ('return false');
  document.body.style.MozUserSelect = 'none';
</SCRIPT>

4. html파일  브라우저로 확인 ( 드래그함 )

'자바스크립트' 카테고리의 다른 글

trim 구현  (0) 2013.09.25
구글 맵 API  (0) 2013.07.17
[JS API] prototype.js ajax method  (0) 2013.06.20
[JS api] AjaxUpload 사용하기  (0) 2013.06.13
자바스크립트에서 미디어쿼리 처럼 CSS 사용하기  (0) 2013.04.02
Posted by 선한열심
JAVA2013. 6. 28. 11:25

출처-Http 송수신 HttpClient 

 

POST 방식 예제

01 import org.apache.commons.httpclient.HttpClient;
02 import org.apache.commons.httpclient.HttpStatus;
03 import org.apache.commons.httpclient.methods.PostMethod;
04
05 import java.io.BufferedReader;
06 import java.io.InputStreamReader;
07
08 public class PostMethodExample {
09 public static void main(String args[]) {
10 HttpClient client = new HttpClient();
11 client.getParams().setParameter("http.useragent", "Test Client");
12 BufferedReader br = null;
13 PostMethod method = new PostMethod("http://search.yahoo.com/search");
14 method.addParameter("p", "\"java2s\"");
15 try{
16 int returnCode = client.executeMethod(method);
17
18 if(returnCode == HttpStatus.SC_NOT_IMPLEMENTED) {
19 System.err.println("The Post method is not implemented by this URI");
20 // still consume the response body
21 method.getResponseBodyAsString(); 
22 } else {
23 br = new BufferedReader(newInputStreamReader(method.getResponseBodyAsStream()));
24 String readLine;
25 while(((readLine = br.readLine()) != null)) {
26 System.err.println(readLine);
27 }
28 }
29 } catch (Exception e) {
30 System.err.println(e);
31 } finally {
32 method.releaseConnection();
33 if(br != null) try { br.close(); } catch (Exception fe) {}
34 }
35 }

결과 받는 다른 예제)

byte[] responseBody = method.getResponseBody();
   method.getRequestEntity();
   String xml = new String(responseBody);

   SAXBuilder builder = new SAXBuilder();
   Document doc = builder.build(new StringReader(xml));
   Element root = doc.getRootElement();

String ResponseValue = root.getChild("ResponseValue").getValue();
   

Posted by 선한열심
JSP2013. 6. 27. 23:14

리소스 properties 파일 이용하기

3가지 방법 

1. fmt bundle 이용
<fmt:setLocale value="ko_KR"/>
<fmt:setBundle basename="resource" var="lang" />
<fmt:message key="fruits.apple" bundle="${lang}" />
</body>
</html>

파일 위치는 /WEB-INF/src바로 밑에

* resource.properties

fruits.apple=apple
fruits.strawberry=strawberry
fruits.banana=banana

 

 

2. 프로젝트 \WEB-INF\web.xml  안에 추가할수도 있네요

  <context-param>
  <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
  <param-value>JeongMessageBundle</param-value>
</context-param>

파일위치 : classes\JeongMessageBundle.properties

 

3. JSP 에서 사용

Copy properties file in WEB-INF/classes folder

Suppose we have file commonVariable.properties in WEB-INF/classes folder

# forum path and properties
forum.path=forum
forum.url=forum
forum.database=jspforum
forum.use=yes

JSP which is getting values from ResourceBundle properties file

resource.jsp

<%@ page language="java" import="java.util.*" %>
<%
ResourceBundle resource = ResourceBundle.getBundle("commonVariable");
/// commonVariable.properties file will be in WEB-INF/classess  folder

String sPath=resource.getString("forum.path");
String sName=resource.getString("forum.database");

System.out.println(sPath);
System.out.println(sName);

%>

 

Posted by 선한열심