1

I was given a Java web app code to deploy, and my problem is, when I deployed it to my local, it's working fine, but when I deploy it to our dev server, the CSS is all messed up. So I viewed the source of the page and I found out that the JSP Expression Language used in retrieving the context path is not returning any value, so that's why the page can't find the right location of the CSS.

Here's the code to retrieve the context path:

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/common/css/somestyle.css" media="all" />

Here's what I get when I view the page:

<link rel="stylesheet" type="text/css" href="/common/css/somestyle.css" media="all" />

I even tried deploying the EAR file deployed in the dev server to my local and vice versa. The result is the EAR file built in dev works fine in my local and my local ear file build is messed up in the dev server.

I can't figure out what's causing this, the dev server and my local has the same app server (OC4J), code, directory structure and ant script.

Please help. Thanks.

user1174960
  • 83
  • 3
  • 9
  • See http://stackoverflow.com/questions/2168832/expression-language-in-jsp-not-working for some clues – Vijay Agrawal Mar 15 '12 at 22:22
  • Thanks for the link. I've read the comments in that thread, and it says that there are 4 main causes of this problem. So since, it's working on my local, item number 2,3 and 4 are out, that only leaves item number 1. Our dev server runs OC4J 10.1.3.5, and I checked in the oracle docs that it supports JSP 2.0. [link](http://docs.oracle.com/cd/E14101_01/doc.1013/e13978/intro.htm) And in the last part of comment, it says there that there might be a collision of EL Jars, so I checked my library and I don't have any appserver-specific jars in my libraries. I'm still hopelessly stuck... – user1174960 Mar 17 '12 at 01:38
  • did you try executing any other EL in that JSP? is that working? for example : ${header["user-agent"]}. also check your app server logs for any hints – Vijay Agrawal Mar 17 '12 at 03:28

1 Answers1

1

you can try this. it's not solving problem gracefully, but it works for me.

<%
String ctx = request.getContextPath();

%>

<link rel="stylesheet" type="text/css" href="<%=ctx%>/common/css/somestyle.css" media="all" />