File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes non-whitespace whitespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "non-whitespace whitespace" Watch "non-whitespace whitespace" New topic
Author

non-whitespace whitespace

Craig Ricciuto
Greenhorn

Joined: Nov 05, 2009
Posts: 9
The title might be confusing but here's my situation.

I have an ArrayList of String values being set in my action class and then in my JSP I iterate over that list outputting a checkbox and a textfield. All the checkboxes share a name (so their values end up in a list) and all of the textfields also share a name (a different name than from the checkboxes though) whose values end up in a list too.

The list for the checkboxes ONLY includes the selected checkboxes. That's fine. That's what I expect.
My problem is that the list for text fields has an element for EVERY text field (blank fields and filled in fields). This is a problem because my two lists don't match up. One list (the textbox list) is always bigger than the other list (the checkbox list).

I tried looping over the textbox list and doing a check for a space via:
but that didn't work. I tried using the String's trim() method...that didn't get rid of the whitespace so I could just check for a blank String.

So I either need to know what character it is that the textbox returning so I can do a check for that character and just remove it from my list OR find a way to not have blank textboxes get submitted and stored in the list in the first place...or a third option I have not considered.

Thanks for any help.
Craig Ricciuto
Greenhorn

Joined: Nov 05, 2009
Posts: 9
Nevermind. I figured out a way I could fix my problem. With a little javascript I just made the textboxes get enabled when it's corresponding checkbox is clicked. Any disabled textbox isn't passed into the list. I set all textboxes to be disabled by default.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: non-whitespace whitespace