• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to retrieve the parameter names from a JSP page ? Urgent Please  RSS feed

 
chitradurga challekere
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Can anybody tell me how to retrieve the parameter names from the JSP
page. (without using getParameterNames() method.)
The problem with the getParameterNames() method is I get the Jumbled output.
I need it very badly
With regards
Ananth R
email:ananthr@csa.isc.ernet.in
ananth_vadholasa@rediffmail.com
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with the getParameterNames() method is I get the Jumbled output.

What do mean by jumbled ? You will get a Enumeration, which you can navigate through.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi chitradurga, welcome to the Ranch!
Please don't post your question in mutiple places. Whether it be across multiple forums or within the same forum (you also posted this question to an older thread here. It wastes people's time when question are answered in multiple places.
With regards to your question, it was pretty well answered in that other thread. There is no way that you can get the paramters in any specific order unless you do something yourself. You could publish a list of parameters in the order you want them, then retrieve them individually in that order. Or you can sort the collection after you get them if that's appropriate. In any case, the canonical order of the elements within the submitting form is not preserved, so there's no automatic way to get that order back.
You don't say why you feel you need the original order. Most often the order is moot. Perhaps if you describe why the order is important, someone can suggest alternate solutions.
hth,
bear
P.S. Another tip: please avoid using words like 'urgent' in your subjects. It doesn't add any useful info to the subject, and it won't get your post looked at any faster.
[ September 12, 2003: Message edited by: Bear Bibeault ]
 
chitradurga challekere
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I want the original order because I want to construct a XML file out of JSP form.
 
chitradurga challekere
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
My primary intention is to convert the JSP form information into a XML file.
If I do not get the Parameter names in the correct order how can I maintain
tag order in XML file.
For ex: (JSP PAGE VIEW)
Name--
FirstName
MiddleName
LastName
Address--
Street1
Street2
City
Country
&so on
(XML File to be generated)
<Name>
<FirstName>Value</FirstName>
................
................
</Name>

<Address>
<street1>value</street1>
...........................
...........................
</Address>
& so on

If I use getParameterNames() to get all the parameter names(Which form the tag names in the XML file ) the Enumeration object it returns will not be in the same order as the text fields in JSP.From this I can not construct a meaningful XML file.
order means: Order of entry on the page, from top to bottom
That's it
Waiting for your responses
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not to be snappy, but it's already been pointed out that it cannot be done automatically. If you know the order you need in order to construct the XML file you need to pull the parameters in that order.
There are many ways you can feed the order to your processing (such as David's idea of a hidden parameter), but obtaining the canonical order of the elements within the HTML form just from what is automatically passed to the request is not possible.
bear
[ September 13, 2003: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!