• Post Reply Bookmark Topic Watch Topic
  • New Topic

StackOverflowError

 
Anusha Vishnu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some times the following cade flow is trowing StackOverflowERROR. please suggest me.

conditional check in XyzServelet.doGet() method---true->abc.jsp(Search page)--click on submit--> XyzServlet.doPost()--validation true--> abc.jsp(view page)--click on proceed--XyzServlet.doPost().










 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A stack overflow is frequently the result of an infinite loop. Please post you relevant code (be sure to UseCodeTags).
 
Anusha Vishnu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some times the following cade flow is trowing StackOverflowERROR. please suggest me.

conditional check in XyzServelet.doGet() method---true->abc.jsp(Search page)--click on submit--> XyzServlet.doPost()--validation true--> abc.jsp(view page)--click on proceed--XyzServlet.doPost().



---RequesterServlet.doGet()---

if (model.getLast_Name().equalsIgnoreCase("")){
forwardControl(request,response,"/RequesterDetails.jsp");
}

---RequesterDetails.jsp---

if (request.getParameter("btnRCNext") != null && request.getAttribute("invalidFields") == null ) {
if (!pageMode.equals(PATCHConstants.REVIEW_REQUESTER) ) {
//forward to servlet processing
%>
<jsp:forward page="servlet/RequesterServlet"/>
<% }
}

----RequesterServlet.doPost()--

if(src.equals(RequesterDetails.jsp){
//previously entered data validation
request.setAttribute(PATCHConstants.RECORDCHECK_MODE,PATCHConstants.RECORCHECK_MODE_REVIEW_REQUESTER);
forwardControl(request,response,"/RequesterDetails.jsp");

}
---RequesterDetails.jsp---


if (request.getParameter("btnRCProceed") != null) {

//forward to servlet processing
%>
<jsp:forward page="servlet/RequesterServlet"/>
<% } %>

---RequesterServlet.doPost()--

if(src.equals("RequesterDetails.jsp) && (null != request.getParameter("btnRCProceed")))
forwardControl(request,response,"/RecordEntry.jsp");

 
Paul Clapham
Sheriff
Posts: 21876
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So RequesterServlet forwards to RequesterDetails.jsp, which forwards to RequesterServlet... looks like a possible source of infinite loops. In this case the infinite loop manifests itself as a stack overflow.

It looks to me like your code is arranged wrongly. The RequesterServlet should do everything required for RequesterDetails.jsp to do its work. Having the JSP do validation is just wrong architecture; the servlet should be doing all of the validation and the JSP should just be generating HTML, nothing else.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JSP should rarely, if ever, forward to a servlet. What are you hoping to accomplish with that?

And please, UseCodeTags when posting code.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!