• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to access Map contents in jsp page  RSS feed

 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have stored the contents of database table in map. & now i want to access this contents of map in
jsp page.

How should i access.
Please help me.

Thanks,
Rupa.
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rupa,

I hope you are using EL in your JSP pages. You can access a map like this:

or
When you use the mapName.key format make sure your key name is a valid java identifier.
For example, if you have User-Agent in your request header, you can not access it using because it takes '-' as the minus operator.
Please let me know if you have any difficulty.
HTH,
Teena
 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Teena George wrote:Hi Rupa,

I hope you are using EL in your JSP pages. You can access a map like this:

or
When you use the mapName.key format make sure your key name is a valid java identifier.
For example, if you have User-Agent in your request header, you can not access it using because it takes '-' as the minus operator.
Please let me know if you have any difficulty.
HTH,
Teena


Hi Teena,
Thanks for your response.
Actually I am not using EL, can you please help me some more regarding using EL.

Thanks,
Rupa.
 
Swastik Dey
Rancher
Posts: 1805
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this might be helpful

http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You can also grab a Head First Servlets and JSP book. It will give you clear idea of EL (and many other topics).
 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rupa Katkar wrote:
Teena George wrote:Hi Rupa,

I hope you are using EL in your JSP pages. You can access a map like this:

or
When you use the mapName.key format make sure your key name is a valid java identifier.
For example, if you have User-Agent in your request header, you can not access it using because it takes '-' as the minus operator.
Please let me know if you have any difficulty.
HTH,
Teena


Hi Teena,
Thanks for your response.
Actually I am not using EL, can you please help me some more regarding using EL.

Thanks,
Rupa.



Hi Teena ,

Actually this is my code snippet, where i am using
map..


mean here i am storing object of Batch_B60 class i.e. "b" to the map.
& now how should i access the contents of this map in jsp.

Thanks,
Rupa.
 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rupa Katkar wrote:
Rupa Katkar wrote:
Teena George wrote:Hi Rupa,

I hope you are using EL in your JSP pages. You can access a map like this:

or
When you use the mapName.key format make sure your key name is a valid java identifier.
For example, if you have User-Agent in your request header, you can not access it using because it takes '-' as the minus operator.
Please let me know if you have any difficulty.
HTH,
Teena


Hi Teena,
Thanks for your response.
Actually I am not using EL, can you please help me some more regarding using EL.

Thanks,
Rupa.



Hi Teena ,

Actually this is my code snippet, where i am using
map..


mean here i am storing object of Batch_B60 class i.e. "b" to the map.
& now how should i access the contents of this map in jsp.

Thanks,
Rupa.



Hi all,
pl. give me reply.
 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Teena George wrote:Hi Rupa,

I hope you are using EL in your JSP pages. You can access a map like this:

or
When you use the mapName.key format make sure your key name is a valid java identifier.
For example, if you have User-Agent in your request header, you can not access it using because it takes '-' as the minus operator.
Please let me know if you have any difficulty.
HTH,
Teena


Hi ,

i am facing problem in passing the Map to jsp page,
how should i forward the map to jsp page.
& then how should i access it using EL.
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi Rupa,

Sorry for the delayed response. I was caught up with some work. I hope you have already cracked it But, even if you haven't, here is how i tried it.



Please let me know if this is not working for you.
Best Regards,
Teena
 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Teena George wrote:

Hi Rupa,

Sorry for the delayed response. I was caught up with some work. I hope you have already cracked it But, even if you haven't, here is how i tried it.



Please let me know if this is not working for you.
Best Regards,
Teena


Hi Teena,
Actually i am not using bean & i am not knowing beans.
in my servlet program i am having this code.


in CompareFiles class



in the above code i am using two maps.
Now i am not getting how to pass this maps to jsp page.

I tried a lot , but i am not getting it.
Pl. help me teena.
Thanks in advance.
Rupa.
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to return "hm_b60" this object from your check method or have to pass it in check() method.

After this use the following code - assuming you will return the map from check method

and in your jsp take this attribute from request and then iterate the map as


As a suggestion, we should use EL for Jsps. I am not sure why are you using this old way of writing a JSP.

Hope this helps. Let me know if you still stuck.


Regards
Patricia
 
Rupa Katkar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Patricia Samuel wrote:You have to return "hm_b60" this object from your check method or have to pass it in check() method.

After this use the following code - assuming you will return the map from check method

and in your jsp take this attribute from request and then iterate the map as


As a suggestion, we should use EL for Jsps. I am not sure why are you using this old way of writing a JSP.

Hope this helps. Let me know if you still stuck.


Regards
Patricia

Hi,
Actually i want to use EL only, but if you observed my prev. code, i am not getting that how should i pass the map to jsp page,
As i am calling the function in CompareFiles.java file, i am not getting how should i pass this map to jsp.
Pl. give me reply earliest possible.
Thanks,
Rupa.
 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't this line help -



and you can access this attribute with the help of request parameter in JSP.


Please let me know if you face any problem using it.
 
Praneeth Thiruveedhula
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How to access map contents in the jsp..?

test.jsp


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!