'작업노트'에 해당되는 글 100건

  1. 2008.01.14 [Struts] Action 에서 포워딩 시 parameter 넘기는 법
  2. 2008.01.12 [Spring] IoC(Inversion of Controll), 역행 제어의 개념
  3. 2008.01.07 버전을 항상 주의합시다.
  4. 2008.01.05 아이프레임 리사이즈 문제 해법
  5. 2008.01.05 멱등(Idempotent)
  6. 2008.01.05 Java API Map
  7. 2008.01.05 Head First Java (뇌 회로를 자극하는 자바 학습법)
  8. 2008.01.05 최범균의 JSP 2.0 프로그래밍 - 기초부터 중급까지
  9. 2007.12.23 [Eclipse] JVM terminated. Exit code=-1 ....................................... 3
  10. 2007.12.22 [JNDI] NamingException

[Struts] Action 에서 포워딩 시 parameter 넘기는 법

|


struts-config.xml에서의 설정으로는 동적으로 바뀌는 파라메터를 넘겨줄 수 없다.

그래서, 액션 클래스에서의 특별한 처리를 요구하는 데, 다음중 한 방법을 사용하면 된다.


  1.  ActionFoward 객체 직접 생성

    다음과 같이 ActionForward객체를 생성하여 리턴한다.
    return new ActionForward("/index.html?param=" + paramValue, true);

    파라메터가 많을 경우 코드가 지저분해지고 번거러울 수 있다.


  2. ActionMapping객체를 통한 ActionFoward객체 생성

    대부분의 경우 이같은 방법으로 포워드시킨다.

    excute() 메소드에서 전달 받은 ActionMapping 객체를 이용한다.
    ActionForward forward = mapping.findForward("success");
    ActionForward redirect

    = new ActionForward(forward.getName(), forward.getPath()
    + "?param=" + paramValue, true );

    return redirect;


  3. ActionRedirect 클래스 활용

    org.apache.struts.action.ActionRedirect 클래스를 import시켜서 사용한다.
    ActionRedirect redirect = new ActionRedirect( mapping.findForward("success") );
      redirect.addParameter("param", paramValue);
    return redirect;
    * 주의 : 이 방법은 struts 1.2.7 버전 부터 가능하다.



이 글은 스프링노트에서 작성되었습니다.

And

[Spring] IoC(Inversion of Controll), 역행 제어의 개념

|

 IoC(Inversion of Controll)는 우리말로 제어의 역행 쯤 되시겠다. 그렇다면 제어가 역행됬다는 것은 무슨 뜻인가?

지금까지 객체를 생성하고 각 객체 간의 의존관계(생성하고 머 그런거)를 제어하는 권한은 우리 개발자들에게 있었다. 하지만 서블릿, EJB가 등장하면서 제어권이 서블릿과 ejb를 관리하는 컨테이너에게로 넘어가 버렸다. 개발자들이 서블릿과 ejb를 직접 생성하고 싶어도 이 객체들은 직접 생성하여 제어할 수 없고 객체 생성에 대한 제어권이 컨테이너에게 넘어가면서 객체의 생명주기를 관리하는 권한또한 컨테이너들이 전담할 수 밖에 없게 되었다. 제어권 역전 현상이란 바로 이것을 의미하며, 스프링도 컨테이너처럼 이런 현상(?)을 이용하고 있다. 즉, 스프링 역시 내부에 IoC개념, 객체에 대한 생성 및 생명주기를 관리할 수 있는 기능을 제공하고 있다.

스프링은 POJO(Plain Old Java Object : 개발자에 의해 생성/관리되는 평범한 객체 되시겠다.)를 관리하는 컨테이너 역할을 가지고 있다. 즉, 개발자에 의해 정의된 객체(POJO)들을 xml설정에 따라 애플리케이션 시작과 동시에 생성하고 관리하여 주기때문에(기본적으로 그러하다) 컨테이너의 기능상 장점과 POJO 만의 장점을 함께 누릴 수 있는 것이다.
이것이 스프링의 IoC, 역행제어이다.

다음 편에 계속..-_-

