0

I am a beginner.In my project I am using JSP and Mysql Workbench. I got an error in passing one value from a jsp page to another the code that I used was

response.sendRedirect("setter.jsp?userid=<%=(rs.getInt("user_id"))%>");

The error showing is ) Expected But I cant identify where is the error please somebody help me.

sanbhat
  • 17,522
  • 6
  • 48
  • 64
Salini L
  • 829
  • 5
  • 15
  • 43

1 Answers1

2

Not sure why you need scriptlet tag, when you are already inside scriptlet. Shouldn't it be

response.sendRedirect("setter.jsp?userid="+rs.getInt("user_id"));

PS:

  • As quoted in the comments, I am not sure if redirection can be done from JSP. I concentrated on the syntax.
  • Use JSTL instead of scriptlets
sanbhat
  • 17,522
  • 6
  • 48
  • 64
  • Whether this removes the error doesn't matter because they won't be able to send the redirect. http://stackoverflow.com/questions/6637990/response-sendredirect-from-jspinclude-being-ignored – Sotirios Delimanolis Aug 27 '13 at 14:33
  • Thanks @SotiriosDelimanolis I was not aware of redirection. I have edited the post – sanbhat Aug 27 '13 at 14:37
  • @SotiriosDelimanolis: Response will be committed only if you include that jsp using `` tag. With a normal jsp, it should work. – Shashank Kadne Aug 27 '13 at 14:39