I'm passing some encoded string as a request parameter. I suppose the right way to do this in a JSP file is <input type="hidden" name="userId" value="<%=URLEncoder.encode("ENCRYPTED STRING HERE")%>"> Should I always use URLDecoder to decode the message?
Just to make it clear, URLEncoder does not encrypt a value, merely make sure that it contains no troublesome characters for a URL: ' ' is replaced by '+', other non-alphanumeric characters are replaced by a hexadecimal character code in the form "%AB". You only need to use URLEncoder if you are constructing a URL from scratch as a string, and it is quite rare to need to use URLDecoder as that is doen for you by the Servlet API.
Originally posted by Chu Tan: I'm passing some encoded string as a request parameter. hjdsfsdfsdfsdfsdfmessage?
(edited by Cindy) Turlapati, Why don't you experiment with UBB in "Meaningless Drivel" or "Blatant Advertising" and not clutter up the high traffic forums. Cindy [ July 23, 2002: Message edited by: Cindy Glass ]