Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setAttribute() and getAttribute() problem..

 
padmshree Patil
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In online test Application ,I wanted to add Item Review button.Which display answered and unanswered queastion.I am retriving Status from result database in servlet.Till here it's working fine.Problem is how to send array of string to .jsp file?
1)How to send array of string to .jsp file through
request.setAttribute() method?
2)How to retrive the String[] using getAttribute() mtd?
I tried as
String[] status =(String) request.getAttribute("Status");
But problem is how to convert String to String[]?
Is there any other way I can do it?
thanks
-padmashree
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by padmshree Patil:
1)How to send array of string to .jsp file through
request.setAttribute() method?
2)How to retrive the String[] using getAttribute() mtd?

1) request.setAttribute("questions", questionArray);
2) String[] questionArray = (String[]) request.getAttribute("questions");
I would rather use a bean (or somesuch) to contain my state, though, and bind that.
- Peter

[This message has been edited by Peter den Haan (edited February 12, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic