Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getParameter

 
Jim Shapt
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm using a <%=request.getParameter("nameresults")%> and this lists all the names that I asked for. Is there a way to list the names down the page like this? -

RESULTS: Jeff
Becky
Joe
Janice


Instead of like this, look below-


RESULTS: Jeff; Becky; Joe; Janice;



Thanks,

Jim
[ December 14, 2004: Message edited by: Jim Shapt ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to break up the string into its components and then it's a simple matter of using the appropriate HTML markup be it <p>'s <div>'s <br/>'s or tables.
[ December 14, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it is the string parsing that is giving you problems, rather than the HTML markup to achieve your goal, check out the StringTokenizer class, or perhaps the String.split() method. If this is where your problems lie, perhaps this topic would have been better moved to one of the java in general forums (I originally thought it was the markup you were having problems with).

If this is the case, please ask Eric (this forum's bartender) to move the post accordingly.
[ December 15, 2004: Message edited by: Bear Bibeault ]
 
Ramaswamy Srinivasan
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Shapt:
Hello,

<%=request.getParameter("nameresults")%>

RESULTS: Jeff
Becky
Joe
Janice



Hi Jim,

Well...Am I correct in understanding your requirement? You get the
"nameresult" and wish to display items, one after the other.

How about this?

1. Say, you have a table, from which you query for names.
2. The result is returned, with say 5 names.
3. Now, put these names into an ArrayList.
4. Pass the ArrayList as a request parameter to the JSP
5. Get the passed ArrayList and Iterate it.
6. Write the elements of the ArrayList as table data in new rows of
a table.

This would give display, one below the other.

If it would be in a single line, remove all the <tr>s and have a single <tr>, with many <td>s.

Hope it helps you.

Cheers,
Swamy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic