I have written a Java Servlet which queries the database and returns the result to JSP. I am executing the SQL Statement based on the parameters passed from the URL
//Reading Parameter
String User = request.getParameter("userid");
//Executing the SQL
String sqluser = "SELECT 1 FROM <table name> WHERE username = ?
pstmt = con.prepareStatement(sqluser);
pstmt.setString(1, User); //Setting the value passed from URL
rset = pstmt.executeQuery();
The sample URL: http:\testenv.com\test?userid=tana
The above URL displays correct result since user='tana'.
But there are some users that have "#" in their user name.
For e.g: http:\testenv.com\test?userid=la#na
The SQL Statement does not return any value because User= 'la' in above case even though the URL has "la#na". Can i get the value "la#na" using getParameter? If so what do i need to do?