2017. 7. 10. 11:25

1. Google API 인증키 얻기

- 링크 :  https://code.google.com/apis/console


2. Google Map API 

- 링크 :   https://developers.google.com/maps/documentation/javascript/tutorial







3. 해당 소스



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<p style="text-align: center;"><button id="getLocation" type="button">위치 정보 수집</button></p>
<p style="text-align: center;"><br></p>
<p style="text-align: center;"></p>
    <div style="text-align: center;"><div id="map" style="width: 500px; height: 500px; display: inline-block; text-align: center;"></div></div><p>
</p>
<script>
    (function () {
      let map, infoWindow;
      window.initMap = function () {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 8
        });
        infoWindow = new google.maps.InfoWindow({map: map});
        infoWindow.setContent('Your location');
      };
      function successCallback(position) {
          let pos = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
          };
          infoWindow.setPosition(pos);
          map.setCenter(pos);
          alert("Your current position is: latitude(" + pos.lat + "), longitude(" + pos.lng + ")");
      }
      function errorCallback(error) {
          alert("Error: " + error.message);
      }
      document.getElementById("getLocation").onclick = function () {
          navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
      };
    }());
</script>
<script src="https://maps.googleapis.com/maps/api/js?key={$API_KEY}&callback=initMap" async="" defer=""></script>
- 참고 사이트   http://unikys.tistory.com/375

Posted by 1+1은?
2017. 6. 22. 10:24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
MainTypeApplication.java
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.web.filter.CharacterEncodingFilter;
 
@SpringBootApplication
public class MainTypeApplication extends SpringBootServletInitializer {
 
     private static Class<Maintypeapplication> applicationClass = MainTypeApplication.class;
 
      
    public static void main(String[] args) {
        SpringApplication.run(MainTypeApplication.class, args);
    }
     
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(applicationClass);
    }
     
    /**
     * EncodingFilter
     * @return
     */
    @Bean
    public CharacterEncodingFilter characterEncodingFilter() {
 
        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
       
        characterEncodingFilter.setEncoding("UTF-8");
        characterEncodingFilter.setForceEncoding(true);
 
        return characterEncodingFilter;
    }
     
}


1
2
3
Eclipse
Spring boot project > Run as > Run Configurations >
Main Type -> search -> this class (ex). MainTypeApplication.java) settings


Posted by 1+1은?
2014. 1. 3. 10:36

기본 ini


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dfile.encoding=UTF-8
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms1024m
-Xmx1024m

속도향상용


1
2
3
4
5
6
7
8
9
10
11
<p>-Dfile.encoding=UTF-8
-Dosgi.requiredJavaVersion=1.6
 
-Xverify:none
-XX:+UseParallelGC
-XX:+CMSIncrementalPacing
-XX:-UseConcMarkSweepGC
-XX:NewSize=128M
 
-Xms1024m
-Xmx1024m</p>



1
2
3
4
5
코드 자동완성기능 해체
Preferences > Java > Editor > Content Assist -> Auto Activation - Enable auto activation 해제
 
Spell Checking 해체
Preferences > General > Editors > Text Editors > Spelling -> Enable spell checking 해제
Posted by 1+1은?
2013. 8. 16. 10:11
web.xml 문서를 조작하여 서블릿에 정보를 전달하기 위한 용도로 사용되는 인터페이스.

특징과 설정방법은 다음과 같다 :

구 분

적용

범위 설정


ServletConfig


해당 서블릿에서만 사용할 수 있다.
* 필터에서도 사용 가능

<servlet>
  <servlet-name>    </servlet-name>
  <servlet-class>    </servlet-class>
  <init-param>
    <param-name>   </param-name>
    <param-value>   </param-value>
  </init-param>
</servlet>

ServletContext

동일 웹 애플리케이션 내 모든 서블릿(또는  JSP)에서 사용
할 수 있다.
<context-param>
    <param-name>   </param-name>
    <param-value>   </param-value>
</context-param>


만약 서버의 설정을 변경해야 할 때라고 치자. 
해당 값이 자바파일에 명시되어 있다면 그 클래스를 수정하여 다시 컴파일하고 배포도 다시 해야한다.
하지만 ServletConfig나 ServletContext 인터페이스를 이용해 작성하면 xml 수정 후 서버만 리셋하면 된다. 
어느것이 더 편한지는 개발자 쓰기 나름

MVC2 패턴 구현에도 사용되는 듯 하다. 바로가기


● 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<servlet>
    <servlet-name>test</servlet-name>
    <servlet-class>com.test1.TestServlet</servlet-class>
    <init-param>
        <param-name>name</param-name>
        <param-value>han</param-value>
    </init-param>
    <init-param>
        <param-name>age</param-name>
        <param-value>20</param-value>
    </init-param>
</servlet>
  
<servlet-mapping>
    <servlet-name>test</servlet-name>
    <url-pattern>/test</url-pattern>
</servlet-mapping>
  
<context-param>
    <param-name>city</param-name>
    <param-value>seoul</param-value>
</context-param>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
protected void process(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    ServletConfig config = getServletConfig(); //해당 서블릿에서만 사용가능
    ServletContext context = getServletContext(); //동일한 웹어플리케이션 어디서든 접근가능
          
    String name = config.getInitParameter("name");
    String age = config.getInitParameter("age");
          
    String city = context.getInitParameter("city");
  
          //로그설정
    context.log("로그를 출력합니드아");
  
    resp.setContentType("text/html;charset=utf-8");
    PrintWriter out = resp.getWriter();
          
    out.print("name:" + name + "<br>");
    out.print("age:" + age + "<br>");
    out.print("city:" + city + "<br>");
}


'JSP > JspServlet' 카테고리의 다른 글

XML 기본구조  (0) 2013.08.16
Tomcat web.xml  (0) 2013.08.16
자바클래스 메서드에 접근  (0) 2013.08.16
서블릿에서 out.print()  (0) 2013.08.16
tag : core  (0) 2013.08.16
Posted by 1+1은?
2013. 8. 16. 10:07


1
2
3
4
5
6
7
8
9
10
11
12
13
<!--?xml version="1.0" encoding="euc-kr"?-->
<booklist>
    <book kind="컴퓨터">
        <title>JAVA</title>
        <author>홍길동</author>
        <price>1000</price>
    </book>
    <book kind="소설">
        <title>TEST</title>
        <author>이기자</author>
        <price>2000</price>
    </book>
</booklist>

booklist : 루트폴더를 의미하며 어떤 단어 사용하던지 선언시점과 종료지점이 일치하기만 하면 된다.
<root>
    ...
</root>


'JSP > JspServlet' 카테고리의 다른 글

ServletConfig, ServletContext  (0) 2013.08.16
Tomcat web.xml  (0) 2013.08.16
자바클래스 메서드에 접근  (0) 2013.08.16
서블릿에서 out.print()  (0) 2013.08.16
tag : core  (0) 2013.08.16
Posted by 1+1은?

BESbswy