wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes request.getParameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "request.getParameter" Watch "request.getParameter" New topic
Author

request.getParameter

Jim Shapt
Greenhorn

Joined: Dec 13, 2004
Posts: 10
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

Joined: Jan 10, 2002
Posts: 61299
    
  66

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61299
    
  66

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

Joined: Aug 31, 2004
Posts: 295
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: request.getParameter