anshul gupta

Greenhorn
+ Follow
since Aug 23, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by anshul gupta

hi sir,

congrats!! i also cleared SCJP 1.5. Score was a modest 75%, but since they don't mention it on the certificate... i don't think it's of any use!!
14 years ago
class A {
String s1 = "A.s1"; String s2 = "A.s2";
void t1(){
System.out.println("IN CLASS A");
}
}
class B extends A {
String s1 = "B.s1";
String s2 = "B.s2";
//String s12 = "B.s12";
void t1(){
System.out.println("IN CLASS B");
System.out.print(super.s1);
}
public static void main(String args[]) {
B x = new B(); A y = (A)x;
A z = new B();
System.out.println(x.s1+" "+x.s2+" "+y.s1+" "+y.s2);
System.out.println(z.s1+" "+z.s2);
z.t1();
}
}

output:

this might be silly but please figure out what will be the output of the given code snippet...and please explain it.
thanks in advance.
14 years ago
@ DUSI

in such type of applications care is taken for the options that come under right click menu.e.g 'open link in new tab' or 'new window' is not provided there.
14 years ago
JSF
in that case...when you ask the user to login..u should navigate him to a new page with no standard buttons available in it.this may sound creepy but it's a safer method.since there will be no such buttons like BACK, FORWARD etc. then there is no need to bother about that.
example of this type of login action is this website:
indusind website
click on login and observe the new page that pops up!
14 years ago
JSF
@A Dusi

Thanks a bunch man....it worked fine.
14 years ago
JSF
Hi all,

Well now that I am sure that session is getting invalidated, it has not solved my problem at all.I click back button after logging out and it takes me back to previous page which is not rendered from the server but from the browser cache.I deleted all cookies but that's not helping.
Also someone in the forum told me "to set some Http headers and not to cache the page on the browser and always get it from the server".Can anyone please tell me how to do that!!

Thanks in advance.
14 years ago
JSF
@Sergio Tridente

Thanks for the help.I think i got your point.So now it seems that since session is getting invalidated, then I have to delete cache in the browser.
I think that will do it.I will get back if i am successful!!
14 years ago
JSF
Hi all
Thanks for the answers.
One thing is still occupying my mind and that is: when i do session.invalidate(), does the session's value become null or not??Because i am printing session.toString() and it's giving same value as before session.invalidate().

//code
System.out.println(session.toString()); // value 1
session.invalidate();
System.out.println(session.toString()); // value 1 is also displayed here..why so??

Thanks in advance
14 years ago
JSF
hi,
I am also facing the same problem,i have used session.invalidate() but when i click the back button it navigates back to earlier page.
Check the session value after invalidation.It should be null, but in my case it's not coming null!!
Also if you can post your login code,that would be of great help.
thanks in advance.
14 years ago
JSF
I am new to JSF but i was also thinking of dynamically poplating table...but seems like it's not possible normally.Try using Toplink.It must work with that.
14 years ago
JSF
Hi All,
I have recently started working on JSF and i am using Oracle ADF component libraires.
I am facing little problem with maintaining HttpSession.Although it might be very trivial one but i wod appreciate if i can be helped out on this.
I am using a JSF JSP page for user authentication and there i am creating a HttpSession with following code:
ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest)ectx.getRequest();
HttpSession session = request.getSession(true);

session is created by the code and that's working fine.
for logging out i am using the following code:

ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
HttpSession session = (HttpSession)ectx.getSession(false);
System.out.println(session.toString());
session.invalidate();

Now session does get invalidated but when i click on the "back" button of the browser, it takes me back to the page from where i had logged out.This is one part of problem.Ideally when we have logged out, clicking the back button should display "page cannot be displayed" since page is being rendered by the server, and since session is being invalidated then it shud not take the user back to the page.
Also when we do session.invalidate(), does the session's value become null or not??Because i am printing session.toString() and it's giving same value as before session.invalidate().

Please help me out on this.
14 years ago
JSF