Skip to main content

Reading Cookies

tip

If a cookie stores a group of values with the same name, use @CookieParameter("values") String[] vars to read them.

Use the @CookieParameter annotation to read cookie data. Its usage is the same as @RequestParameter:

@MappingTo("/helloAction.do")
public class HelloAction {
@Any
public void execute(@CookieParameter("name") String userName,
@CookieParameter("pwd") String pwd) {
...
}
}