• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

getParameter () method of HttpServletRequest

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

i am sending a request ( using JAVA code) to servlet as follows:

fldsmsrequest=<Request><ChannelID>IB</ChannelID><UserID>IB001</UserID><Password>lhfkgkniindnncfmnp</Password><ReferenceID>20080918109822</ReferenceID><LanguageID>1</LanguageID><CustomerNumber>111000</CustomerNumber><AccountNumber>111000</AccountNumber><TransactionType>C</TransactionType><SMSTemplateID>1039</SMSTemplateID><SendAsChannel>B</SendAsChannel><MobileNumber> ;971508168069</MobileNumber><EmailID>PoonamK.ext@adcb.com</EmailID><SMSTextValues>18-09-2008 05:31:23|1307494|110|11000</SMSTextValues><EmailTextValues><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"><HTML><HEAD>; <TITLE> New ocument </TITLE> <META NAME='Generator' CONTENT='EditPlus'/> <META NAME='Author' CONTENT=''/> <META NAME='Keywords' CONTENT=''/> <META NAME='Description' CONTENT=''/> </HEAD><BODY> <H1> hello </H1> </BODY></HTML></EmailTextValues><EmailTemplateID>0</EmailTemplateID><Filler2></Filler2><Filler3></Filler3><Filler4></Filler4><Filler5></Filler5></Request>



Servlet code is as follows:


but output is seen as


<Request><ChannelID>IB</ChannelID><UserID>IB001</UserID><Password>lhfkgkniindnncfmnp</Password><ReferenceID>20080918109822</ReferenceID><LanguageID>1</LanguageID><CustomerNumber>111000</CustomerNumber><AccountNumber>111000</AccountNumber><TransactionType>C</TransactionType><SMSTemplateID>1039</SMSTemplateID><SendAsChannel>B</SendAsChannel><MobileNumber>971508168069& lt;/MobileNumber><EmailID>PoonamK.ext@adcb.com</EmailID><SMSTextValues>18-09-2008 05:31:23|1307494|110|11000</SMSTextValues><EmailTextValues>


so <EmailTextValues> after this < > is not getting printed.




Please help me out.. as the <EmailTextValues> element contains ("ampersand lt;""ampersand gt;") characters . on this post it is coming as < and >

Thanks in advance.
[ September 18, 2008: Message edited by: neelam kamboj ]
 
Sheriff
Posts: 67619
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
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Bear Bibeault
Sheriff
Posts: 67619
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
Are you properly URL encoding the request parameter value?
 
neelam kamboj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have tried using . which doesn't work. Please help me which encoding need to be used.
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the full value actually being transmitted? There are limits to how many characters GET will transmit. Try using POST instead.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think Ulf has an important point ... when the amount of data that is being passed is big ... use of POST is recommended.

Did you try URLEncoder/Decoder ?
Before you pass a data in url it should be encoded. Once you receive the data in servlet you would need to de-encode it.

- Razi
 
Bear Bibeault
Sheriff
Posts: 67619
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

Originally posted by Razi Abbas:
Once you receive the data in servlet you would need to de-encode it.

No. The call to getParameter() will return the already-decoded value.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic