I can’t see the problem in portal.jsp. Did you put a trace statement in your initLocale() method to make sure it’s executing?  The only difference I saw between the two jsps was the portal stuff and the table, I don’t think that would make a difference but who knows.  I assume the println is writing the expected value?

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of loveewind
Sent: Tuesday, May 10, 2005 1:52 AM
To: [email protected]
Subject: [flexcoders] why can not pass arguments to flex in portal jsp page

 


if I run this locale.jsp

mx.controls.Alert.show(language); can show the language value

1.locale.jsp

<%@ taglib uri="FlexTagLib" prefix="mm" %>
<mm:mxml>

<%
String s =request.getHeader("Accept-Language");
System.out.println("locale:"+s);
String l = s.substring(0,2);
String c = s.substring(3,5);
%>
<mx:Application pageTitle="Resource bundles sample application"
      xmlns:mx="http://www.macromedia.com/2003/mxml"
      xmlns:view="com.benorama.flex.samples.payment.view.*"
      xmlns:globalization="com.benorama.flex.globalization.*" 
initialize="initLocale()" >
      <mx:Script>
      <![CDATA[
      var language:String;
      var country:String;
      function initLocale(){
      language = "<%=l%>";
      country = "<%=c%>";
      mx.controls.Alert.show(language);
      resourceBundleDelegate.setLocale(language,country);
      }
      ]]>
      </mx:Script>
           
      <view:PaymentView />
     
      <globalization:ResourceBundleDelegate
id="resourceBundleDelegate" />
     
</mx:Application>

</mm:mxml>

2.portal.jsp

<%@ page session="false" contentType="text/html" import="java.util.*,
multilanguage.*"%>
<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %>
<%@ taglib uri="FlexTagLib" prefix="mm" %>

<portletAPI:init/>
<table border="0" cellspacing="0" cellpadding="0" height="100%"
width="100%">
<tr height="500">
   <td>


<mm:mxml>

<%
String s =request.getHeader("Accept-Language");
System.out.println("locale:"+s);
String l = s.substring(0,2);
String c = s.substring(3,5);
%>
<mx:Application pageTitle="Resource bundles sample application"
      xmlns:mx="http://www.macromedia.com/2003/mxml"
      xmlns:view="com.benorama.flex.samples.payment.view.*"
      xmlns:globalization="com.benorama.flex.globalization.*" 
initialize="initLocale()" >
      <mx:Script>
      <![CDATA[
      var language:String;
      var country:String;
      function initLocale(){
      language = "<%=l%>";
      country = "<%=c%>";
      mx.controls.Alert.show(language);
      resourceBundleDelegate.setLocale(language,country);
      }
      ]]>
      </mx:Script>
           
      <view:PaymentView />
     
      <globalization:ResourceBundleDelegate
id="resourceBundleDelegate" />
     
</mx:Application>

</mm:mxml>



  </td>
</tr>
</table>




if I run this locale.jsp
it have not pop alert, not execute the code:
  mx.controls.Alert.show(language)


who hase these experience,can tell me the reason,

thanks









Yahoo! Groups Links

Reply via email to