Interview Questions And Answers
Q: - I stored a cookie on the browser; why can't I see it?
First, check to make sure you spelled the cookie name correctly. Next, make sure the browser has cookies enabled. Also, if you specified a root path for the cookie, make sure that the JSP or servlet reading the cookie is in that path. Remember, too, that if you don't give the cookie a specific expiration time, the cookie will vanish when the user shuts the browser down.
Submitted By:- Harpreet Email-ID: - harpreetsingh339@gmail.com
Q: - Why is a new object created whenever I call jsp:useBean?
You probably forgot to specify a scope for the bean. Remember, the default scope for a bean is page, and all beans with page scope disappear when the page finishes executing.
Submitted By:-Harpreet Email-ID: - harpreetsingh339@gmail.com
Q: - When do I use . and when do I use []?
Although you can use these operators interchangeably, it is a good idea to use an operator that indicates the kind of data being accessed. For example, if you are accessing a bean property, use the . operator. If you are accessing a map value or an array index, use the [] operator. There are plenty of times when you break this rule, especially in cases where you want a map to look like it is a bean, you want things to make sense to the next person who reads your code. You may know the types of all the variables, but the next person may not.
Submitted By:-Harpreet Email-ID: - harpreetsingh339@gmail.com
![]() |
|


