• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Submitting only selected textboxes in a JSP

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Alexey Timokhin
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
    Posts: 25
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Sheriff
    Posts: 67746
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Sheriff
    Posts: 67746
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic