• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getParameter () method of HttpServletRequest

 
neelam kamboj
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
i have tried using . which doesn't work. Please help me which encoding need to be used.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • 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.
 
Razi Abbas
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic