Posted
Filed under ORACLE

SELECT SYS_CONTEXT ('USERENV', 'IP_ADDRESS')

   FROM DUAL;

2010/03/09 14:09 2010/03/09 14:09
Posted
Filed under JSP, JAVA

[원문] - http://www.roseindia.net/struts/strutsfileupload.shtml

application. This interface represents a file that has been uploaded by a client. It is the only interface or class in upload package which is typically referenced directly by a Struts application.

Creating Form Bean

Our form bean class contains only one property theFile,  which is of type org.apache.struts.upload.FormFile

package roseindia.net;


import org.apache.struts.action.*;
import org.apache.struts.upload.FormFile;



/**
* @author Deepak Kumar
* @Web http://www.roseindia.net
* @Email roseindia_net@yahoo.com
*/

/**
 * Form bean for Struts File Upload.
 *
*/
public class StrutsUploadForm extends ActionForm
{
  private FormFile theFile;

  /**
   * @return Returns the theFile.
   */
  public FormFile getTheFile() {
    return theFile;
  }
  /**
   * @param theFile The FormFile to set.
   */
  public void setTheFile(FormFile theFile) {
    this.theFile = theFile;
  }
}

Creating Action Class

Our action class simply calls the getTheFile() function on the FormBean object to retrieve the reference of the uploaded file. Then the reference of the FormFile is used to get the uploaded file and its information. Here is the code of our action class(StrutsUploadAction.java):

package roseindia.net;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
/**
* @author Deepak Kumar
* @Web http://www.roseindia.net
* @Email roseindia_net@yahoo.com
*/

/**
 * Struts File Upload Action Form.
 *
*/
public class StrutsUploadAction extends Action
{
  public ActionForward execute(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) throws Exception{
    StrutsUploadForm myForm = (StrutsUploadForm)form;

        // Process the FormFile
        FormFile myFile = myForm.getTheFile();
        String contentType = myFile.getContentType();
        String fileName    = myFile.getFileName();
        int fileSize       = myFile.getFileSize();
        byte[] fileData    = myFile.getFileData();
    System.out.println("contentType: " + contentType);
    System.out.println("File Name: " + fileName);
    System.out.println("File Size: " + fileSize);
   
      return mapping.findForward("success");
  }
}

Defining form Bean in struts-config.xml file

Add the following entry in the struts-config.xml file for defining the form bean:

<form-bean
    name="FileUpload"
    type="roseindia.net.StrutsUploadForm"/>

Defining Action Mapping

Add the following action mapping entry in the struts-config.xml file:

<action
     path="/FileUpload"
     type="roseindia.net.StrutsUploadAction"
     name="FileUpload"
     scope="request"
     validate="true"
     input="/pages/FileUpload.jsp">
     <forward name="success" path="/pages/uploadsuccess.jsp"/>
</action>

Developing jsp page

Code of the jsp (FileUpload.jsp) file to upload is as follows:

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>

<html:html locale="true">
<head>
<title>Struts File Upload Example</title>
<html:base/>
</head>
<body bgcolor="white">
<html:form action="/FileUpload" method="post" enctype="multipart/form-data">
<table>
<tr>
<td align="center" colspan="2">
<font size="4">Please Enter the Following Details</font>
</tr>

<tr>
<td align="left" colspan="2">
<font color="red"><html:errors/></font>
</tr>



<tr>
<td align="right">
File Name
</td>
<td align="left">
<html:file property="theFile"/>
</td>
</tr>


<tr>
<td align="center" colspan="2">
<html:submit>Upload File</html:submit>
</td>
</tr>
</table>


</html:form>
</body>
</html:html>

Note that we are setting the encrypt property of the form to enctype="multipart/form-data".

code for the success page (uploadsuccess.jsp) is:

<html>

<head>
<title>Success</title>
</head>

<body>

<p align="center"><font size="5" color="#000080">File Successfully Received</font></p>

</body>

</html>

