본문 바로가기

IT/ETC

Basic settings for web(02/05/20 cudo notes 3)

반응형

Activity 생명주기

존재하지 않음 -> onCreate() -> onStart -> onResume -> onPause() -> onStop() -> onDestroy -> 존재하지 않음

 

Problem 1 : 

If Android Emulator screen does not flip to landscape mode, check if flipping is blocked on avd manager.

allow flipscreen on avd manager.

 

-----------------

 

Basic web.xml settings you need

 

1. welcome file list for start up

 

<welcome-file-list>

<welcome-file>/</welcome-file>

</welcome-file-list>

 

2. for database access

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/spring/root-context.xml</param-value>

</context-param>

 

3. to read other languages beside english

 

<filter>

<filter-name>encodingFilter</filter-name>

<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>utf-8</param-value>

</init-param>

<init-param>

<param-name>listings</param-name>

<param-value>true</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>encodingFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

 

4. Setting path way from servlet-context.xml

 

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<init-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

 

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>/</url-pattern>

</servlet-mapping>

 

5. etc

 

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

 

----------

setting path for servlet-context.xml

 

1. enables annotations

 

<annotation-driven />

<context:annotation-config/>

 

<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->

<resources mapping="/resources/**" location="/resources/" />

 

<resources mapping="/style/**" location="/style/"/>

 

<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->

<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

<beans:property name="prefix" value="/WEB-INF/jsp/" />

<beans:property name="suffix" value=".jsp" />

</beans:bean>

 

<context:component-scan base-package="com.test.taewon">

<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>

        <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>

        <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>

</context:component-scan>

 

-----

 

root-context.xml

 

<context:property-placeholder

location="classpath:/mybatis/config/datasource.properties" />

<context:annotation-config />

<bean id="dataSource"

class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName" value="${driver}" />

<property name="url" value="${url}" />

<property name="username" value="${id}" />

<property name="password" value="${pw}" />

</bean>

<bean id="sqlSessionFactoryBean"

class="org.mybatis.spring.SqlSessionFactoryBean">

<property name="dataSource" ref="dataSource" />

<property name="mapperLocations"

value="classpath:/mybatis/mappers/*Mapper.xml" />

<property name="typeAliasesPackage"

value="com.test.taewon.vo" />

</bean>

<bean id="sqlSession"

class="org.mybatis.spring.SqlSessionTemplate">

<constructor-arg index="0" ref="sqlSessionFactoryBean"></constructor-arg>

</bean>

<bean id="TransactionManager"

class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

<property name="dataSource" ref="dataSource"></property>

</bean>

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">

<property name="basePackage" value="com.test.taewon.mapper"></property>

</bean>

 

----

datasource.properties stuff:

 

dbname=mysql

driver=com.mysql.cj.jdbc.Driver

url=jdbc:mysql://localhost:3306/taewonboard?serverTimezone=UTC

id=

pw=

반응형

'IT > ETC' 카테고리의 다른 글

mysql password change(02/06/20 cudo notes 4)  (0) 2020.02.06
Applied Accesbility  (0) 2020.02.05
안드로이드 스튜디오 계산기 mainactivity.java  (0) 2020.02.04
계산기 strings.xml  (0) 2020.02.04
계산기 activity_main.xml  (0) 2020.02.04