2

I'm going crazy with this case. The environment is Jboss-as-7.1.1 under CentOS Linux release 7.0.1406.

This is the code (just the piece to expose my case):

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<link rel="stylesheet" type="text/css" href="<c:url value="/assets/css/styles.css" />" />
<link rel="stylesheet" type="text/css" href="<c:url value="/assets/css/checkbox.css"/>" />

<c:set var="urlImgLoadingGIF"><c:url  value="/img/ajax-loader.gif"/></c:set>
<c:set var="urlImgLoadingGIF2"><c:url value="/assets/css/checkbox.css"/></c:set>

<script type="text/javascript">

var urlImgLoadingGIF  = "${urlImgLoadingGIF}";
var urlImgLoadingGIF2 = "${urlImgLoadingGIF2}";

</script>

And this is the output:

<link rel="stylesheet" type="text/css" href="/assets/css/styles.css;jsessionid=AQvp3fDjrDIOArTZebuDllp1.undefined">
<link rel="stylesheet" type="text/css" href="/assets/css/checkbox.css;jsessionid=AQvp3fDjrDIOArTZebuDllp1.undefined">

<script type="text/javascript">
var urlImgLoadingGIF  = "/seuapb/img/ajax-loader.gif;jsessionid=AQvp3fDjrDIOArTZebuDllp1.undefined";
var urlImgLoadingGIF2 = "/seuapb/assets/css/checkbox.css;jsessionid=AQvp3fDjrDIOArTZebuDllp1.undefined";
</script>

Why in the css link, the c:url tag do not renders the context (/seuapb/) and one line after it does?

I have tomcat in development environment, and this dont happens, the behavior of c:url tag is consistent in all the document.

Thank you in advance.

Andrew_SF
  • 91
  • 2
  • 10

2 Answers2

0

This doesn't specifically answer your question, but the solution to the StackOverflow question linked below is a little more explicit and therefore readable/maintainable,IMHO. It gives you an alternative that solves what you are wanting to do, but doesn't explain why you are having the issue that you are having.

How to use relative paths without including the context root name?

Community
  • 1
  • 1
alfreema
  • 1,308
  • 14
  • 26
0

Finally, after several tests, we conclude that some process (possibly inside apache http server) is modifying some URLS. As the URLs within href and src attributes was not modified, we decided to put some hidden html anchors, with the url we want in the href attribute, and then get it using javascript.

I know it's a very strange case, but if someone 's worth, here's a possible solution.

Obviously we also could check the apache server, but a customer had installed it, and have preferred to adapt our application since the URL's that had this problem were relatively few.

Andrew_SF
  • 91
  • 2
  • 10