Add the following line in the index.jsp to call the form.

<li>
<html:link page="/pages/FileUpload.jsp">Struts File Upload</html:link>
<br>
Example shows you how to Upload File with Struts.
</li>

Building Example and Testing

To build and deploy the application go to Struts\strutstutorial directory and type ant on the command prompt. This will deploy the application. Open the browser and navigate to the FileUpload.jsp page. Your browser should display the file upload form:
  

2010/03/08 19:29 2010/03/08 19:29
Posted
Filed under etc
유효한 ISO 국가 코드
국가명 코드
AFGHANISTAN(아프가니스탄) AF
ALBANIA(알바니아) AL
ALGERIA(알제리) DZ
AMERICAN SAMOA(미국령 사모아) AS
ANDORRA(안도라) AD
ANGOLA(앙골라) AO
ANGUILLA(안길라) AI
ANTARCTICA(남극) AQ
ANTIGUA AND BARBUDA(안티구아 바부다) AG
ARGENTINA(아르헨티나) AR
ARMENIA(아르메니아) AM
ARUBA(아루바) AW
AUSTRALIA(오스트레일리아) AU
AUSTRIA(오스트리아) AT
AZERBAIJAN(아제르바이잔) AZ
BAHAMAS(바하마) BS
BAHRAIN(바레인) BH
BANGLADESH(방글라데시) BD
BARBADOS(바베이도스) BB
BELGIUM(벨기에) BE
BELIZE(벨리즈) BZ
BENIN(베넹) BJ
BERMUDA(버뮤다) BM
BHUTAN(부탄) BT
BOLIVIA(볼리비아) BO
BOSNIA HERCEGOVINA(보스니아 헤르체고비나) BA
BOTSWANA(보트와나) BW
BOUVET ISLAND(부베이 섬) BV
BRAZIL(브라질) BR
BRITISH INDIAN OCEAN TERRITORY(영인도 제도) IO
BRUNEI DARUSSALAM(브루나이) BN
BULGARIA(불가리아) BG
BURKINA FASO(부르키나파소) BF
BURUNDI(브룬디) BI
BELARUS(벨라루스) BY
CAMBODIA(캄보디아) KH
CAMEROON(카메룬) CM
CANADA(캐나다) CA
CAPE VERDE(까뽀베르데) CV
CAYMAN ISLANDS(카이만 군도) KY
CENTRAL AFRICAN REPUBLIC(중앙 아프리카) CF
CHAD(차드) TD
CHILE(칠레) CL
CHINA(중국) CN
CHRISTMAS ISLAND(크리스마스 섬) CX
COCOS (KEELING) ISLANDS(코코스킬링 제도) CC
COLOMBIA(콜롬비아) CO
COMOROS(코모르) KM
CONGO(콩고) CG
COOK ISLANDS(쿠크 군도) CK
COSTA RICA(코스타리카) CR
COTE D'IVOIRE(코트디부와르) CI
CROATIA(크로아티아) HR
CUBA(쿠바) CU
CYPRUS(사이프러스) CY
CZECH REPUBLIC(체코) CZ
CZECHOSLOVAKIA(체코슬로바키아) CS
DENMARK(덴마크) DK
DJIBOUTI(지부티) DJ
DOMINICA(도미니카) DM
DOMINICAN REPUBLIC(도미니카 공화국) DO
EAST TIMOR(동티모르) TP
ECUADOR(에쿠아도르) EC
EGYPT(이집트) EG
EL SALVADOR(엘살바도르) SV
EQUATORIAL GUINEA(적도 기니) GQ
ESTONIA(에스토니아) EE
ETHIOPIA(이디오피아) ET
FALKLAND ISLANDS (포클랜드) FK
FAROE ISLANDS(페로 군도) FO
FIJI(피지) FJ
FINLAND(핀란드) FI
FRANCE(프랑스) FR
FRENCH GUIANA(프랑스령 기아나) GF
FRENCH POLYNESIA(프랑스령 폴리네시아) PF
FRENCH SOUTHERN TERRITORIES(프랑스 남부 지역) TF
GABON(가봉) GA
GAMBIA(감비아) GM
GEORGIA(그루지야) GE
GERMANY(독일) DE
GHANA(가나) GH
GIBRALTAR(지브랄타) GI
GREECE(그리스) GR
GREENLAND(그린랜드) GL
GRENADA(그레나다) GD
GUADELOUPE(과달로프) GP
GUAM(괌) GU
GUATEMALA(과테말라) GT
GUINEA(기니) GN
GUINEA-BISSAU(기네비쏘) GW
GUYANA(가이아나) GY
HAITI(아이티) HT
HEARD AND MC DONALD ISLANDS(허드 섬 및 맥도날드 군도) HM
HONDURAS(온두라스) HN
HONG KONG(홍콩) HK
HUNGARY(헝가리) HU
ICELAND(아이슬랜드) IS
INDIA(인도) IN
INDONESIA(인도네시아) ID
IRAN (ISLAMIC REPUBLIC OF) - 이란(이슬람 공화국) IR
IRAQ(이라크) IQ
IRELAND(아일랜드) IE
ISRAEL(이스라엘) IL
ITALY(이탈리아) IT
JAMAICA(자메이카) JM
JAPAN(일본) JP
JORDAN(요르단) JO
KAZAKHSTAN(카자흐스탄) KZ
KENYA(케냐) KE
KIRIBATI(키리바시) KI
KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF - 북한 KP
KOREA, REPUBLIC OF - 대한민국 KR
KUWAIT(쿠웨이트) KW
KYRGYZSTAN(키르기스스탄) KG
LAO PEOPLE'S DEMOCRATIC REPUBLIC(라오스) LA
LATVIA(라트비아) LV
LEBANON(레바논) LB
LESOTHO(레소토) LS
LIBERIA(리베리아) LR
LIBYAN ARAB JAMAHIRIYA(리비아) LY
LIECHTENSTEIN(리히텐슈타인) LI
LITHUANIA(리투아니아) LT
LUXEMBOURG(룩셈부르크) LU
MACAU(마카오) MO
MADAGASCAR(마다가스카르) MG
MALAWI(말라위) MW
MALAYSIA(말레이지아) MY
MALDIVES(몰디브) MV
MALI(말리) ML
MALTA(말타) MT
MARSHALL ISLANDS(마샬 군도) MH
MARTINIQUE(말티니크) MQ
MAURITANIA(말티니크) MR
MAURITIUS(모리셔스) MU
MEXICO(멕시코) MX
MICRONESIA(마이크로네시아) FM
MOLDOVA, REPUBLIC OF(몰도바) MD
MONACO(모나코) MC
MONGOLIA(몽골) MN
MONTSERRAT(몬트세라트) MS
MOROCCO(모로코) MA
MOZAMBIQUE(모잠비크) MZ
MYANMAR(미얀마) MM
NAMIBIA(나미비아) NA
NAURU(나우루) NR
NEPAL(네팔) NP
NETHERLANDS(네덜란드) NL
NETHERLANDS ANTILLES(네덜란드령 안틸레스) AN
NEUTRAL ZONE(중립 지대) NT
NEW CALEDONIA(뉴 칼레도니아) NC
NEW ZEALAND(뉴질랜드) NZ
NICARAGUA(니카라과) NI
NIGER(니제르) NE
NIGERIA(나이지리아) NG
NIUE(니우에) NU
NORFOLK ISLAND(노퍽) NF
NORTHERN MARIANA ISLANDS(북마리아나 군도) MP
NORWAY(노르웨이) NO
OMAN(오만) OM
PAKISTAN(파키스탄) PK
PALAU(팔라우) PW
PANAMA(파나마) PA
PAPUA NEW GUINEA(파푸아뉴기니) PG
PARAGUAY(파라과이) PY
PERU(페루) PE
PHILIPPINES(필리핀) PH
PITCAIRN(핏케언 군도) PN
POLAND(폴란드) PL
PORTUGAL(포르투갈) PT
PUERTO RICO(푸에르토리코) PR
QATAR(카타르) QA
REUNION(리유니언) RE
ROMANIA(루마니아) RO
RUSSIAN FEDERATION(러시아) RU
RWANDA(르완다) RW
ST. HELENA(세인트 헬레나) SH
SAINT KITTS AND NEVIS(세인트 크리스토퍼 니비스) KN
SAINT LUCIA(세인트 루시아) LC
ST. PIERRE AND MIQUELON(세인트 피에르 미퀠론) PM
SAINT VINCENT AND THE GRENADINES(세인트 빈센트 그레나딘스) VC
SAMOA(사모아) WS
SAN MARINO(산마리노) SM
SAO TOME AND PRINCIPE(쌍투메 프린시페) ST
SAUDI ARABIA(사우디아라비아) SA
SENEGAL(세네갈) SN
SEYCHELLES(세이셸) SC
SIERRA LEONE(시에라리온) SL
SINGAPORE(싱가포르) SG
SLOVAKIA(슬로바키아) SK
SLOVENIA(슬로베니아) SI
SOLOMON ISLANDS(솔로몬 군도) SB
SOMALIA(소말리아) SO
SOUTH AFRICA(남아프리카) ZA
SPAIN(스페인) ES
SRI LANKA(스리랑카) LK
SUDAN(수단) SD
SURINAME(수리남) SR
SVALBARD AND JAN MAYEN ISLANDS(스발바르드 얀마이엔 제도) SJ
SWAZILAND(스와질랜드) SZ
SWEDEN(스웨덴) SE
SWITZERLAND(스위스) CH
SYRIAN ARAB REPUBLIC(시리아) SY
TAIWAN, PROVINCE OF CHINA(대만) TW
TAJIKISTAN(타지키스탄) TJ
TANZANIA, UNITED REPUBLIC OF(탄자니아) TZ
THAILAND(태국) TH
TOGO(토고) TG
TOKELAU(토켈라우) TK
TONGA(통가) TO
TRINIDAD AND TOBAGO(트리니다드 토바고) TT
TUNISIA(튀니지) TN
TURKEY(터어키) TR
TURKMENISTAN(투르크메니스탄) TM
TURKS AND CAICOS ISLANDS(터크스 카이코스 제도) TC
TUVALU(투발루) TV
UGANDA(우간다) UG
UKRAINE(우크라이나) UA
UNITED ARAB EMIRATES(아랍에미리트) AE
UNITED KINGDOM(영국) GB
UNITED STATES(미국) US
UNITED STATES MINOR OUTLYING ISLANDS(미국령 소군도) UM
URUGUAY(우루과이) UY
USSR SU
UZBEKISTAN(우즈베키스탄) UZ
VANUATU(바누아투) VU
VATICAN CITY STATE (HOLY SEE)-바티칸 VA
VENEZUELA(베네수엘라) VE
VIET NAM(베트남) VN
VIRGIN ISLANDS (BRITISH)-영국령 버진아일랜드 VG
VIRGIN ISLANDS (U.S.)-미국령 버진아일랜드 VI
WALLIS AND FUTUNA ISLANDS(월리스 후트나) WF
WESTERN SAHARA(사하라) EH
YEMEN, REPUBLIC OF(예멘) YE
YUGOSLAVIA(유고슬라비아) YU
ZAIRE(자이르) ZR
ZAMBIA(잠비아) ZM
ZIMBABWE(짐바브웨) ZW
2010/03/03 23:51 2010/03/03 23:51
Posted
Filed under Htm&Javascript
[출처] http://kb2.adobe.com/cps/127/tn_12701.html
What's covered

