JSP InputStream Help
Posted on 2004-08-02
Can anyone help me on XSL transformer path using JSP. I have this JSP
Transformer transformer = tFactory.newTransformer(new StreamSource("../../java/MSquaredWeb/stylesheets/right_live.xsl") );
How can I get rid of only partial path "../../java/MSquaredWeb" which is hardcorded and get dynamic content name.
I was told to use this belwo and get ... but have no idea how to use....
ServletContext context = getServletContext();
InputStream is = context.getResourceAsStream("/stylesheets/<name of your stylesheet>");
Only this should be harded coded "stylesheets/right_live.xsl" and rest should be the content name whatever Tomcat is using.