'역행 제어'
이 압박감 심한 단어 때문에 어려운 내용일꺼야 지레 겁부터 먹었는데
알고보면 역행제어란 그리 어려운 개념이 아니었습니다.
공부하면서 항상 느끼는 거지만
용어들... 너무 압박감이 심하네요ㅠ

이 글은 스프링노트에서 작성되었습니다.

And

버전을 항상 주의합시다.

|
작년에 처음으로 struts를 공부할 때,

그때는 넷빈즈가 아닌 이클립스로 열혈공부를 했더랬다.

그런데 망할.. struts를 실습좀 하려니 자꾸 not available 에러가 뜨는게 아닌가?

한 3일을 해맸나.. 결국은 넷빈즈로 갈아탔는데,

참 간편한 방법으로 스트럿츠 프로젝트를 생성할 수 있었다.

이 때 부터 넷빈즈를 좋아하기 시작했지.


아무튼 오늘...

회사에서 스트럿츠로 프로젝트를 돌리는데, 언젠가 본듯한 에러가.....

콘솔창을 보고 또 보다가 기억났다. 그 때 그 에러다-_-

뚜둥..

결국 회사분의 힘을 빌어 해결한 방법은.. 자바 1.4버전으로 빌드된 프로젝트를

5.0으로 리빌드 한 것.

버전문제... 그놈의 버전 문제였다.

일년 전 방황했던 3일이...
 
매우 안타까워지는 순간이였다...

그리고, 옆에 물어볼 사람이 있다는게 얼마나 소중한 가도 느꼈다.

'작업노트 > Developer's Diary' 카테고리의 다른 글

OOAD가 끝나갈때 쯔음해서..  (0) 2008.07.25
아키텍처...  (0) 2008.07.16
흠..  (0) 2008.05.28
미국 드라마 "하우스(HOUSE)" 열혈 관람하다가..  (0) 2008.05.11
진짜 개발자  (0) 2008.04.23
And

아이프레임 리사이즈 문제 해법

|

How To Resize an IFrame to the Size of Its Contents Without Displaying Scroll Bars

Article ID : 278469
Last Review : November 23, 2006
Revision : 4.1
This article was previously published under Q278469

SUMMARY

In certain situations, you may want to resize an IFrame so that all of its document contents are visible, but no scroll bars are displayed on the page. This article describes how to do this.

Back to the top

MORE INFORMATION

To determine the size of the IFrame's contents, you must access the height and width properties of the underlying IFrame document. Because you only have scripting access to pages that are hosted in the same domain, you can only access the properties to the pages that are hosted within the same domain (for example, Cross Frame Scripting). Therefore, the source document of the IFrame must be from the same domain as the page that contains the IFrame.

The following code demonstrates how to resize an IFrame in this way. Create a new .htm document, and paste the following HTML code. In the SRC attribute for the IFrame, you must supply an HTML page from the same domain that the IFrame loads.

NOTE: This technique may not work correctly if there are absolutely positioned elements that are residing within the IFrame.
<HTML>
<HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
function reSize()
{
	try{	
	var oBody	=	ifrm.document.body;
	var oFrame	=	document.all("ifrm");
		
	oFrame.style.height = oBody.scrollHeight + 
(oBody.offsetHeight - oBody.clientHeight); oFrame.style.width = oBody.scrollWidth +
(oBody.offsetWidth - oBody.clientWidth); } //An error is raised if the IFrame domain !=
its container's domain catch(e) { window.status = 'Error: ' + e.number + '; ' + e.description; } } //--> </SCRIPT> </HEAD> <BODY onload=reSize()> <iframe onresize=reSize() id=ifrm src=YOUR_PAGE_HERE></iframe> </BODY> </HTML>
This example uses try and catch to check for domain consistency, which are only available with Internet Explorer 5 and later. This error checking is included for illustration purposes and is not absolutely necessary; it only allows the script to fail gracefully.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:
https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104)
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)

