Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 28400 invoked from network); 26 Oct 2006 06:27:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2006 06:27:35 -0000 Received: (qmail 2911 invoked by uid 500); 24 Oct 2006 22:02:17 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 2870 invoked by uid 500); 24 Oct 2006 22:02:17 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 2857 invoked by uid 99); 24 Oct 2006 22:02:17 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Oct 2006 15:02:17 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of andrew.rw.robinson@gmail.com designates 64.233.162.206 as permitted sender) Received: from [64.233.162.206] (HELO nz-out-0102.google.com) (64.233.162.206) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Oct 2006 15:02:03 -0700 Received: by nz-out-0102.google.com with SMTP id z6so778138nzd for ; Tue, 24 Oct 2006 15:01:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sbv5TJzUbf0WB74M7Oarjp1+tK0+LlYKcenr30YYQRddCdjiHM+TceuRtgqjy46fbQp+5Bjg7P69oH/FK+JDrzloAoKZnq3owrdHNpgX4EKhkWkz+/U7TW/9Xs5yifSmkJ5xMQG9KPOhZCSGgotrymYsb7X9XcArirGMfWynDeQ= Received: by 10.35.77.18 with SMTP id e18mr8951120pyl; Tue, 24 Oct 2006 07:32:33 -0700 (PDT) Received: by 10.35.43.20 with HTTP; Tue, 24 Oct 2006 07:32:33 -0700 (PDT) Message-ID: Date: Tue, 24 Oct 2006 08:32:33 -0600 From: "Andrew Robinson" To: "MyFaces Discussion" Subject: Re: how to get the server name inside of a backing bean? In-Reply-To: <453DFB9A.3070509@free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <453DFB9A.3070509@free.fr> X-Virus-Checked: Checked by ClamAV on apache.org I have used relative links in my CSS and javascript to address the issue. Since the CSS URLs are relative to the CSS file, not the page including them, relative should work just fine (as long as you don't move things around) On 10/24/06, Ludovic Robinot wrote: > Andrew Robinson a dit le 10/24/2006 06:50 AM: > > Why not just use a relative link with a leading slash '/'? Without the > > context root, the link would be above the projects, so you can just > > put the context root of the other servlet in the URL. > > > > As for getting the server name, there is no "one" server name, as the > > URL of a web server is not always the name of the computer hosting the > > web site. You can however get the URL of the server that the user > > requested for the current request/response. The HTTP header for this > > is 'SERVER_NAME'. This variable is also accessible through the > > HttpServletRequest.getServerName() variable. > > > > Assuming you are in a servlet environment (looks like you are), you > > would get the variable like so: > > > > ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getServerName() > > > > > > In EL: > > > > #{facesContext.externalContext.request.serverName} > > I have a similar question. How to solve the same problem in external > files like the css files containing url()? > > Do we have to use EL in CSS or javascript files and served them through jsf? > > -- > Ludovic >