Used to obtain the path to the WEB-INF

2010-09-13  来源:本站原创  分类:Java  人气:385 

/**
         *  Used to obtain the path to WEB-INF
         */
         public static String getAddress(){
                  Class theClass = DatagrabImpl.class;
                  java.net.URL u = theClass.getResource("");
                //str Get the path to the class
                  String str = u.toString();
                // Truncated in some previous six unwanted characters
                  str=str.substring(6,str.length());
                // Will  %20 Swap space  ( If the folder names with spaces, will become the string obtained by  %20)
                  str=str.replaceAll("%20", " ");
                // Find the string "WEB-INF location
                  int num = str.indexOf("WEB-INF");
                // Interception can be
                  str=str.substring(0, num+"WEB-INF".length());
                  return str;
         }
相关文章
  • Used to obtain the path to the WEB-INF 2010-09-13

    /** * Used to obtain the path to WEB-INF */ public static String getAddress(){ Class theClass = DatagrabImpl.class; java.net.URL u = theClass.getResource(""); //str Get the path to the class String str = u.toString(); // Truncated in some previo

  • From plug-in / RCP method to obtain file path 2010-05-07

    Recently in the community who ask this question particularly large, so its use here will be written several ways. If later there are other ways, will be updated. Get the absolute path from the plug-in: AaaaPlugin.getDefault (). GetStateLocation (). M

  • The procedure to obtain the path of mobile devices means 2010-11-03

    Mobile device in a common way to get the path: public string GetFileName() { return System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase),"filename"); } In mobile devices, th

  • Access web.inf file ..... on a static html file in the tomcat access principle analysis ..... 2010-07-28

    Because web-inf, the application server it refers to the prohibition to visit catalog, which is directly in the browser can not access to the. But allowing the servlet to access, such as the web-inf under a.jsp you can use request.getRequestDispatche

  • Flex version of Mp3 player ---- most of the functional version of one, front 2008-10-03

    Use as a holiday to learn the next flex, personal feeling to do something in order to balance the upper Diansha skilled, to coincide with studio to write songs in a program trying to write one himself, rookie work, lot of criticism. The first to prev

  • Jocky code obfuscator is to use a small experience 2011-08-18

    Jocky confuse the compiler is provided in Sun JDK Java compiler (javac), based on the complete, modified the code generation process, the compiler generated intermediate code confusion, and finally generate a class file, to compile and confusion only

  • Path problem learning Java (This article is aimed at web path problem) <switch> 2010-08-13

    Java path problem (paper focuses on web path problem) Recent studies have found the path of Java is a very tangled issue, to find some information online, through research are summarized as follows: Path problem in a very key concept: a slash "/"

  • java: WEB project, JAVA physical path to achieve WEBROOT 2010-03-29

    We know that JSP Servlet access to WEB root path can be request.getContextPath (), relative path request.getSession (). GetServletContext (). GetRealPath ("/") physical path to absolute path These two methods can be used relatively easily gain r

  • java path solution 2009-11-02

    Java path issue, relatively speaking, more complicated. Recent work related to create and read documents, now the actual problems encountered in the use of summarized as follows: The interpretation of a relative path 1. Relative path (that is, vis-à-

  • Struts2 access Web Elements 2010-03-29

    Struts2 access Web Elements There are four ways, but generally the most commonly used is the "inversion of control and dependency injection" thought that the following instructions on the main the most commonly used methods: Struts2 elements can

  • js and jsp pages to obtain access to the source and its application 2010-03-29

    Sometimes we want to know before an address of this page (this page is a link where visitors come's) time, just use the "Access source" approach. javascript for any extension of the pages, but need to talk with other languages (such as JSP, PHP)

  • Flash Point Technology (7)-FileReference path access issues 2010-04-10

    Background on the flash communication problems, we look under the volcano Flash + asp Tutorial: http://bbs.blueidea.com/thread-2701824-1-1.html Turn to the question. In fact this issue, I have been ignored. I came from a Flash MX age people, MX2004 c

  • Summary of Web crawler 2010-08-25

    Reptile Technology Research (2010-01-22 13:03:14) Reprinted Tags: topics for 1 INTRODUCTION Reptile Technology Research With the rapid development of Internet, World Wide Web as the carrier of a lot of information, how to effectively extract and use

  • java in the path handling 2010-09-02

    java in the path handling Transfer: http://www.cnblogs.com/kentyshang/archive/2008/01/21/1047466.html 1. How to get the current file path used: (1). Test.class.getResource ("") Get the current class FileTest.class file URI directory. Not includi

  • C #, the method to get the application path (collection) 2010-11-20

    C #, the method to get the application path (collection) Collection string str1 = Process.GetCurrentProcess (). MainModule.FileName; / / get the currently executing exe file name. string str2 = Environment.CurrentDirectory; / / get and set the curren

  • Collection of Java path problem solutions 2011-05-02

    Java in the path of space problems 1, TestURL (). Class.getResource (""). getPath () or TestURL (). Class.getResource (""). getFile () to obtain the path, can not be FileReader () and FileWriter () directly. Because the URL of the spac

  • java class to get the absolute path of the current 2011-08-03

    Jsp and class files in relative path to call different. In the jsp in the root directory is WebRoot in the class file, the root directory WebRoot / WEB-INF / classes, of course you can use System.getProperty ("user.dir") to obtain the absolute p

  • Shiro - web应用 2014-12-21

    先不谈Spring,首先试着用最简易的方式将Shiro集成到web应用. 即使用一些Servlet ContextListener.Filter.ini这些简单的配置完成与web应用的集成. web.xml: <listener> <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class> </listener> <context-param&g

  • Java path problem 2009-05-25

    Path has met with some questions, It is truly worry about , it is determined to solve this problem. Search online at the following number of data for future use 1: What is the path to clarify URI contains RRL + URN URI: Universal Resource Identifier

  • Through the program to obtain SessionKey code (change) 2010-04-04

    "! - -" Management reminded: "! - -" This quote was gaolei2016 implementation of canceling the essence operations (2009-12-18) "! - -" "! - -" TOP developers who do will certainly encounter the need to access data o