This document lists the required and optional attributes of the object and embed tags used to publish Adobe Flash movies.

For specific usage information for these attributes, refer to sections of the Using Flash manual devoted to using object and embed tags (exact headings vary among Flash versions). Information is also available in "Adobe Flash OBJECT and EMBED tag syntax" (TechNote tn_4150).

Required attributes

The following attributes are required within the object and/or embed tags when adding a Flash movie to an HTML page:

Both object and embed:
  • width - Specifies the width of the movie in either pixels or percentage of browser window.
  • height - Specifies the height of the movie in either pixels or percentage of browser window.
object tag only:
  • classid - Identifies the ActiveX control for the browser. (See example code in TechNote tn_4150 for the correct value.)
  • codebase - Identifies the location of the Flash Player ActiveX control so that the browser can automatically download it if it is not already installed. (See example code in TechNote tn_4150 for the correct value.)
  • movie (param) - Specifies the location (URL) of the movie to be loaded.
embed tag only:
  • src - Specifies the location (URL) of the movie to be loaded.
  • pluginspage - Identifies the location of the Flash Player plug-in so that the user can download it if it is not already installed. EMBED only. (See example code in TechNote tn_4150 for the correct value.)
Optional attributes and possible values:

The following attributes are optional when defining the object and/or embed tags. For object , all attributes are defined in param tags unless otherwise specified:

  • id (attribute for object, object only) - Movie Identifier. Identifies the Flash movie to the host environment (a web browser, for example) so that it can be referenced using a scripting language.
  • name (embed only) - Movie name. Identifies the Flash movie to the host environment (a web browser, typically) so that it can be referenced using a scripting language such as JavaScript or VBScript.
  • swliveconnect - Possible values: true, false. Specifies whether the browser should start Java when loading the Flash Player for the first time. The default value is false if this attribute is omitted. If you use JavaScript and Flash on the same page, Java must be running for the FSCommand to work.
  • play - Possible values: true, false. Specifies whether the movie begins playing immediately on loading in the browser. The default value is true if this attribute is omitted.
  • loop - Possible values: true, false. Specifies whether the movie repeats indefinitely or stops when it reaches the last frame. The default value is true if this attribute is omitted.
  • menu - Possible values: true, false.
    • true displays the full menu, allowing the user a variety of options to enhance or control playback.
    • false displays a menu that contains only the Settings option and the About Flash option.
  • quality - Possible values: low, high, autolow, autohigh, best.
    • low favors playback speed over appearance and never uses anti-aliasing.
    • autolow emphasizes speed at first but improves appearance whenever possible. Playback begins with anti-aliasing turned off. If the Flash Player detects that the processor can handle it, anti-aliasing is turned on.
    • autohigh emphasizes playback speed and appearance equally at first but sacrifices appearance for playback speed if necessary. Playback begins with anti-aliasing turned on. If the actual frame rate drops below the specified frame rate, anti-aliasing is turned off to improve playback speed. Use this setting to emulate the View > Antialias setting in Flash.
    • medium applies some anti-aliasing and does not smooth bitmaps. It produces a better quality than the Low setting, but lower quality than the High setting.
    • high favors appearance over playback speed and always applies anti-aliasing. If the movie does not contain animation, bitmaps are smoothed; if the movie has animation, bitmaps are not smoothed.
    • best provides the best display quality and does not consider playback speed. All output is anti-aliased and all bitmaps are smoothed.
  • scale - Possible values: showall, noborder, exactfit.
    • default (Show all) makes the entire movie visible in the specified area without distortion, while maintaining the original aspect ratio of the movie. Borders may appear on two sides of the movie.
    • noorder scales the movie to fill the specified area, without distortion but possibly with some cropping, while maintaining the original aspect ratio of the movie.
    • exactfit makes the entire movie visible in the specified area without trying to preserve the original aspect ratio. Distortion may occur.
  • align (attribute for Object) - Possible values: l, t, r.
    • Default centers the movie in the browser window and crops edges if the browser window is smaller than the movie.
    • l (left), r (right), and t (top) align the movie along the corresponding edge of the browser window and crop the remaining three sides as needed.
  • salign - Possible values: l, t, r, tl, tr.
    • l, r, and t align the movie along the left, right, or top edge, respectively, of the browser window and crop the remaining three sides as needed.
    • tl and tr align the movie to the top left and top right corner, respectively, of the browser window and crop the bottom and remaining right or left side as needed.
  • wmode - Possible values: window, opaque, transparent. Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser.
    • window - movie plays in its own rectangular window on a web page.
    • opaque - the movie hides everything on the page behind it.
    • transparent - the background of the HTML page shows through all transparent portions of the movie, this may slow animation performance.
  • bgcolor - [ hexadecimal RGB value] in the format #RRGGBB . Specifies the background color of the movie. Use this attribute to override the background color setting specified in the Flash file. This attribute does not affect the background color of the HTML page.
  • base - . or [base directory] or [URL]. Specifies the base directory or URL used to resolve all relative path statements in the Flash Player movie. This attribute is helpful when your Flash Player movies are kept in a different directory from your other files.
  • flashvars - Possible values: variable to pass to Flash Player. Requires Macromedia Flash Player 6 or later.
    • Used to send root level variables to the movie. The format of the string is a set of name=value combinations separated by '&'.
    • Browsers will support string sizes of up to 64KB (65535 bytes) in length.
    • For more information on FlashVars, please refer to "Using FlashVars to pass variables to a SWF" (TechNote tn_16417).

