Linuxmania
20th November 2011, 12:53 AM
Tolongin ane gan, ane lagi buat program login sama logout. tapi pada saat ane mau logout kog cookie yang ada di applikasi ane kog gak hilang ya..., tapi klo di firefox cookie y udah hilang, berikut potongan source codenya
Code:
public Resolution logout() {
if (getMyCookie() != null) {
getMyCookie().setMaxAge(0);
getContext().getResponse().addCookie(getMyCookie() );
System.out.println(getMyCookie().getName());
}
return new ForwardResolution("/login.jsp?msg=You has logout");
}
<div style="margin:20px; margin-top:5px">
Code:
public Cookie getMyCookie() {
if (context.getRequest().getCookies() != null) {
Cookie[] cookies = context.getRequest().getCookies();
for (int i=0; i
Code:
public Resolution logout() {
if (getMyCookie() != null) {
getMyCookie().setMaxAge(0);
getContext().getResponse().addCookie(getMyCookie() );
System.out.println(getMyCookie().getName());
}
return new ForwardResolution("/login.jsp?msg=You has logout");
}
<div style="margin:20px; margin-top:5px">
Code:
public Cookie getMyCookie() {
if (context.getRequest().getCookies() != null) {
Cookie[] cookies = context.getRequest().getCookies();
for (int i=0; i