简体   繁体   中英

How to hide request parameter value in url using Spring MVC

I'm working on language changes for my page.when the client clicks on any language, page should load in that particular language. For that I configured springs.xml like this

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

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
    <property name="defaultLocale" value="en" />
</bean>

<bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    <property name="interceptors">
        <ref bean="localeChangeInterceptor" />
    </property>
</bean>

The page was loading fine, when I'm give the url like this, site/companykey?lang=french, Now my problem is , I want to hide the param value which I have given ?lang=french. Is there any way to hide that value from the url ??

locate the form in jsp/html page in which you have included these tags used for changing locale. change the attribute method="POST" . it will make sure that the parameter will pass to the mapped action class without appearing in the url.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM