I have try it,but fail,it still can't executerequest.getHeader
("Accept-Language");
thank you all the same,

--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> 
wrote:
> I don't know about the error, but I do know that this won't work:
>    employeeSrv.send();
>    s = employeeSrv.result.locale.country;
> 
> Data Service calls are asynchronous and the result does not exist 
yet
> when you are trying to reference it.
> 
> You MUST use a resultHandler called by the result event.
>       <mx:HTTPService id="employeeSrv" ...
> result="onResult(event)".../>
> 
>       private function onResult(oEvent:Object):Void
>       {
>               sLocale = oEvent.result.locale.country;
>       }
> 
> Tracy
> 
> -----Original Message-----
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of loveewind
> Sent: Sunday, May 08, 2005 5:06 AM
> To: [email protected]
> Subject: [flexcoders] why can not get the value?
> 
> the purpose of my code is to get the client locale with httpservice
> 
> 1.locale.jsp
> 
> <locale>
> <%
> String s = request.getHeader("Accept-Language");
> System.out.print("locale:"+s);
> %>
>   <language><%=s.substring(0,2)%></language>
>   <country><%=s.substring(3,5)%></country>
>    </locale>
> 
> if I visit the locale.jsp,it can display the the client locale
> 
> 2.test.mxml
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; >
>  <mx:HTTPService id="employeeSrv" url="locale.jsp">
>  </mx:HTTPService>
>  <mx:Script>
>  <![CDATA[
>  var s:String;
>    function initApp(){
>    employeeSrv.send();
>    s = employeeSrv.result.locale.country;
>    }
>  ]]>
>  </mx:Script>
>  <mx:Label text="{s}"></mx:Label>
> <mx:Button label="test"   click="initApp();"></mx:Button>
> </mx:Application>
> 
> if I visit the test.mxml,
> it show a error in my server :
> 
> 17:05:12,822 INFO  [STDOUT] locale:null
> 17:05:12,822 WARN  [jbossweb] WARNING: Exception 
for /multi/locale.jsp
> java.lang.NullPointerException
>         at org.apache.jsp.locale_jsp._jspService(locale_jsp.java:48)
>         at org.apache.jasper.runtime.HttpJspBase.service
> (HttpJspBase.java:137)
>         at javax.servlet.http.HttpServlet.service
> (HttpServlet.java:853)
>         at org.apache.jasper.servlet.JspServletWrapper.service
> (JspServletWrapper
> .java:210)
>         at org.apache.jasper.servlet.JspServlet.serviceJspFile
> (JspServlet.java:2
> 95)
>         at org.apache.jasper.servlet.JspServlet.service
> (JspServlet.java:241)
>         at javax.servlet.http.HttpServlet.service
> (HttpServlet.java:853)
>         at org.mortbay.jetty.servlet.ServletHolder.handle
> (ServletHolder.java:360
> )
>         at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch
> (WebApplicati
> onHandler.java:294)
>         at org.mortbay.jetty.servlet.ServletHandler.handle
> (ServletHandler.java:5
> 58)
>         at org.mortbay.http.HttpContext.handle
(HttpContext.java:1714)
>         at org.mortbay.jetty.servlet.WebApplicationContext.handle
> (WebApplication
> Context.java:507)
>         at org.mortbay.http.HttpContext.handle
(HttpContext.java:1664)
>         at org.mortbay.http.HttpServer.service(HttpServer.java:863)
>         at org.jboss.jetty.Jetty.service(Jetty.java:460)
>         at org.mortbay.http.HttpConnection.service
> (HttpConnection.java:775)
>         at org.mortbay.http.HttpConnection.handleNext
> (HttpConnection.java:939)
>         at org.mortbay.http.HttpConnection.handle
> (HttpConnection.java:792)
>         at org.mortbay.http.SocketListener.handleConnection
> (SocketListener.java:
> 201)
>         at org.mortbay.util.ThreadedServer.handle
> (ThreadedServer.java:289)
>         at org.mortbay.util.ThreadPool$PoolThread.run
> (ThreadPool.java:455)
> 
> 17:05:12,822 WARN  [jbossweb] WARNING: Error 500 while serving 
error 
> page for 50
> 0
> 17:05:12,853 ERROR [STDERR] 05/08 17:05:12 ERROR %%500%%
> Internal+Server+Error
> 
> 
> it likes can not execute  request.getHeader("Accept-Language");
> 
> who can tell me the reason?
> 
> thank you!
> 
> 
> 
> 
>  
> Yahoo! Groups Links




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to