Note: Values in brackets and italics indicate that the developer chooses the value.

Active Content JavaScript

Note: As of April 2008, Microsoft has removed all Active Content requirements from Internet Explorer. The information in this technote is supplied for historical reference to the period from April 2006 to April 2008. For details on Microsoft's deprecation of Active Content, see MSDN. For details of Adobe's Active Content workarounds see the Adobe Active Content Developer Center.

When you publish a Flash document with HTML using the "Flash Only" or "Flash HTTPS" HTML templates in Flash CS3 Professional, a JavaScript file linked to the HTML file, named AC_RunActiveContent.js will automatically be created. This file will need to remain with the HTML file for the JavaScript-based active content embedding. For more information on active content, please visit the Active Content Developer Center.

Note: For Flash 8, the inclusion of JavaScript-based active content embedding is possible through the Flash Active Content Update Extension.

A JavaScript function called AC_FL_RunContent() is used to dynamically generate the necessary object and embed tags necessary for the browser to display your Flash movie. This function is defined within AC_RunActiveContent.js and called in the location of your HTML file where you wish your Flash movie to be displayed. Example:

 <script >
		
if (AC_FL_RunContent == 0)
{
alert("This page requires AC_RunActiveContent.js.");
}
else
{
AC_FL_RunContent(
'codebase',
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width',
'550',
'height',
'400',
'src',
'myFlashMovie',
'quality',
'high',
'pluginspage',
'http://www.macromedia.com/go/getflashplayer',
'align',
'middle',
'play',
'true',
'loop',
'true',
'scale',
'showall',
'wmode',
'window',
'devicefont',
'false',
'id',
'ACTest',
'bgcolor',
'#ffffff',
'name',
'myFlashMovie',
'menu',
'true',
'allowScriptAccess',
'sameDomain',
'movie',
'myFlashMovie',
'salign',
'' );
//end AC code
}
</script>
2010/03/03 09:08 2010/03/03 09:08
Posted
Filed under Htm&Javascript
<script language="Javanull">
<!--F5키 금지
doc-ument.on-keydown = function() {
if (event.keyCode == 116) {
event.keyCode = 505;
}
if (event.keyCode == 505) {
return false;
}
}
//스크립트 끝-->
</script>
2010/03/02 21:39 2010/03/02 21:39
Posted
Filed under JSP, JAVA

