I edited textarea on jsp page using servlet and I want to return updated same jsp page. But this jsp page url http://localhost:/studentProfile.jsp?id=1. So I get error.
HTTP Status 500 - java.lang.NumberFormatException: null
How to return updated jsp page in servlet?
Can I use instead response.sendRedirect("studentProfile.jsp")
?
ProfileServlet:
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String comment = request.getParameter("comment");
int case = new ProfileDao().insertComment(comment);
response.sendRedirect("studentProfile.jsp");
}
studentProfile.jsp:
<form action="studentProfile" method="post">
<div class="form-group">
<textarea name="comment" class="form-control"></textarea>
</div>
<button type="submit" class="btn btn-success"></span>Submit</button>
<h2><small>Posts</small></h2>
<c:forEach items="${profile}" var="pro">
<textarea readonly name="comment">${pro.comment}</textarea>
</c:forEach>
</form>