I had getted a Uncaught SyntaxError: Unexpected identifier error when I use Java variable value. The java code is :
    <%!String questionId = "";
  String currentUserId = "";%>
<%
    String id = request.getParameter("questionId");
    if (id != null) {
        questionId = request.getParameter("questionId");
    }
    LoginResult loginResult =     (LoginResult)request.getSession().getAttribute(I_SsoLogin.LOGINRESULT);
    currentUserId = loginResult.getUser().getUserId();
%>
But the variable using in JavaScript code:
function getAnswerAdoptView(item){
    var adoptHtml = "";
    var id = "adopt_"+item.answerid;
    var userId = <%=currentUserId%>;
}
in the browser show errors:Uncaught SyntaxError: Unexpected identifier
 
     
     
    