Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting equivalent java code from jsp code  RSS feed

 
shalaka wadekar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to create a java class from a jsp file code. I am aware of the regular conventions. But I came across a particular line where I am stuck. Its some like this:

someBean.someProduct[item.key].priceTotal

So far what I know is:
someBean is an instance of a bean object and getSomeProduct is a method in it, so I will have someBean.getSomeProducts()
getSomeProducts() returns a map with its keys and values as some objects.

Can anyone help me on how should I write an equivalent java code for the above.

Thanks in advance,
Shalaka


 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
what does item refer to here? Is it a map on which you are iterating in Jsp using forEach?
 
shalaka wadekar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, item refers to a map in jsp.
 
Piyush Joshi
Ranch Hand
Posts: 207
Eclipse IDE Firefox Browser jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you can iterate same way in java, following might help:

 
shalaka wadekar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That works!! Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!