File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes getParameter () method of HttpServletRequest Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "getParameter () method of HttpServletRequest" Watch "getParameter () method of HttpServletRequest" New topic
Author

getParameter () method of HttpServletRequest

neelam kamboj
Greenhorn

Joined: Sep 18, 2008
Posts: 5
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 ]

Thank you,
Poonam Kamboj
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56153
    
  13

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 .


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56153
    
  13

Are you properly URL encoding the request parameter value?
neelam kamboj
Greenhorn

Joined: Sep 18, 2008
Posts: 5
i have tried using . which doesn't work. Please help me which encoding need to be used.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35223
    
    7
Is the full value actually being transmitted? There are limits to how many characters GET will transmit. Try using POST instead.


Android appsImageJ pluginsJava web charts
Razi Abbas
Greenhorn

Joined: Dec 10, 2006
Posts: 18
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

Joined: Jan 10, 2002
Posts: 56153
    
  13

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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: getParameter () method of HttpServletRequest
 
Similar Threads
java.lang.IllegalStateException: Cannot forward after response has been committed
user validation page
Error while forwarding page
error showing while retrieving the data from drop down list
Problem in displaying multiple search results