• Post Reply Bookmark Topic Watch Topic
  • New Topic

c:import does not support basic authentication

 
Susan Monz
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have a jsp which imports other pages using jstl's <c:import> tag. When we enable basic authentication on the IIS, this page fails to load properly. If we comment out the <c:import> line, then the page loads completely.
Ques: Is there any way to get this to work. 2. Is there any other tag library I can use instead of jstl to import the url on my jsp.

Thanks and regards
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the JSP part of the same web app as the page you're trying to import? If so, then jsp:include would probably be a better choice than c:import: http://stackoverflow.com/questions/14580120/whats-the-difference-between-including-files-with-jsp-include-directive-jsp-in
 
Susan Monz
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right. I wasn't aware that it was wrong to cross-post. I was of course going to post the answer if I got the answer from any of the links. Thanks for letting me know.

Thanks for responding. Yes, the imported jsp is part of the same web app. When I use <jsp:include page="<%=urlString%>" />; I get javax.servlet.ServletException: File "/sm/http:/webapp.net/sm/includes/navigation.jsp" not found.
and the line in jsp.java file is

org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, urlString, out, false);

So I don't know whats wrong with the includes code.

The reason we use c:import is because it supports charEncoding="utf-8"

Thanks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well this looks wrong:
File "/sm/http:/webapp.net/sm/includes/navigation.jsp"

That's neither a file name nor an URL. IIRC, jsp:include takes as parameter a path that's relative to the web app root (or relative to the including JSP? A look at the docs will tell you which one.) It does not make an HTTP request, though, but a direct file include. If the content of that URL is dynamic, you'll have to rewrite it as JSP page (or fragment).
 
Susan Monz
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I modifed my code to <jsp:include page="<%=response.encodeURL(urlString)%>"/> where urlString is relative and the page loads fine. That did it. I will test further because we have internationalization and we are worried about the url coding part.
Will update this post if I come up with anything.

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!