Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

About encoding url using c:url and c:param  RSS feed

 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFSJ, it is said that to use c:url in combination with c:param to do the URL encoding , to get rid of the special characters in the URL like the space.
Example given :

I have two problems here
1. The browser(firefox) is actually do it for me , the space are replaced by "+" sign. So how should i check what i am doing??
2. The "value" attribute of the param tags gets its value by using EL , which means it should be already there in some scope. Isn't it.?

Can someone give an example code of url encoding??

Actually i want a jsp which accepts the first and last name and sends it to the second page by encoding the url( using the param tag).
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I don't know what you are talking about. The browser can't do anything for you on the server, where all this is happening.

2. Scoped variables have nothing to do with request parameters. What's the problem?
 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:1. I don't know what you are talking about. The browser can't do anything for you on the server, where all this is happening.


I have a html and jsp file . Html accepts the first name and pass it two second page...Here it is

two.jsp


The URL when i am in second page is
http://localhost:8080/mvc/two.jsp?First=Sony+Agrawal
.
the space in the url is replaced by "+" characters. Isn;t this called the url encoding ??
I have not used any <c:url> tags
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, now I understand -- yes, the parameter is automatically encoded as part of form submission. This has nothing to do with using <c:url> while generating a page.
 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So then how is <c:url> different from the encoding done by the browser?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's used when you are the one creating the URL, not the browser.
 
Sony Agrawal
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:It's used when you are the one creating the URL, not the browser.

Hmmm... thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!