getting the current dir path with getRealPath.

V

Vidya

I am hoping that I posted this message in the right newsgroup. I am a
new java developer. Below is the jsp code that I am using, Can
anyone tell me why it wouldn't work on our clients server which is
weblogic 6, using jdk 131. It works on our server which has weblogic
8.1 with jdk 142. Please Advice.

All the lines below gives me null on clients server:
translated path :
<% out.print(request.getPathTranslated()); %><br>
Real Path:
<%= application.getRealPath(request.getRequestURI())%><br>
path:
<%=application.getRealPath("/") %><br>

When I add the code below, I get Internal server error :
<%
ServletConfig scg = getServletConfig();
out.println( "scg="+scg+ "<br>" );
ServletContext sct = scg.getServletContext();
out.println( "sct="+sct + "<br>");
String s = sct.getRealPath( "xslt/map_search.xsl" );
out.println( "path4="+s+ "<br>" );
File f = new File(s);
out.println( f+ "<br>" );
%>

Below is the exact code that I am using for big picture. Any advice is
greatly appreciated.

<%@ page import="java.net.*,java.io.*,java.util.*" %>
<%@ page import="javax.xml.parsers.*" %>
<%@ page import="javax.xml.transform.*" %>
<%@ page import="javax.xml.transform.dom.*" %>
<%@ page import="javax.xml.transform.stream.*" %>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="org.xml.sax.*" %>
<%@ page import="org.xml.sax.SAXException" %>
<%@ page import="org.xml.sax.SAXParseException" %>
<%@ page import="weblogic.apache.xml.utils.SAXSourceLocator" %>
<%@ page import="weblogic.apache.xml.utils.WrappedRuntimeException" %>
<%@ page import=" javax.servlet.ServletContext" %>
<%@ page import="javax.servlet.http.HttpServlet" %>
<%@ page import="javax.servlet.GenericServlet" %>
<%@ page import="javax.servlet.ServletConfig" %>
<%@ page import="javax.servlet.ServletException" %>
<%@ page import="javax.servlet.RequestDispatcher" %>
<%@ page import=" javax.servlet.ServletContext" %>
<%@ page import="javax.servlet.ServletContextEvent" %>


<%@ page import="com.genentech.util.Advantage" %>
<%
String xsltloc = application.getRealPath("/") +"/xslt/" ;
out.println("<br>request.getRealPath("+ request.getServletPath() + ") =
" +
request.getRealPath(request.getServletPath()) + "<br>");
%>
translated path :
<% out.print(request.getPathTranslated()); %><br>
Real Path:
<%= application.getRealPath(request.getRequestURI())%> <br>
path:
<%=application.getRealPath("/") %><br>
path2 :
<%=xsltloc%><br>
<%
ServletConfig scg = getServletConfig();
out.println( "scg="+scg+ "<br>" );
ServletContext sct = scg.getServletContext();
out.println( "sct="+sct + "<br>");
String s = sct.getRealPath( "xslt/map_search.xsl" );
out.println( "path4="+s+ "<br>" );
File f = new File(s);
out.println( f+ "<br>" );
%>
Any advice will be greatly apreciated.
Thanks,
Vidya.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top