0

I have a web app running in jetty and in the JSP I e.g insert some values to my DB the following way:

 <% 
if(request.getParameter("id") != null && request.getParameter("value") != null){
int poiId = Integer.parseInt(request.getParameter("id"));

int value = Integer.parseInt(request.getParameter("value")); 

FirstExample.insertReading(value, id);   // here I 
}
%>

Is there a reason why I should not do method calling like this? I could have performed this useing JTSL i think its called?

brondy
  • 35
  • 1
  • 9

2 Answers2

1

You can use Servlet, in MVC model JSP is mainly used as view. No need to deal with big logic in JSP.

Bills
  • 768
  • 7
  • 19
0

There is no reason to do it at all. Actually, put the logic/actions in JSP is a bad practice. Separate logic out of JSP is much better design. Same logic can be used by many JSPs or other implementations.

Vadim
  • 4,027
  • 2
  • 10
  • 26
  • wow that is nice. I just started using java server and feel so much power with it compared to PHP – brondy Nov 11 '16 at 15:26