How to get absolute in servlet

how to get absolute in servlet like c:\temp\apache group\tomcat4.1\test\abc.gif, thanks

do sthing like:
getServletContext().getRealPath("/abc.gif") in any servlet in 'test' to get the real path of abc.gif - The parameter should be relative to the current context

Similar Messages

  • How to get absolute path of a form within the Forms

    Aslam o Alikum (Hi)
    How to get absolute path of a form within the Forms 6i or 9i
    For example
    i am running a from "abc.fmx" from C:\myfolder directory
    can i get the form path 'C:\myfolder' by calling any any function from "abc.fmb"

    There is no direct call that will always work. What you need to do is call get_application_property(current_form). This may have the full path in it, depending on if that path was defined when the form was launched. If there is no path, then you need to use TOOL_ENV.GETVAR to read the Forms<nn>PATH and the ORACLEPATH, parse those out into individual directories and then check for the FMX in each.
    I already have some code to do all this for you see:
    http://www.groundside.com/blog/content/DuncanMills/Oracle+Forms/?permalink=4A389E73AE26506826E9BED9155D2097.txt

  • How to get Absolute Coordinates of a Field.

    I know that the properties "x" and "y" of any field of PDF Form will give me the coordinates relative to the parent object.
    How to get the absolute coordinates of any object (or any field) on a PDF Form?
    My objective is to make a Subform Visible or Hidden and reposition it close to any other field in order to display some extra text to show more info about the required field.
    How I can do that?
    Tarek.

    Hi,
    I wrote a recursive function that will go up in the forms hierarchy and summarizes the x and y coordinates of the parent objects.
    var vX = 0
    var vY = 0;
    function findCoordinates(vNode) {
        if (vNode !== null) {
            if (vNode.className === "field" || vNode.className === "subform") {
                console.println(vNode.name + " > " + vNode.x);
                var xUnit = vNode.x.match(/(mm|cm|pt|in)/g);
                var xValue = parseFloat(vNode.x.replace(xUnit, ""));
                if (xUnit === "mm") {
                    vX += xValue / parseFloat("25.4");
                } else if (xUnit === "cm") {
                    vX += xValue / parseFloat("2.54");
                } else if (xUnit === "pt") {
                    vX += xValue / 72;
                } else {
                    vX += xValue;
                var yUnit = vNode.y.match(/(mm|cm|pt|in)/g);
                var yValue = parseFloat(vNode.y.replace(yUnit, ""));
                if (yUnit === "mm") {
                    vY += yValue / parseFloat("25.4");
                } else if (yUnit === "cm") {
                    vY += yValue / parseFloat("2.54");
                } else if (yUnit === "pt") {
                    vY += yValue / 72;
                } else {
                    vY += yValue;
            findCoordinates(vNode.parent);
        var vCoordinates = (Math.round(vX * 2) / 2) + "mm " + (Math.round(vY * 2) / 2) + "mm";
        return vCoordinates;
    Textfeld2.rawValue = findCoordinates(xfa.resolveNode("Teilformular1.Teilformular2.Textfeld1"));

  • How to get absolute path of current directory?

    Hi, everyone!
    I want to get the absolute path of current directory.
    Are there some APIs that I can use?
    Thanks in advance,
    George

    Hi, dheeraj_tak buddie!
    What do you mean in your reply?
    "in File class u have all this methods for getting absolute path "regards,
    George

  • How to get SSLSession in Servlet?

    Hello,
    Is there any new way to get a SSLSession object inside Servlet?
    Why javax.net.ssl.session attribute is no longer available since Servlet 2.1 specification?
    See:
    http://java.sun.com/products/servlet/2.1/api/javax.servlet.ServletRequest.html#getAttribute(javax.servlet.String)
    Thank you.

    I agree with you, but the question is still remind - how can I destroy Application Session so that transport level (SSL) session will be destroyed also?
    The problem is that I need to force the browser to check user certificate which is stored on the smart card.

  • How to get SlingScriptHelper in servlet?

    I need to get a SlingScriptHelper instance from within my servlet. Either a ComponentContext or BundleContext will do as well, as my only goal is to get sling services using it.
    Using SCR @Reference injection is not a solution for me, because I will determine at runtime what service class I need to get.
    I've seen posts online that use an activate() method to get ComponentContext, and also decompiled some class that do it, but don't know how to cause sling to call this method and set my ComponentContext
    I've tried pulling it from the Request scope as an attribute, but sling apparently only puts it there for scripts, not servlets.
    I've tried injecting all of these objects themselves - none can be injected.
    Any help? I'm hoping there's some static factory I can just hit and get one of these objects so that I can get services...

    I think there's some confusion here, probably because there are two different types of servlets used in Sling. The first, and far more common, is servlets which are registered as OSGi services. For these, there is no SlingBindings object available because these aren't scripts. They are, however, OSGi services, so by definition you have access to the BundleContext. If you're using DS, it is available via the ComponentContext passed to the component's activate() method. From this BundleContext, you can look up whatever services you want with filters, etc.
    The second type is when Java is used as a scripting language. In this case, the SlingBindings object is available as a request attribute. You can also have the SlingScriptHelper object injected into these services using @Inject. See https://issues.apache.org/jira/browse/SLING-2237.
    In neither case should FrameworkUtil be used.
    If there are cases where Java is used as a scripting language AND SlingBindings isn't available as a request object, please file bugs about those cases with steps to reproduce.
    It sounds like the biggest confusion is that there's a perception that DS components can only have service references injected into them. This is completely wrong. While injection is preferable, it is by no means required.

  • How to get absolute directory path of a resource?

    Hi,
      I wished to retrieve the absolute directory path of a resource, for example, "demo.test" in the folder of "/document/personal". How to I get the value "/document/personal", is there any IPropertyName i could use?
    Thanks for any suggestions.

    Hi,
    first, the accessRID is the RID which was used at creation time, maybe containing links; these are resolved, so you will get the "physical" place where the file is stored by <i>getRID</i>.
    Second, to determine the path without the name of the file, there are at least three possibilities without looping (resource, the file, is an instance of IResource):
    1.) String path = resource.getParentCollection().getRID().toString();
    2.) String path = resource.getRID().toString().substring(0, resource.getRID()().toString().lastIndexOf('/'));
    3.) String path = resource.getRID()().toString().substring(0, resource.getRID()().toString().length() - resource.getName().length());
    Solution 1 seems to be very intuitive (you ask for the folder path, where the file is in), 2 & 3 are shorter than a loop, but not intuitive and in general dangerous (when using substring, you have to take care of exceptions caused by strange parameters).
    Hope it helps
    Detlev

  • How to get absolute File Path using JFileChooser?

    Hi,
    IS there any way by which we can get the absolute file path ? e.g. If I browse thro JFileUser and Selects "a.txt" and say open, it should return me the complete file
    path e.g. D:/abc/a.txt.
    Present method.fileChooser.getSelectedFile().getName() return the name of the file i.e. a.txt and NOT the complete path.
    Pls Help !!

    fileChooser.getSelectedFile().getAbsolutePath(); will do the trick.

  • How to get absolute screen position for component in borderlayout?

    I am trying to get the screen location for a point in a component in a panel. The panel has a borderlayout(). The component is currently in the CENTER position of the layout. When I use the getBounds() method for this component I can get the <x,y> coordinates relative to the client area of the panel. But that does not include the frame. I
    Does anyone know how I can do this?

    There is a convertPointToScreen method in SwingUtilities:
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/SwingUtilities.html

  • How to get support for servlets?

    Hello, I've been successful at creating applets and applications. Now I want to play with servlets. I use jpadpro IDE, and when I compile a sample servlet, it says javax.servlet.* does not exist. So I fetched j2sdkee131 which I guess contains servlet support. When I tell my IDE to use j2sdkee131, it doesn't work because this doesn't contain the compiler ie javac. Anyone know what I need to do to be able to compile a simple servlet? Thanks.

    you need servlet.jar which comes with tomcat...I also think it is included in J2EE JDK

  • Getting Absolute timestamps from FPGA 7831R

    I am using a LIN card in my PXI Chassis. This is not an NI product and it cannot access any triggering lines. The device itself returns an array of timestamped measurements but the problem is that the are relative timestamps. I need to have an absolute timestamp so that I can compare timing with other DAQ devices. The only way I can access this is by using a 5V trigger output line. I can set this to trigger on each identifier.
    My problem is how to acquire an absolute timestamp. I would not need to get one very often. once every few seconds would be sufficient at worst case.
    I have used an M series card analog input which can be triggered and this has given good results.
    But I have to use this card for other measurements at the same time so I cannot normally use it as I wish.
    The only other option that I have is an FPGA card. RIO 7831R.
    Does anyone know how to get absolute timestamps from such a card without having to connect it to any other card?
    This would be a great help. 
    Thanks in advance
    Jimmy

    Hi Jimmy,
    You can make product suggestions using links on the following web page:
    http://digital.ni.com/public.nsf/websearch/EDA7C01C684ACB6286256FF0000238D5?OpenDocument
    I'm not sure there is anything else we can do to help you - the only other alternative would be to use the FPGA board to monitor this trigger line, and when it sees a trigger fires an IRQ to the host program which is waiting on this - and then at this point get the current time in software.
    I'm not sure that there is a more accurate way of getting this timing information, as it seems its just a limitation of this LIN card that you have.
    Regards
    Hannah
    NIUK & Ireland

  • Getting absolute file name using af:inputFile

    Hi all,
    Can you help me how to get absolute file name (e.g., C:\Documents\file.txt) using <af:inputFile> component or using any another JSF component.
    Thanks in advance :)))

    we can't get absolute path using inputFile, we can get only the file name. as per my knowledge we don't have any other component also.
    i have one of my requirement i need to read file from specified folder, so i have hard coded my folder name in my managed bean.

  • How to get the current executing file/itself absolute directory?

    hellooo,
              gentlemen/lady, how to get the current executing file/itself absolute directory?
              thanks
              

              Hello,
              you can get the real path information of the JSP through the servlet context:
              http://java.sun.com/products/servlet/2.2/javadoc/index.html
              javax.servlet
              Interface ServletContext
              Method getRealPath
              Christian Plenagl
              Developer Relations Engineer
              BEA Support
              [email protected] (alex mok) wrote:
              >hellooo,
              >
              >gentlemen/lady, how to get the current executing file/itself absolute
              >directory?
              >
              >thanks
              

  • How to get an ArrayList Object in servlet from JSP?

    How to get an ArrayList Object in servlet from JSP?
    hi all
    please give the solution for this without using session and application...
    In test1.jsp file
    i am setting values for my setter methods using <jsp:usebean> <jsp:setproperty> tags as shown below.
    After that i am adding the usebean object to array list, then using request.setAttribute("arraylist object")
    ---------Code----------
    <jsp:useBean id="payment" class="com.common.PaymentHandler" scope="request" />
    <jsp:setProperty name="payment" property="strCreditCardNo" param="creditCardNumber" />
    <%-- <jsp:setProperty name="payment" property="iCsc" param="securityCode" /> --%>
    <jsp:setProperty name="payment" property="strDate" param="expirationDate" />
    <jsp:setProperty name="payment" property="strCardType" param="creditCardType" />
    <%--<jsp:setProperty name="payment" property="cDeactivate" param="deactivateBox" />
    <jsp:setProperty name="payment" property="fAmount" param="depositAmt" />
    <jsp:setProperty name="payment" property="fAmount" param="totalAmtDue" /> --%>
    <jsp:useBean id="lis" class="java.util.ArrayList" scope="request">
    <%
    lis.add(payment);
    %>
    </jsp:useBean>
    <%
    request.setAttribute("lis1",lis);
    %>
    -----------Code in JSP-----------------
    In testServlet.java
    i tried to get the arraylist object in servlet using request.getAttribute
    But I unable to get that arrayObject in servlet.....
    So if any one help me out in this, it will be very helpfull to me..
    Thanks in Advance
    Edward

    Hi,
    Im also facing the similar problen
    pls anybody help..
    thax in advance....
    Litty

  • How to get javabean data in Servlets.( JavaBean -- Servlet(Controller)

    how to get javabean data in Servlets.
    1) I am using name ,password in Jsp(View )
    2) when I submit this Bean will be called and Setter methods will be called .
    3) In ServletController (controller) I want to get data of javabean.
    In this I have to do validation of user.
    I want to pass the javabean obj as like -->
    request.getAttribute("beanObj");
    My intention is to get all the poperties in javabean by passing bean id
    or beanobj ,
    Is there any way to get all the data using bean id or beanObj.
    Plz Reply,

    Now in the Servlet we can get the same bean by this code:
    PageContext pageContext = JspFactoryImpl.getDefaultFactory().getPageContext(this, request, response, null, true, 8192, true);
    UserBean userbean = (UserBean)pageContext.getAttribute("userbean", PageContext.SESSION_SCOPE);
    String userid = userbean.getUsername();
    For this code to work it is needed to import 2 files:
    import org.apache.jasper.runtime.JspFactoryImpl;
    import javax.servlet.jsp.PageContext;
    The JspFactoryImpl is in jasper-runtime.jar file provided in tomcat dir.It seems to me that you are exactly knowing what you are doing :-(
    You can get a Bean stored in a Session by
    request.getSession().getAttribute("userbean");
    In the login.jsp page for example we have the code
    <jsp:useBean id="userbean" scope="session"class="com.newproj.UserBean" />
    <jsp:setProperty name="userbean" property="*" />the jsp:setProperty is not called when you click on the submit button
    if fills the bean with the request values from the previous request.
    andi

Maybe you are looking for

  • Open links in same window, not new

    Help greatly appreciated! My links open in a new window, but I need them to open in the same window. What do I need to add to my code so that this happens. Here is my code- stop(); var arrLinks:Array = new Array(); arrLinks[1] = ' http://www.diesel-e

  • Help! Did IOS5 upgrade on my iPod Touch and my music no longer plays...

    It's visible, though it's only visible in a faded grey text now.  Can view all my albums correctly, but the songs are greyed out.  I've resynced repeatedly, and this does not resolve my problem.   Any help would be greatly appreciated.

  • N80 Firmware Upgrade

    Hey, I have had an N80 for nearly a year now, and last night when I was attempting to back up my phone it seems to have gone a bit mad. Every now and again a Message flashes up saying MESSAGE: SUPPORT NOT FEATURED This is when going into Text message

  • Icon for hp smart web printing has disappeared. Have rt clicked on tool bar. Customize. not there

    Icon for hp web smart printing has disappeared in firefox. It does appear in IE but I use firefox most of the time. I rt clicked in upper right and chose customize. Icon is not there.

  • PC Suite doesn't show contacts stored in SIM card ...

    I own a Nokia 6230i v. 03.88 RM-72, and am using PC Suite 6.84.10.4 on Windows XP SP2. I found out that: 1. PC Suite doesn't show in the Contacts folder those which are recorded in the SIM card, but only those from the phone memory. Why's that? 2. PC