• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UrlEncode the String

 
Raihan Jamal
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to url encode the string..



I tried this way

But I got the error as

The function urlEncode must be used with a prefix when a default namespace is not specified
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34870
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
urlEncode() is at static method on URLEncoder. This means you need to call URLEncoder.urlEncode(filter.value.display) instead.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is filter? What makes you think that it even has a urlEncode() method?

Why are you URL-encoding it in the first place? If its for use on a URL, why not just use <c:url>?

 
Raihan Jamal
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying back, I did the changes as said by you:-



But still I am getting the same error as



Any suggestions??
 
Raihan Jamal
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bear Bibeault, In my app there are some string that has special characters like + and I am sending the query back to solr... So that spcecial character is causing problem.. So that's why I have to encode that string so that solr accept that query parameter...
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yeah, you can't just call any old static method inside an EL expression. That isn't what they are for.
 
Raihan Jamal
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Paul, In my app there are some string that has special characters like + and I am sending this query back to solr... So that spcecial character is causing problem.. So that's why I have to encode that string so that solr accept that query parameter that has special character.... That's why I want to url encode that expression..
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raihan Jamal wrote:In my app there are some string that has special characters like + and I am sending the query back to solr... So that spcecial character is causing problem.. So that's why I have to encode that string so that solr accept that query parameter...


Normally a browser will automatically URL-encode parameters sent from a <form> element. If that isn't happening then that means you aren't "sending the query back to solr" from a <form> element from the browser. Which means that "sending back to solr" is being done in some other way from the browser. Would you like to fill us in on the details? All of the details would be nice, so we don't have to have this sort of back-and-forth again.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TellTheDetails -- making us guess isn't going to help us help you.
 
Raihan Jamal
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Paul.. I am not sending any data from the form element back to Solr... In my solr all the data is there... and I have created an app in which data is coming from the solr... So some data has + sign like
Mac+
and they are hyperlinked... If we click on this hyperlink then all the data related to that particular data will show up in my browser... So in this case if I click on any data that has + sign then I am not getting any result back... But If I try to query the solr from its admin using Mac%2B then I am getting the result back...
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What hyperlink is that?

(Remember how I asked for a full description of the problem?)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic