vendredi 8 mai 2015

strtus2 I18N application using radio buttons

I'm trying to change the language using radio buttons but it is not working. Here is the code which I have tried

settings.jsp:

<div>
    <s:iterator value="languages">
        <span class="languages"> <s:radio list="#{Value:Name }"
            id="language" name="request_locale"
            onclick="changeLanguage(this.value)" value="%{language}" />
        </span>
    </s:iterator>
</div>

script:

function changeLanguage(locale) {
//      alert(locale);
         $.ajax({
            async: false,
            url: '../login/userProfile_changeLanguage.action?language='+locale,
            success: function(data, status, xhr) {
                if(xhr.getResponseHeader('sessionStatus') == 701){
                    window.location.href = window.location.pathname.substring(0,window.location.pathname.substring(1).indexOf("/")+1);
                }
                else{
                    $('#main').html(data);
                }
            }
        }); 
    } 

enter image description here

where I went wrong?

Aucun commentaire:

Enregistrer un commentaire