Click to See Complete Forum and Search --> : Problem with Urldecoder


dvsridhar
August 4th, 1999, 08:13 AM
When i am trying to decode the urlencoded string it is not returning the
decoded string
i am sending my code please help me out with necessary changes

sridhar
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.net.URLDecoder;
import java.net.URLEncoder;
public class serverListening extends HttpServlet
{
String str=null;
String temp1=null;
String ret=null,temp=null;
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException,Exception
{

try{
ret=URLEncoder.encode("srikanth|sridhar|madhu|rachu|paddu|");
System.out.println(ret);
}catch(Exception e)
{
System.out.println(e.getMessage());
}

try{
temp=URLDecoder.decode(ret);
System.out.println(temp);
}catch(Exception e)
{
System.out.println(e.getMessage());
}

}
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws IOException, ServletException
{
doGet(req,res);
}

}