i am trying to pass a string from my jsp to the servlet via href. I use this
<a href="MyServlet?select=title1"> Title1 </a>
then in the servlet i am trying to get the value of the select with this
String s = request.getParameter("select");
But it returns null
. Why is that? Thank you!
EDIT I post the code of the servlet
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String userOption = request.getAttribute("select");
System.out.println("Select is:" + userOption);
//in the console i get: Select is:null