Back to the top

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
167796 (http://support.microsoft.com/kb/167796/EN-US/) PRB: Permission Denied Error Message When Scripting Across Frame
For more information about measuring element dimensions and locations, see the following Microsoft Developer Network (MSDN) Web site:
http://msdn.microsoft.com/workshop/author/om/measuring.asp (http://msdn.microsoft.com/workshop/author/om/measuring.asp)
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
http://msdn.microsoft.com/ie/ (http://msdn.microsoft.com/ie/)

http://support.microsoft.com/iep (http://support.microsoft.com/iep)

Back to the top

And

멱등(Idempotent)

|

멱등은 동일한 작업을 어떤 부작용도 없이 한 번이고 두 번이고 계속해서 할 수 있다.

멱등이라는 말은 여러가지 의미로 사용된다. HTTP/서블릿 환경에서 이 말은 동일 요청은 서버에 어떤 잘못된 결과를 야기하지 않고 두 번이상 이루어질 수 있다는 의미이다. 동일 요청은 동일 응답을 가져야 한다는 의미가 아님을, 요청으로 어떤 부작용도 발생하지 말아야 한다는 의미가 아님을 유의해야 한다.

HTTP 스펙 1.1에서는 GET, HEAD, PUT은 멱등이라고 정의하고 있다. 물론 개발자가 멱등이 아닌 doGet()을 작성할 수도 있지만 권장되지는 않는다. POST는 HTTP 스펙 1.1에 의하면 멱등이 아니다.

HTTP GET은 말 그대로 무엇인가를 서버로부터 가져오는 것이지, 서버에 수정을 가하기 위한 것이 아니다. GET은 HTTP 스펙에 따르면 멱등 메소드이다. GET은 어떤 부작용(bad side effect)없이 여러 번 실행할 수 있다.

POST는 반대로 멱등 메소드가 아니다. POST로 전송되는 몸체의 정보는 트랜잭션을 위한 것이면, 이는 되돌릴 수 있는 성질의 것이 아니다. 이런 이유 때문에 doPost()를 구현할 때 유의해야 한다.

-HEAD FIRST Servlet & JSP

'작업노트 > JSP & Servlet' 카테고리의 다른 글

커스텀 태그 라이브러리 사용시  (0) 2008.10.09
스코프(Scope)  (0) 2007.11.19
[미해결] 이미지 태그 한글 파일명 경로 처리문제  (0) 2007.09.04
request.getSession()  (0) 2007.05.27
JspWriter  (0) 2007.05.27
And

Java API Map

|
사용자 삽입 이미지
And

Head First Java (뇌 회로를 자극하는 자바 학습법)

|
 
사용자 삽입 이미지












신선한 책이다.

부제목의 문구대로 뇌 회로를 확실히 자극시켜준다.

웹쪽으로 진로를 정하면서 자바를 공부하기 위해 책을 고르던중,

재미있다는 서평들을 읽고 빨리 읽을 수 있을 것 같아 고른 책이다.

이런 이론서들은 대부분 지루하기 짝이 없다는 건 누구나 다 겪어봐서 잘 알것이다.

하지만 이 책은, 공부하다가 뇌의 구동이 멈추려 할때면 신선한 바람을 공급해준다.

읽어보면 알 것이다.

나는 끝까지 읽는데에 2주 정도 걸렸다.

(하루에 7-8시간씩 매달린것 같다. 매주 4일 공부했으니..64시간정도 걸린 듯)

책 구성이 색다르고 신선했기에 지치지 않고 공부할 수 있었다.

자바를 공부하고 싶은 사람들에게 정말 강추하고 싶은 책이다.

단, 플밍 경험, 객체지향의 개념이 조금이라도 있어야지 읽기에 수월할 것 같다.

가끔... 그런 부분들이 나온다.

And

최범균의 JSP 2.0 프로그래밍 - 기초부터 중급까지

|
사용자 삽입 이미지












회사에서 신입교육 교제를 고르라기에;; 어떤 걸 사야되나 고민했는데
동기가 사자고 해서 고른 책.

요즘 나오는 서블릿/jsp책들은 책 제목 부터 알 수 있듯이 mvc패턴을 중심으로 쓰여져있다.
즉, jsp는 책의 일부일 뿐이라는 얘기.
하지만 이 책은 JSP만을 중점적으로 다루고 있는 책이었다.

사실 jsp의 기능들을 제대로 모르고(어떤걸 어떤때에 써야겠다는 생각조차도 없었다.)
사용한 경우가 많았는데, 이번에 다시한번 이 책을 읽어 보면서 간과할 수 없는
jsp의 기능들을 많이 익힐 수 있었다.

JSP에 대해서 자세하게 알고 싶은 분께 추천하고 싶은 책.
책이 오래되었고, jsp위주이다 보니 요즘 트렌드에 맞추자면,
다른 servlet/jsp책도 같이 봐야 좋을 것같다.(열혈강의 시리즈 추천)

단점이 있다면...
예제가 돌아가지 않는게 있다 -_-;;
방명록 예제에서 페이징처리 부분이 그러하다. 나는 그전에 해놓은 소스로 대체 했지만,
다른 동기분들은 꽤 귀찮은 작업이었을 듯 ㅎ

또... 너무 저자의 스타일이 녹아든 예제들이 아니었나..
물론, 그건 책쓴사람 마음이고 어쩔수 없는 것이지만,
그에 대한 설명이 있었더라면 책을 이해하는데 좋았지 않겠었나 싶다.
마음대로 본문에도 없는 내용 가져다 써놓고 머하는 건지, 왜 썼는지에 대한
설명이 없어서 아쉬웠다.

그리고 문필능력이랄까? 이해시키는 문장력이 부족하신듯 하다.
쉽게 설명할 수 있는 내용을 베베베 꼬아서 써놓은 경향이 있다.
저자의 최근 저서들은 본적이 없어 모르겠지만, 꽤나 영향력 있으신 분이니
문장실력을 좀더 키워서 좋은 책들, 많이 써주었으면 한다.

'작업노트 > Books' 카테고리의 다른 글

Head First Java (뇌 회로를 자극하는 자바 학습법)  (0) 2008.01.05
And

[Eclipse] JVM terminated. Exit code=-1 .......................................

|

컴퓨터를 포맷하고 새롭게 개발환경을 구축하던중에
이클립스를 설치하고 실행하려할 때

JVM terminated. Exit code=-1
.........................
..........(중략)........
..........................
-Xms40m
-Xms512m

이런 류의 경고창이 튀어나왔다.
정확한 답을 찾을 수는 없었지만 메모리 설정에 문제가 생긴 듯 하다.-_-
eclipse가 설치된 폴더에서 eclipse.ini 파일을 연 후

-Xms40m
-Xms512m

이라고 되있는 부분을

-Xms128m
-Xms256m

이라고 고친 후 실행시키면 된다.

And

[JNDI] NamingException

|

JNDI 설정으로 오라클 resource를 사용 하려했을 때 네이밍 예외가 발생하였다.
server.xml 파일을 찾기 위해 톰캣을 설치한 폴더의 server.xml에서 resource를 등록하고
실행을 하였더니 아래와 같은 에러가 발생하였다.

이유인 즉슨, 이클립스에서는 서버(톰캣 등)에 대한 설정들을 별도로 관리하고 있기 때문에
톰캣 폴더의 server.xml에 등록을 하여도 반응을 하지 않는다.

server.xml 파일의 수정은 이클립스의 관리를 받는 녀석한테서 이루어져야 한다.
이클립스의 Project Explorer에서 Servers항목을 열어보면 서버관련 설정파일을 볼 수 있다.
필요에 따라 수정, 등록을 하고 서버를 재가동 시키면 된다.
(때에 따라 곧바로 반영이 안될때가 있는데, 이클립스를 닫았다가 다시 실행하면 된다.)
또는, 자신의 workspace안에 있는 Servers 폴더를 열어서 수정해주어도 된다.

사용자 삽입 이미지

























2007. 12. 22 오후 12:10:22 org.apache.catalina.core.StandardWrapperValve invoke
심각: Servlet.service() for servlet jsp threw exception
javax.naming.NamingException
 at com.netville.njdf.connector.DBConnector.getDataSource(Unknown Source)
 at com.netville.njdf.connector.DBConnector.getConnection(Unknown Source)
 at org.apache.jsp.testOracle_jsp._jspService(testOracle_jsp.java:60)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
 at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
 at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
 at java.lang.Thread.run(Unknown Source)

And
prev | 1 | ··· | 4 | 5 | 6 | 7 | 8 | 9 | 10 | next