|
INTERVIEW QUESTIONS
J2EE
JSP
DETAILS
Question: I have a String name & Map m, in my bean class. I have get & set methods on both.
To Display the String name, i do
The above one works fine. Te below one, displays the entire Map contents
I know the KEY, how do i display the VALUE for that KEY
Answer: If you have key with you then :map.get(key) gives you the value of the key in the map.or Map displayMap // lets say you have displayMap as a Map variableSet entrySet = displayMap.entrySet(); for(Iterator iter = entrySet.iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry)iter.next(); String key =(String)entry.getValue(); String value = (String)displayMap.get( entry.getKey()); }
|
|
|
Category |
JSP Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9839 users |
Added on |
7/17/2011 |
Views |
72641 |
Rate it! |
|
|
Question:
I have a String name & Map m, in my bean class. I have get & set methods on both.
To Display the String name, i do
The above one works fine. Te below one, displays the entire Map contents
I know the KEY, how do i display the VALUE for that KEY
Answer:
If you have key with you then :map.get(key) gives you the value of the key in the map.or Map displayMap // lets say you have displayMap as a Map variableSet entrySet = displayMap.entrySet(); for(Iterator iter = entrySet.iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry)iter.next(); String key =(String)entry.getValue(); String value = (String)displayMap.get( entry.getKey()); } Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
what is the use of extends in jsp...we we want to import a class in current jsp file which i am working how can i do that ...if i use extnds for that means how can i do that...pls explain me this
|
View Answer
|
|
How to check the value in the text field is not a number
|
View Answer
|
|
What is the diff. b/n declaring members in and declaraing in jspinit() method ?
|
View Answer
|
|
How to generate BAR & PIE Graphs using JSP code...?
|
View Answer
|
|
When jsp is compiled into servlet, where the servlet is actually stored(storage location)?
|
View Answer
|
|
Why should we setContentType() in servlet ?what is the use of that method?
|
View Answer
|
|
What is the difference between servlet session and jsp session?
|
View Answer
|
|
What is the architecture of JSP?
|
View Answer
|
|
How to call EJB from JSP.
|
View Answer
|
|
Can a single JSP page be considered as a J2EE application?
|
View Answer
|
|
What is JSP?
|
View Answer
|
|
What are advantages of JSP?
|
View Answer
|
|
What is the difference between include directive & jsp:include action?
|
View Answer
|
|
What are Custom tags. Why do you need Custom tags. How do you create Custom tag?
|
View Answer
|
|
What are the implicit objects in JSP & differences between them?
|
View Answer
|
|
What is jsp:use bean. What are the scope attributes & difference between these attributes?
|
View Answer
|
|
What is difference between scriptlet and expression?
|
View Answer
|
|
What is Declaration?
|
View Answer
|
|
How do you connect to the database from JSP?
|
View Answer
|
|
How do you call stored procedures from JSP?
|
View Answer
|