Link to home
Start Free TrialLog in
Avatar of princehyderabad
princehyderabad

asked on

JSP InputStream Help

hi
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.

plz help
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
actually...thinking about it, I am not sure where the context is set to for jsps...  You may need to move your "stylesheets" directory into WEB-INF/classes