Results 1 to 13 of 13
- 05-21-2010, 05:57 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 40
- Rep Power
- 0
dynamically generation of request.getParameter()
hi..
I have a problem ....I have a html page which is having dynamically created text box.Now i have to receive the value of this text box in jsp page.But I do not know how to set the request.getParameter() for dynamically created text box.Boz I do not what is exactly the number of text box created dynamically?.plz help me!!!
- 05-21-2010, 06:23 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
You can use request.getParameterName() to find all the name of parameters passed with the request.
- 05-21-2010, 06:29 AM #3
Member
- Join Date
- Oct 2009
- Posts
- 40
- Rep Power
- 0
See the problem is that only I do know waht is exactly the number of text box boz it is created text box dynamically.So in jsp page how many request.getParameter i set in jsp page that I do not know?
- 05-21-2010, 06:39 AM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
What do you mean by "how many request.getParameter i set in jsp page"?
You should not have any request.getParameter calls in your JSP at all. Scriplets are old and evil.
In a servlet, loop through all the parameter names adding the parameter names and values to, say, a map and you have all the parameter names and values.
- 05-21-2010, 07:01 AM #5
Member
- Join Date
- Oct 2009
- Posts
- 40
- Rep Power
- 0
What do you mean by "how many request.getParameter i set in jsp page"?
The answer of this question is this thai in html page text box r created dynamically so I do not know the number of text box created.So how many request.getParameter()I set in jsp page?
- 05-21-2010, 07:08 AM #6
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Still not making much sense.
Are you having problems with creating the textboxes or are you having problems with reading the values set in the dynamically created textboxes?
Do you understand what the request.getParameterNames() method returns?
- 05-21-2010, 08:31 AM #7
Member
- Join Date
- Oct 2009
- Posts
- 40
- Rep Power
- 0
I do not have problems with creating the textboxes .I have problems with reading the values set in the dynamically created textboxes through request.getParameter()
- 05-21-2010, 08:43 AM #8
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
And do you know what the request.getParameterNames() method gives you then?
Are you reading all parts of the replies I'm posting or just some parts and ignoring the rest?
- 05-21-2010, 10:17 AM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
What is the naming structure of your dynamically created text boxes?
Are they along the lines of "textbox_n" where n is an incremented number?
If so you want a while loop (while (found)) starting at whatever minimum you have for n, and keep going until "textbox_" + n returns null.
I can't remember what you get back if a textbox_n is empty (would that be null or a blank string)...
- 05-21-2010, 10:21 AM #10
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Or just use request.getParameterNames() to get the names of all the parameters.
- 05-21-2010, 10:45 AM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
The problem with that is, if the number of these things is important then you still have to loop through them to find the largest number.
Presumably the fields (and numbers) mean something?
Of course, as usual, we're playing Guess The Requirements...
- 05-21-2010, 10:49 AM #12
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
I don't see how that is a problem. In fact even if the objective is to find the largest number (which I doubt) then that can still be done in one loop while reading the parameter names enumeration.
- 05-21-2010, 11:12 AM #13
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Fair point.
I usually see this as a collection of fields, so I find using the id first and simply grabbing the collection of parameters based on the id preferable to going through all the parameter names and then grouping them together. Personal preference...though possibly completely irrelevant to a case with a single field.
Similar Threads
-
May include <%= request.getParameter("dateonly") %> as attribute value like above, in
By lse123 in forum Web FrameworksReplies: 0Last Post: 03-10-2010, 02:52 PM -
War file generation
By rummy in forum New To JavaReplies: 1Last Post: 02-08-2010, 12:57 PM -
Report generation
By anilkumar_vist in forum Advanced JavaReplies: 1Last Post: 12-14-2009, 12:26 PM -
String generation
By codingisfun22 in forum Advanced JavaReplies: 3Last Post: 12-03-2007, 05:43 AM -
Help with request.getParameter()
By Albert in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 07-13-2007, 03:39 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks