从JQuery中的url获取datepicker区域

时间:2013-07-31 12:20:15

标签: javascript jquery datepicker

我有一段来自互联网的JQuery代码:

 $.datepicker.setDefaults($.datepicker.regional["${lang}"]);

                     $("#dateinput").datepicker({
                            dateFormat: "yy-mm-dd",
                            beforeShowDay: beforeShowDayHandler,
                            showOn: 'both',
                            onClose: function (dateText, inst) {
                                $(this).attr("disabled", false);
                            },
                            beforeShow: function (input, inst) {
                                $(this).attr("disabled", true);
                            }

                        });

                        function beforeShowDayHandler(date) {
                            if (self.SelectedDayValue != -1) {
                                if (date.getDate() != 1) {
                                    return [false, '', 'selected'];
                                }
                            }
                            return [true, ''];
                        }

在第一个字符串中,我正在尝试从url字段中获取区域。好像它似乎不起作用?我每次都有英语区域。网址为:http://localhost:8080/web/input?lang=ru。所以我期待得到一个俄罗斯人。有人可以帮我解决这个问题吗?

url defenition中的lang参数:

<beans:bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
             <beans:property name="paramName" value="lang"/>
        </beans:bean>

和JSP页面:

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <spring:message code="label.input.head" var="headTitle"/>
    <title>${headTitle}</title>

    <script type="text/javascript" src="resources/jsFiles/jquery-1.10.2.min.js"></script>

    <script type="text/javascript" src="resources/jsFiles/select2.js"></script>
    <link rel="stylesheet" href="resources/cssFiles/select2.css"/>
    <script type="text/javascript" src="resources/jsFiles/select2_e.js"></script>
    <link rel="stylesheet" href="resources/cssFiles/inputStyle.css"/>

    <script type="text/javascript" src="resources/jsFiles/jquery-ui.js"></script>
    <script type="text/javascript" src="resources/jsFiles/jquery-ui-i18n.js"></script>
    <link rel="stylesheet" href="resources/cssFiles/jquery-ui.css"/>

        <script type="text/javascript">

                 $(document).ready(function() {

                     $.datepicker.setDefaults($.datepicker.regional["${lang}"]);

                     $("#dateinput").datepicker({
                            dateFormat: "yy-mm-dd",
                            beforeShowDay: beforeShowDayHandler,
                            showOn: 'both',
                            onClose: function (dateText, inst) {
                                $(this).attr("disabled", false);
                            },
                            beforeShow: function (input, inst) {
                                $(this).attr("disabled", true);
                            }

                        });

                        function beforeShowDayHandler(date) {
                            if (self.SelectedDayValue != -1) {
                                if (date.getDate() != 1) {
                                    return [false, '', 'selected'];
                                }
                            }
                            return [true, ''];
                        }

                         jQuery(function ($) {
                                console.log($('.widthclass').select2_e().on('change', function () {
                                    alert(this.value);

                                }));
                            });              

                         });
             </script>

</head>


<body>

    <spring:message code="label.input.button" var="save"/>

    <table align="left">
        <tr> <td> Language/Язык/文 : <a href="input?lang=en">English</a>||<a href="input?lang=ru">Русский</a>||<a href="input?lang=cn">中文</a> </td> </tr>
    </table>

    <table align="right">
        <tr> <td> <a href="j_spring_security_logout"> <spring:message code="label.login.logout" /> </a> </td> </tr>
    </table>

    <br/>

    <table align="center">
        <tr><td width="620"> <h3 align="left"><spring:message code="label.input.topLabel"/></h3> </td></tr>
    </table>    

 <form:form modelAttribute="fboiAttributes" action="add" method="post">  

    <table align="center"  style="border-bottom-style:inset; border-top-style: outset;">

    <tr><td align="right"> <form:label path="formDescription.kidsGoSchoolDate"> <spring:message code="label.input.childGoSchoolDate"/> </form:label> </td> <td> <form:input id="dateinput" path="formDescription.kidsGoSchoolDate"/> </td> <td><b><font color="#FF0000"><form:errors path="formDescription.kidsGoSchoolDate"/></font></b></td> </tr>


    <tr><td> <input type="submit" value="${save}"/> </td> <td align="right">  </td> </tr> 

   </table>

 </form:form>

谢谢你们。

0 个答案:

没有答案