Rohit Men

+ Follow
since Aug 30, 2005
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rohit Men

I found something in this regard.

I think I can use something like:-

will this work?. I'll try it tomorrow morning.
If this works then how to get the <bean:message based on beanAttributes.key?

For my code, if the key is name, address or location the coresponding entry in file is :-

17 years ago
Thanks Alan.

I'll use the following code give by you.

I've 2 more things to incorporate with this.
1)There may be 50(or more) input fields. So I think it'll not be a good idea to use something like, FormBeanName.Address, FormBeanName.location in <c:if.... for 50 times. If I can use something generic for my form-bean attributes (name, address,location etc.) that will be great.
(like If I can iterate over the attributes of the form-bean).
2)I'm getting the label for the particular attribute from file. In the current case where we're testing for each attribute of the form-bean, i can get it using <bean:message key=""/> and similarly for other attributes. But If we're using something dynamic like <c:if test="${requestScope.FormBeanName.$attribute. In that scenario how will I use that generic attribute as a key in <bean:message/>.

Hope I made my problems clear. Thanks a lot for helping me out on this.
17 years ago
As far as I know; Yes.
This is sample code from the Dan's mock exam july21-chap17-exam2-question13

The author says that it will print 0 or above. When I run it on windows it don't print anything and waits forever.
Even I think that we can't say for surity that it will print 0.

Please explain.
[ October 01, 2005: Message edited by: Michael Ernest ]
Actually along with the values I want to populate the labels. Like if the user entered Name as marie and Location as texas; so on the result page I want to display only name and location as:-
Name marie
Location texas
I dont want to diplay other labes for which the user didnt entered any values. (like position, employee no. etc.)
If possible can you explain the answer with the help of code as how to access each attribute of Form bean to check ?
17 years ago
Hi Everybody,
I've a general search page where user can input different search criteria.
(for ex. search on name, employee no., location, position etc.)
Its not mandatory to put values in all the input field so some input field may be empty too.(like user may search on name and location only). Now when the user hits the search button; I've to display the search criteria entered by user along with the search results.(say user entered Marie in name and texas in location).
In the result jsp my SearchFormBean(bean used on the search page) will be populated with the name and location.
Now my problem lies in displaying only those values which are present in the bean(name and location). Is there any elegant way to check all the properties of FormBean but displaying only those which are present (or not null).

Thanks in anticipating.
17 years ago
I posted this message in this forum because i thought the people who have just given the exam can guide me on mock tests.
I'm sorry If I've posted it in wrong thread; please suggest.
17 years ago
Hi Folks,
I've read K&B once. Now working on mock exams given at
Just wanted to know that how near these mock exams are to the real exam in terms of pattern and difficulty.
Please suggest the best free mock exam. I've seen a list of all the mock exam and I dont have to go through all of them; so just wanted the best that will serve my purpose well.
Thanks in anticipation.
17 years ago
Please consider the following code:-

class ABC{
public boolean equals(Object o)
return true;
public class HashCodePrint
public static void main(String[] args)
HashCodePrint ore = new HashCodePrint();
ABC ore1 = new ABC();

In the kathy Sierra & Bert book, under hashCode contract Its written:-
"If two objects are equal according to the equals(Object) method, then
calling the hashCode() method on each of the two objects must produce
the same integer result.". Now at 1, it shows that the object are equal. But they produce the different integer values at 3 & 4.
Please explain as I think I'm not able to understand this hashCode.