you cannot have multiple elements on a page with the same attribute id. try using classes instead.
try something like:
$(document).ready(function() {
$(".userId").each(function(i){
if ($(this).val() != '') {
alert('not null' + i);
}
});
});
: .val - , , . .val() .val. , $().val , , .
JSP :
<c:forEach items="${person}" var="person">
<input= type="text" class="userId" value="${person.userid}" />
First name:- ${person.fName} , Last Name:- ${person.lName}
</c:forEach>