원문 http://blog.naver.com/seogi1004/110069083184

더 좋은 방법이 있는지는 모르겠다.
일단 삽질한 거니 기록으로 남겨둔다.

아무튼... 먼저 Fancy URL 이란?

/board.html?action=list&page=2 이런 일반적인 URL 형식 대신
/board/list/2 이런 형식의 확장자가 없고 쿼리 스트링이 없는 간단한 URL을 말한다.
(fancy url의 정확한 뜻은 모르지만 나는 이렇게 이해하고 있다)

태터툴즈의 /tt/tags/태터툴즈 (태터툴즈란 태그가 있는 글목록을 출력하는 url) 이런걸 생각하면 된다.



가장 간단한 방법은 Apache의 mod_rewrite 모듈을 사용하면 된다.
하지만 이 경우는 아파치가 없거나 있어도 mod_rewrite 모듈 사용이 불가능한 걸 가정했다.

확장자가 없는 매핑이라도 특별한 패턴이 있으면 간단하게 할 수 있다. 예를 들면

/board/list
/board/view
/board/write

이런 매핑을 처리하려면 다음처럼 하면 된다.

   <servlet-mapping>
       <servlet-name>lucy</servlet-name>
       <url-pattern>/board/*</url-pattern>
   </servlet-mapping>

하지만

/list
/view
/write

이런걸 매핑하려면?

   <servlet-mapping>
       <servlet-name>lucy</servlet-name>
       <url-pattern>/list</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
       <servlet-name>lucy</servlet-name>
       <url-pattern>/view</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
       <servlet-name>lucy</servlet-name>
       <url-pattern>/write</url-pattern>
   </servlet-mapping>

특별한 패턴이 없는 url이기 때문에 전부다 매핑해 줘야 한다.
이건 세개뿐이니까 그렇지 매번 늘어날 때마다 매핑해 줄수도 없다.
특히 어떤 url로 요청이 들어올지 미리 알 수 없는 경우는 난감하다.
예를 들면 /(username) 했을 경우 해당 사용자의 정보를 보여준다든지 하는 것


아무튼 글의 요점은 확장자가 없는 모든 요청을 dispatcher가 받도록 하고 싶다는 거다.
내가 알기로는... 현재의 servlet-mapping은... 아래와 같은 식이나

   <servlet-mapping>
       <servlet-name>lucy</servlet-name>
       <url-pattern>/*</url-pattern> <!-- 모든 요청을 처리하되 -->
      <url-pattern-exclude>*.*</url-pattern-exclude> <!-- 확장자 '.' 이 들어가면 안돼 -->
  </servlet-mapping>

또는 아래와 같은 형식으로는...

   <servlet-mapping>
       <servlet-name>lucy</servlet-name>
       <url-pattern>^/([^.]*)$</url-pattern> <!-- . 이 포함되지 않은 패턴 -->
  </servlet-mapping>

이렇게는 지원이 안되기 때문에;;; 조금 편법을 써야 했다.


일단 매핑은 아래처럼...

   <servlet-mapping>
       <servlet-name>lucy</servlet-name>
       <url-pattern>/app/*</url-pattern>
  </servlet-mapping>


이렇게 해당 /app/로 시작하는 모든 요청에 대해 처리하도록 한다.


근데 이것도 맘에 안 드는게 확장자 없이 매핑하는건 되지만
url을 항상 /app/로 요청해야 한다.
그다지 의미있는 url은 아닌데 항상 따라다니는 것도 보기 안좋고...


appfuse에서 발견한... urlrewrite filter를 사용한다.
(appfuse에서는 이런 목적으로 쓰진 않았지만...)


https://urlrewrite.dev.java.net/ 에서 urlrewrite filter 3.0 을 받아 lib 폴더에 넣는다.

/WEB-INF/urlrewrite.xml 을 작성


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">

<!-- https://urlrewrite.dev.java.net/manual/3.0 -->

<urlrewrite>

   <rule>
       <note>
           확장자가 없는 요청은 /app/* 요청이다.
           ex) /user/register -> /app/user/register
       </note>
       <from>^/([^.]*)$</from>
       <to type="forward">/app/$1</to>
   </rule>

</urlrewrite>



web.xml 에 url rewrite filter 등록


   <filter>
       <filter-name>urlRewriteFilter</filter-name>
       <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
       <init-param>
           <param-name>logLevel</param-name>
           <param-value>commons</param-value>
       </init-param>
   </filter>


   <filter-mapping>
       <filter-name>urlRewriteFilter</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>


Spring Context XML 파일에서...

   <bean id="userMappings" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
       <property name="mappings">
           <map>
               <entry key="/user/register" value-ref="userRegisterController"/>
               <entry key="/user/login" value-ref="userLoginController"/>
           </map>
       </property>


앞에 /app를 붙여 주지 않아도 된다... 물론 브라우저에서 요청시에도 /app를 안 붙여도 되고...



내가 썼는데도 무슨 말인지 모르겠네...
일단 써두기만 하고 정리는 나중에 -_-;;;

http://steelheart.kr/tc/32

레이어 닫기

이 저작물은 아래 조건 만족 시
별도 허가 없이 사용 가능합니다

  • 저작자 명시 필수
  • 영리적 사용 불가
  • 내용 변경 불가
2010/03/02 21:27 2010/03/02 21:27
Posted
Filed under JSP, JAVA
[원문]http://blog.kfmes.com/137


public static String escape(String string){
       StringBuffer sb = new StringBuffer();
       String ncStr = "*+-./0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
       char c;
       
       for(int i=0;i<string.length();i++){
              c = string.charAt(i);
              if(c>0x7f){
                     sb.append("%u");
                     sb.append(Integer.toHexString((int)c).toUpperCase());
              }
              else if(ncStr.indexOf((int)c)==-1){
                     sb.append('%');
                     if(c<=0xf)
                            sb.append('0');
                     sb.append(Integer.toHexString((int)c).toUpperCase());
              }
              else
                     sb.append(c);
       }
       
       return sb.toString();
}
2010/03/02 20:52 2010/03/02 20:52
Posted
Filed under JSP, JAVA
[원문]http://blog.naver.com/dnms5/50031076855

sp 에서는 get방식이든 post방식이든 한글로된 파라미터 값을 넘겨줄때 그냥 주면 한글이 깨진다.
ajax가 파라미터를 utf-8로 전송하기때문인데 해결방법은

파라미터를 보낼 자바스크립트에서
escape(encodeURIComponent('한글'));
이렇게 인코딩을 하고

요청처리될 액션 페이지에서
URLDecoder.decode(request.getParameter("searchText"), "UTF-8");
이렇게 받으면된다.

2010/03/02 10:07 2010/03/02 10:07
Posted
Filed under Action Script

/* i needed a double click code..   
// looked around the net..   

// couldn't find anything i liked..  

// so created one for all to use..  

*/ 

 

MovieClip.prototype._onDoubleClick = function(func:Function, arg:Object) {  

    var clickInterval:Number = 20;  

   var counter:Number = 0;  

   var lastCounter:Number = 0;  
   var intervalID:Number;  
   this.onPress = function() {  
        if(counter != lastCounter) {  
            if ((counter-lastCounter)<clickInterval) {  

                func(arg);  

                clearInterval(intervalID);  

                counter = 0;  

                lastCounter = 0;  

            }  

        } else {  

            intervalID = setInterval(counterPlus, 10);  

        }  

          

        lastCounter = counter;  

    };  

      

    function counterPlus() {  

        counter++;  

        if(counter>clickInterval) {  

            clearInterval(intervalID);  

            counter = 0;  

            lastCounter = 0;  

        }  

    } 

////////////////use /////////////////////////////

function sampleFunction(str:String):Void {

trace(str);

}

mc._onDoubleClick(sampleFunction, "helloWorld");




2010/02/26 10:52 2010/02/26 10:52