0

I have a problem I am trying to make a link between the jsp files (in WebContent) and the java files in Java Resources directory . In the Html page URL I am unable to replace %20 with space.

<form action="<%= (request.getContextPath() + "/Java Resources/src/utilities").replaceAll("%20", " ") %>/Login.java" method="post" >

KhuzG
  • 11
  • 4
  • Yes seems you cant, browser again add %20. Normally browser added %20 http://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20 Check this. – Lasitha Benaragama Apr 28 '14 at 08:52

1 Answers1

1

There's no reason to replace the %20 with a space in the action attribute; they mean the same thing, but %20 is the normalized form.

I suspect you're seeing this because of the way you're looking at it.

Your replaceAll works (example). But literal spaces in URLs are generally a bad idea (I think with http URLs they're invalid, in fact, but I'd have to check the RFC). %20 is what they're replaced with in URL-encoding. So my suspicion is that although you're successfully replacing the %20 with a space, when you use the form, the browser is showing you the normalized form (with the %20 instead).

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875