Or you can move that javascript to an actual function, rather than a one-liner in the onclick...

This is what I did:
----------------------------------------------------------
<head>
        <script language="javascript">
        function rollover(obj, filename) {
                path =  "<%=request.getContextPath()%>";
                path = path + filename;
                obj.src = path;
                obj.alt = path;
        }
        </script>
</head>
----------------------------------------------------------
onmouseout="rollover(this, '/pages/images/my_home_button.gif')"
----------------------------------------------------------


for you, this would become something like:
----------------------------------------------------------
<head>
        <script language="javascript">
        function openPage(filePath) {
                String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
                String fullPath = basePath + filePath;
window.open(fullPath, 'secondefenetre', 'width=500,height=500,scrollbars');
        }
        </script>
</head>
----------------------------------------------------------
onclick="openPage('/core/salesforce/dealerList.jsf')"
----------------------------------------------------------

Of course, you can make the others parameters as well, if they are not static.

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Dennis Byrne wrote:
You can either create a request scoped attribute called basePath in the 
scriptlet or use the JSP EL ${pageContext.request.contextPath} in the page.

Dennis Byrne

-----Original Message-----
From: Alexandre Jaquet [mailto:[EMAIL PROTECTED]
Sent: Friday, September 8, 2006 09:15 AM
To: 'MyFaces Discussion'
Subject: current path

Hi,

I'm trying to put the current path in a component with the following code :

<%
   String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<h:commandLink id="lnkDetail" onclick="window.open(<%=basePath%>'/core/salesforce/dealerList.jsf', 'secondefenetre', 'width=500,height=500,scrollbars');">

but basePath is not interpreted html code generated :

a href="#" onclick="window.open(&lt;%=basePath%&gt;'/core/salesforce/dealerList.jsf', 'secondefenetre', 'width=500,height=500,scrollbars')

any idea ?

my best regards








Reply via email to