�T�[�u���b�g�p�X�̍\���v�f���擾�����FJavaTips �`JSP�^�T�[�u���b�g��

» 2004�N07��27�� 10��00�� ���J
[�R�c�ˊ��C��IT]

�@HttpServletRequest�N���X�́A�N���C�A���g���烊�N�G�X�g���ꂽ�p�X�iURL�j�̏����擾���邽�߂ɁA���܂��܂ȃ��\�b�h��p�ӂ��Ă��܂��B���N�G�X�gURL�́A�A�N�Z�X���O���L�^����Ƃ���A�y�[�W�ւ̃A�N�Z�X������Ď�����Ƃ��ȂǁA�ӊO�Ƒ����̗p�r�ŗ��p�ł�����ł��B

���N�G�X�g�p�X�擾�p�̃��\�b�h
���\�b�h �擾�ł���p�X���
getContextPath �R���e�L�X�g�p�X
getServletPath �T�[�u���b�g�p�X
getPathInfo �g���p�X
getPathTranslated �g���p�X�i�����p�X�j
getRequestURL ���N�G�X�g����URL
getRequestURI �R���e�L�X�g�p�X����g���p�X�܂�

�@�ȉ��ł́A�����̃��\�b�h���g���āA���N�G�X�g���ꂽURL����p�X�������o����������‚��Љ�܂��B���N�G�X�g���ꂽURL�́A���Ɂuhttp://localhost:8080/javatips/ServletPath/sample_param/�v�Ƃ��܂��B

out.println(request.getContextPath());
  // /javatips
out.println(request.getServletPath());
  // /ServletPath
out.println(request.getPathInfo());
  // /sample_param/
out.println(request.getPathTranslated());
  // C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\javatips\sample_param
out.println(request.getRequestURL());
  // http://localhost:8080/javatips/ServletPath/sample_param/
out.println(request.getRequestURI());
  // /javatips/ServletPath/sample_param/

�@�ugetContext�{getServletPath�{getPathInfo�v�ŁA�N���C�A���g���烊�N�G�X�g���ꂽ���ۂ�URI���č\�z���邱�Ƃ��ł��܂��B����́AgetRequestURI���\�b�h�̖߂�l�Ɠ����ł��B

�@�v���g�R����z�X�g�����܂߂����S��URL���擾�������ꍇ�́AgetRequestURL���\�b�h���g�p���܂��B�ق��̃��\�b�h�����ׂ�String�^�̖߂�l��Ԃ��̂ɑ΂��AgetRequestURL���\�b�h������StringBuffer�^�̖߂�l��Ԃ��_�ɂ����ڂ��Ă��������B�‚܂�A���N�G�X�gURL����ɂ��āA�V����URL�ɍĕҏW�������ꍇ�ɁAgetRequestURL���\�b�h�͗L���ł��B

�@���N�G�X�gURL���i�g���p�X�����܂߂��j���S�����p�X�Ƃ��Ď擾�������ꍇ�́AgetPathTranslated���\�b�h���g�p���܂��B

�@���ꂼ��̃��\�b�h�Ǝ擾�ł�����̊֌W��}�ɂ������̂��A�ȉ��Ɏ����܂��B

\bhƎ擾ł̊֌W ���\�b�h�Ǝ擾�ł�����̊֌W

Copyright © ITmedia, Inc. All Rights Reserved.

'; this.insertTarget = document.querySelector('#cmsBody .subscription') || document.querySelector('#cmsBody .inner'); }; BodyAdIMSWithCCE.prototype = Object.create(BodyAdContent.prototype); BodyAdIMSWithCCE.prototype.activate = function () { refreshGam('InArtSpecialLink'); } // global reference window.itm = itm; //entry point BodyAdEventBase.polyfill(); const bodyAdManager = BodyAdManager.getInstance(); bodyAdManager.addEventListener(BodyAdManager.EVENTS.READY, function (ev) { bodyAdManager.loadAdvertise(); }); bodyAdManager.init(); })();
�X�|���T�[����̂��m�点PR

���ڂ̃e�[�}

Microsoft  WindowsőO2025
AI for GWjAO
[R[h^m[R[h Zg by IT - ITGWjArWlX̒SŊ􂷂gD
Cloud Native Central by IT - XP[uȔ\͂gD
�V�X�e���J���m�E�n�E �y�����i�r�zPR
���Ȃ��ɂ������߂̋L��PR

RSS�ɂ‚���

�A�C�e�B���f�B�AID�ɂ‚���

���[���}�K�W���o�^

��IT�̃��[���}�K�W���́A �������A���ׂĖ����ł��B���Ѓ��[���}�K�W�������w�ǂ��������B