user2753537
user2753537

Reputation: 77

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 ??

Upvotes: 1

Views: 8259

Answers (1)

VijayD
VijayD

Reputation: 820

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.

Upvotes: 3

Related Questions