카테고리 없음

230202

Berylly 2023. 2. 3. 18:20

T.김동식

 

 

JNDI(java naming and directory interface) ConnectionPool 에 접근하기위해 다운

key/value로 자원을 저장해 필요할때마다 얻는.

 -  tomcat-dbcp.jar 연결 (ConnectionPool 커넥션풀)

    접속자수가 많은데 필요할때마다 데이터베이스와 연동해 작업하는것은 비효율적

    연동할 데이터 베이스와의 연결을 미리 설정해 빠르게 연동작업.

    데이터베이스와 연결시킨 상태를 유지하는 기술

+객체를 구현할때는 javax.sql.DataSource 클래스이용, 애플리케이션 실행할때는 JNDI를 이용

 

 

자바

https://namu.wiki/jump/XZBM2sJcuDnoqqgnv%2F34499xk3Jg1xumXypm8tvPtpvcMgQWGZdOVcR134XHEY8A

 

파일:자바섬.png - 나무위키

이미지의 자세한 설명을 적어 주세요.

namu.wiki

 

 

action 동작태그, 태그가 자바가하는 동작을 대신함

<jsp:include> jsp에 jsp를 포함시키다, 화면분할/띄울때 많이 사용

<jsp:forward> 서블릿 RequestDispatcher클래스의 포워딩 기능

<jsp:useBean> 클래스, 데이터를 저장/전달, new를 대체. DTO(Data Transfer Object) VO(Value Class)와 같은 개념, 

<jsp:setProperty>

<jsp:getProperty>

 

 

Maven 메이븐

자바용 프로젝트 관리

Apache Ant의 대안

기본프로젝트 처리기능 및 빌드 프로세스 관리를 제공하는 코어 엔진

빌드: 소스파일을 실핼항수있는 가공물로 변환하는 과정/그의 결과물

 

 

 

 

jsp안에 jsp 띄우기

<%request.setCharacterEncoding("utf-8");%>
<div class="outer1">
		<p>jsp:include image1.jsp</p>
        
        //image1.jsp를 include할것이다. 
        //flush, head정보를 가져오지않는다.
		<jsp:include page="image1.jsp" flush="true">
        	//파라미터 값을 set
			<jsp:param value="박상희" name="psh" />
			<jsp:param value="img_basic.png" name="img_basic" />
		</jsp:include>
	</div>
   <div class="outer2">
		<p>jsp:include image2.jsp</p>
		<jsp:include page="image2.jsp" flush="true">
			<jsp:param value="박상희" name="psh" />
			<jsp:param value="img_gray.png" name="img_gray" />
		</jsp:include>
	</div>

 

include에서 파라미터 set한것을 가져와야만이 이미지가 뜸으로, 

바로 접속시 값/이미지가 보이지 않음.

 <% 
    request.setCharacterEncoding("utf-8");
   String str1 = request.getParameter("psh");
   String str2 = request.getParameter("img_basic");
    %>
<%=str1%>
<img src="./image/<%=str2%>" width="150">
 <% 
    request.setCharacterEncoding("utf-8");
   String str1 = request.getParameter("psh");
   String str2 = request.getParameter("img_gray");
    %>
    
<%=str1%>
<img src="./image/<%=str2%>" width="150">

 

 

 

 

Android

 

안드로이드의 4대 컴포넌트

Activity

B Broadcast Receiver

C Content Provider

S Service

 

 

SeekBar/ProgressBar/EditText로 변화 인식하기

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <SeekBar
        android:id="@+id/seekBar"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="80dp"
        android:max="100"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="10dp"
        android:layout_marginTop="72dp"
        android:layout_marginEnd="10dp"
        android:max="100"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.498"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/seekBar" />

    <EditText
        android:id="@+id/editText"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="100dp"
        android:ems="10"
        android:gravity="center"
        android:inputType="textPersonName"
        android:text="0"
        android:textSize="40sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/progressBar" />

</androidx.constraintlayout.widget.ConstraintLayout>

SeekBar로 수치설정 - ProgressBar로 수치나타내기 - EditText에 표현하기

 ProgressBar progressBar;
 EditText editText;
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bar);

		//객체찾아저장
        progressBar = findViewById(R.id.progressBar);
        editText = findViewById(R.id.editText);
        SeekBar seekBar = findViewById(R.id.seekBar);
        
        //seekBar가 setOnSeekBarChangeListener 변화가 생길때
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                
                //progressBar를 int progress로 세팅
                progressBar.setProgress(progress);
                
                //editText를 progress를 (String.valueOf으로 바꾼 텍스트로 세팅
                editText.setText(String.valueOf(progress));
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {}
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {}
        });

 

 

화면이동하기

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <Button
        android:id="@+id/btnNewActivity"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="새 화면 열기" />
</LinearLayout>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#ddd"
    >

    <Button
        android:id="@+id/btnReturn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="돌아가기" />
</LinearLayout>

 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);

        Button btnNewActivity = findViewById(R.id.btnNewActivity);
        btnNewActivity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            //btnNewActivity버튼이 클릭되면 
            // new Intent 안드로이드에서 페이지 전환과 페이지간 데이터 전달
                Intent intent = new Intent(getApplicationContext(), MainActivity_second.class);
                
                //액티비티를 띄우기 위해 사용되는 메서드 startActivity
                startActivity(intent);
            }
        });
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        Button btnReturn = findViewById(R.id.btnReturn);
        btnReturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
<activity
android:name=".MainActivity_fisrt"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

//MainActivity_second 추가
<activity
android:name=".MainActivity_second"
android:label="Second 액티비티" />