jquery - IF ELSE Statement in JSP -
i made access log menu. point make can see users activity. have difficulties in displaying string message in menu table after using if else
preparedstatement
in jsp. before put code below, first need explain basics. have button in access log page named btnreport
. , when clicking menu page, display page view in access log table, , when pressing btnreport, display page displayed.
click here see screenshot
and finally, code:
<% string serverip = request.getremoteaddr(); string sqllog = "insert accesslog (userid,hostip,status,webflag,logtype,action) values (?,?,?,?,?,?)"; preparedstatement pst=cn.preparestatement(sqllog); pst.setstring(1,(string) session.getattribute("user")); pst.setstring(2,serverip); pst.setstring(3,"-"); pst.setint(4,1); pst.setstring(5,"web_admin_"+vmenugroup+"-"+vmenutitle); if (request.getparameter("btnreport")==null) pst.setstring(6,"page view"); else pst.setstring(6,"report"); pst.setstring(3,"success"); pst.executeupdate(); pst.close(); %>
when user clicks report button, want string message set "success" , page view "-". can me how solve problem?
problem not using brackets:
else {//missing pst.setstring(6,"report"); pst.setstring(3,"success"); //without brackets, line not falls under else block }//missing
Comments
Post a Comment