hi,
iam passing a name "sun & moon" in my query string as a parameter.
but when i receive it through request.getParameter iam getting only sun.
rest are getting ignored due to & symbol.
how to get the value as wat i entered through query string.
encoding with another symbol is not adviced. so can any one give a good solution
please help me
soon as possible .
11 5429
hi,
iam passing a name "sun & moon" in my query string as a parameter.
but when i receive it through request.getParameter iam getting only sun.
rest are getting ignored due to & symbol.
how to get the value as wat i entered through query string.
encoding with another symbol is not adviced. so can any one give a good solution
please help me
soon as possible .
Post the code where you are passing the parameter.
thanks,
but iam fetching the name in one action class through request.getparameter and appending with other values with querystring and passing to second action class. when i get in second action class iam not getting the whole string.
thanks,
but iam fetching the name in one action class through request.getparameter and appending with other values with querystring and passing to second action class. when i get in second action class iam not getting the whole string.
Read my reply above again.
sorry,
iam new to java . i dont no how to pass the code by POST.
can you help me please.
from jsp iam doing POST to one class. but from that class i dont no how to post the query string by post when i pass through response.sendredirect.
to another class
sorry,
iam new to java . i dont no how to pass the code by POST.
can you help me please.
from jsp iam doing POST to one class. but from that class i dont no how to post the query string by post when i pass through response.sendredirect.
to another class
Copy the piece of code where you are passing the parameter, paste it here.
regards,
sukatoa
Hello frnd
I think you'll pass the parameter on href. Will you use this type? For example 'http://bytes.com/forum/newreply.php?do=newreply'&'p=3163121' see the site name. & symbol using middle of the two variable. So you can't retrieve it.
Use replace statement. For example
String ss = "str&str1";
ss = ss.replace('&','xxxxx');
Try this method
GoodLuck
hi,
iam passing a name "sun & moon" in my query string as a parameter.
but when i receive it through request.getParameter iam getting only sun.
rest are getting ignored due to & symbol.
how to get the value as wat i entered through query string.
encoding with another symbol is not adviced. so can any one give a good solution
please help me
soon as possible .
Hello frnd
I think you'll pass the parameter on href. Will you use this type? For example 'http://bytes.com/forum/newreply.php?do=newreply'&'p=3163121' see the site name. & symbol using middle of the two variable. So you can't retrieve it.
Use replace statement. For example
String ss = "str&str1";
ss = ss.replace('&','xxxxx');
Try this method
GoodLuck
What if xxxxx is part of the original string? A much better solution is to use the API: - import java.io.UnsupportedEncodingException;
-
import java.net.URLEncoder;
-
import java.net.URLDecoder;
-
-
public class URLEncoderTest {
-
public static void main(String[] args) throws UnsupportedEncodingException {
-
String charset = "UTF-8";
-
-
String text = "Sturm & Drang = Storm & Stress";
-
String encoded = URLEncoder.encode(text, charset);
-
String decoded = URLDecoder.decode(text, charset);
-
System.out.format("'%s' => '%s' => '%s'%n", text, encoded, decoded);
-
}
-
}
Note that this takes care of not just '&', but other special characters as well, like white space and '='.
I had this problem a few days ago and I solve it as following:
Before you send the your request to the server replace all the "&" with some string that you decide about and doesn't appear in the your parameter e.g DUMMY it. on the server just replace the string you relace previously in the client side with the & again. I hope this will help
I had this problem a few days ago and I solve it as following:
Before you send the your request to the server replace all the "&" with some string that you decide about and doesn't appear in the your parameter e.g DUMMY it. on the server just replace the string you relace previously in the client side with the & again. I hope this will help
I still think using the HHTP standard and java's standard API, namely URLEncoder/URLDecoder, is the way to go.
hi guys,
i tried with urlDECODER but its a depricated class so we cannot use that.
i tried by replacing the & with %26 and i passed to query string.
in request parameter %26 is escaped with & value.
so iam getting the value properly
now its working fine.
thanks dudes.
:)
hi guys,
i tried with urlDECODER but its a depricated class so we cannot use that.
i tried by replacing the & with %26 and i passed to query string.
in request parameter %26 is escaped with & value.
so iam getting the value properly
now its working fine.
thanks dudes.
:)
You are misreading: java.net.URLDecoder is not a deprecated class, at least not as of 1.6: http://java.sun.com/javase/6/docs/ap...RLDecoder.html
If you take the time to read the API documentation, you'll see that what is deprecated is the version of the decode method that takes one string: - String decodedText = URLDecoder.decode(text);//deprecated
Like almost all deprecated parts of the API, there are instructions what to do instead. In this, you should use the other version of decode, which takes the name of a charset encoding: - String decodedText = URLDecoder.decode(text, "UTF-8");//excellent
This is the version I used in my example, above.
Hope this clears things up.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Luklrc |
last post by:
Hi,
I'm having to create a querysting with javascript. My problem is that
javscript turns the "&" characher into "&" when it gets used as a
querystring in the url EG:
...
|
by: ~~~ .NET Ed ~~~ |
last post by:
Hi,
I have a standalone XML file (with the appropriate xml document header)
that works fine when I load it using XmlDocument. I can have child elements
like this without problems:
...
|
by: sam |
last post by:
What is the quickest way to retreive total space and free
space for the network drivers.
Sam
|
by: ward |
last post by:
Greetings.
Ok, I admit it, I bit off a bit more than I can chew.
I need to complete this "Generate Report" page for my employer and I'm
a little over my head. I could use some additional...
|
by: Goran Djuranovic |
last post by:
Hi All,
Does anyone know how to retreive deepest XPath value from XML document by using VB.NET? For example, if I had an XML file like this:
<Root>
<Customer>
<Name>MyName</Name>
</Customer>...
|
by: JNariss |
last post by:
Hello,
I have created a connection to my Access database with Dreamweaver and
made a simple form with 4 fields.
The code behind this form was/is:
<%@LANGUAGE="VBCRIPT" CODEPAGE="1252"%>...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: M |
last post by:
Hello all,
We've got the following problem: When a visitor klicks a dead link he
ends up on a 404-page like should be. On that page there's an
opportunity to mail the webmaster (me) about the...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |