- This topic has 5 replies, 2 voices, and was last updated 20 years, 9 months ago by Riyad Kalla.
-
AuthorPosts
-
Byron MitchellMemberAccording to the IDE, the project path root is sciReportsWeb, any references to anything below this only work if I use this approach in the jsp:
<%
String path = request.getContextPath();
%>then I have to use path in url references like this
<SCRIPT language=”javascript”
src=”<%=path>/sci/sciReports.js”>
</SCRIPT>I have to use this in any include, any url reference, but there are some places where I can’t even get this syntax to work. Problem is, I should not have to do this in the first place. Any references to “./sci/sciReports.js” or “/sci/sciReports.js” or “/sci/sciReports.js” or even “sciReports.js” just don’t work. What is happening?
Riyad KallaMemberI’m not terribly clear on what your question in… getContextPath will return the webapplication path w.r.t. to the application server to you so you can safely reference resources using an absolute path. Also please note that your code:
src="<%=path>/sci/sciReports.js">
is not valid, you are missing a ‘%’ character after the variable ‘path’, i.e.:
src="<%=path%>/sci/sciReports.js">
There is not really any magic going on here, if you are trying to reference a resource using “/sci/sciReports.js”, that means you are requesting from the root of your domain’s URL, in the sci directory, the resource sciReports.js, in Tomcat terms this means the url:
http://localhost:8080/sci/sciReports.jswhich I imagine is invalid since you need to qualify a webapplication name (in your case ‘sciReportsWeb’).
Also note that if you just specify ‘sciReports.js’, that means relative to where you loaded the page from, sciReports.js will be in the same location; which it doesn’t sound like it is either.As a first plan of attack, try and fix the expression tag, and then be more specific with what you are trying to do, the URL you are accessing, the code you are using, and the result you are getting and we can try and help you.
Byron MitchellMemberwouldn’t you know I picked the wrong example, sorry there are a ton of places in my code where it is correctly referenced. I think I will just pass the forward name back to the action class and let struts figure out the url. Thanks.
Riyad KallaMemberI’m still not clear on what the problem was, so lets pretend this never happened 😀
Byron MitchellMemberI will resubmit a new question when this problem resurfaces again. Thanks much!
Riyad KallaMemberOk great, no problem.
-
AuthorPosts