Meaningless Drivel is fun!*
The moose likes JSP and the fly likes Submitting only selected textboxes in a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Submitting only selected textboxes in a JSP" Watch "Submitting only selected textboxes in a JSP" New topic
Author

Submitting only selected textboxes in a JSP

Alexey Timokhin
Greenhorn

Joined: Mar 23, 2012
Posts: 25
WDG wrote:
When a form is submitted, the current value of each INPUT element within the FORM is sent to the server as name/value pairs. The INPUT element's NAME attribute provides the name used. The value sent depends on the type of form control and on the user's input.

Source: Input - Form Input

Sorry for double post.

However, my point stands. If it sent as a pair to the server, shouldn't there be a way to iterate through all those pairs, retrieving both name and value?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

As I already said, yes there is. And that's what you need to do if you don't know what the names are in advance. Where did I say that that cannot be done?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alexey Timokhin
Greenhorn

Joined: Mar 23, 2012
Posts: 25
Oh... Well, if you knew it could be done, wouldn't it be easier and much more efficient just to provide the line of code that does that so I can use it?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Actually, no. It'd be more instructive for you to look at the javadoc for HttpServletRequest and see what you can find.
Alexey Timokhin
Greenhorn

Joined: Mar 23, 2012
Posts: 25
I don't mean to be rude, but that's kind of a weird way to help, don't you think? If I want to learn how to use arrays in Java, you would make me search through the whole .util package?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Not at all. It's the perfect way to help you learn how to use the javadocs to answer such questions yourself. Learning to use the javadocs is one of the most important Java skills that you need to know. And in the time that you've spent balking about using the javadocs, you could have had your answer.

JavaRanch isn't a code mill or an answer mill. When something is easy to look up for yourself, you should not be surprised to be told "look it up".
Alexey Timokhin
Greenhorn

Joined: Mar 23, 2012
Posts: 25
I would look it up if I knew what I was looking for.

In my opinion, people use forums to ask questions that weren't answered to them by Google. The Javadoc didn't provide me with information I needed because I don't even know what I'm suppose to be looking out for.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Not to be snarky, but that's just proof that this is a skill that you need to hone.

Here are some clues to make it easier:
  • Obviously you're looking for parameter information, so I'd pay close attention to any method with "parameter" in its name.
  • Don't forget to look at the methods from the superclasses.
  • Alexey Timokhin
    Greenhorn

    Joined: Mar 23, 2012
    Posts: 25
    The JavaDoc you linked has no connection to what I need whatsoever.

    The line that I needed was:



    I hope people could use this in the future.

    Side-note: As a greenhorn, my opinion would not matter and would carry little impact, if any, on the community, and I will strive my best to help people who need it. However, your teaching techniques are completely foreign to me because of their time wasting nature. I could have spent those 5 past hours coding and fixing different errors instead of wasting that time on that single line of code. I understand your policy of "this is not a code mill", and I support it because it makes sense, but I didn't ask for a whole program.

    The educational aspect is great, but I did not learn anything from any of your posts, except for the first link that you provided about the JSP and Philip's introductions to different aspects, such as DOM and JQuery usage. That was well done. I had to phone my friend to ask about this matter because Google mostly gave me suggestions on how to get the value of the text box (more commonly used) and the HTTPServletRequest suggestion completely misguided me.

    I find the best approach to teach a person is to provide him what he needs, not make him look for something that he is not familiar with, as long as it is in acceptable margins of course. Making people learn stuff they will not need is not the best practice.

    But, that is just my first view of the forums. The community and of course you, Bear, did help me with the logic a lot, so for that, I give you the greatest of my gratitude.

    Thank you.
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60794
        
      65

    Why were you not able to find the getParameterNames() method in the javadoc? I gave you all the clues you needed.

    P.S. I usually find the more modern getParameterMap() method more useful, but I have an affinity for Maps.

    P.P.S. Sorry that you did not find this more helpful, but just giving you the name of the method wouldn't have helped you learn how to look it up in the javadoc -- a skill it appears you have still to master. When you have time, look up the "teach a man to fish" parable.
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60794
        
      65

    And with regards to:
    I could have spent those 5 past hours coding and fixing different errors instead of wasting that time on that single line of code.

    But how many hours in the future are you going to waste because you don't understand how to use the javadocs? You should have been able to find what you needed in under a minute. Until you can do that, you will waste an enormous amount of time not only looking for what you need, but in probably in re-inventing the wheel because you didn't know that what you needed is already at your fingertips.

    That's what I'm trying to prevent.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Submitting only selected textboxes in a JSP
     
    Similar Threads
    *display* passed values in webpage form
    validating the arraylist values in struts
    validating the arraylist values in struts
    using OGNL
    passing parameters with LookupDispatchAction