• Post Reply Bookmark Topic Watch Topic
  • New Topic

On hitting 'save' button in jsp, the page is getting stuck  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On hitting 'save' button in jsp, the page is getting stuck

where as when the same is refreshed the necessary action would have actually worked and contents are saved.

But its not directly forwarding to that jsp, can you help me in this

Regards,
athul
 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to post some code that gives you problem.
 
athul chandran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've posted the end part of the method, which should make the backend call for saving the changes and forward to the jsp page. It's making the backend changes, but the page is getting stuck ( with the under processing symbol) instead of loading the results page.

public ActionForward saveBackroomList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {

<............................................ >



if(DistributionConstantUtil.Save_Changes.equalsIgnoreCase(actionFlag)){
returnForwad=DistributionConstantUtil.LoadCountManagment_Search_Results;
}else if(DistributionConstantUtil.Delete_Changes.equalsIgnoreCase(actionFlag)){

response.setHeader("Cache-Control", "no-cache");
response.setContentType("text/xml");
Backroom objBackrm = (Backroom )printList.get(0);
if(DistributionConstantUtil.Error.equalsIgnoreCase(objBackrm.getMessageFlag())){
response.getWriter().print("ERRORMESSAGE_"+objBackrm.getMessageDesc());
return null;
}else{
response.getWriter().print(DistributionConstantUtil.Blank);
}

}

} catch (Exception e) {
logger.error("Caught Exception in PrintBalancingViewAction.saveBackroomPrintDetails() method ",e);
}
logger.debug("Ended PrintBalancingViewAction.saveBackroomPrintDetails() method.................................");

return mapping.findForward(returnForwad);
}
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's something weird in your action.
I mean, you are using the PrintWriter to build the response and in the end you forward the request to a jsp.
I think you could go straight towards an IllegalStateException (response already committed)

What do you mean by page getting stuck? It doesn't load the page or a blanck page appears?
Exception thrown ? Do you see something on your console?

Thanks
 
athul chandran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've pasted the entire method for your ref & also, I've attached the screenshot of the page, once it gets stuck.

public ActionForward saveBackroomList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
logger.info("Entered PrintBalancingViewAction.saveBackroomPrintDetails() method.................................");
PrintBalancingActionForm printForm=(PrintBalancingActionForm)form;

BackroomBD backroomBD =new BackroomBD();
List printList=null;
HttpSession session = request.getSession();
session.setAttribute(DistributionConstantUtil.User_LoggedIn, DistributionConstantUtil.Y);
logger.info("inside the savePrintCountDetails Action method");

String applicationCode = PropertyUtil.getProperty(
DistributionConstantUtil.APP_PROPERTY_KEY,
DistributionConstantUtil.AS400_APP_NAME);
logger.debug("applicationCode in Action " + applicationCode);
String dataSource = PropertyUtil.getProperty(
DistributionConstantUtil.APP_PROPERTY_KEY,
DistributionConstantUtil.APP_AS400_DB_SOURCE);
logger.debug("dataSource in Action " + dataSource);
String returnForwad=DistributionConstantUtil.Blank;
try {

String actionFlag=printForm.getActionFlag();
String strFilm = printForm.getFilmName();
Backroom objBackroom = new Backroom();
Backroom objOriginalBackroom=new Backroom();
String[] strBackrooms = printForm.getBackroomList();
String[] strMaterialCode = printForm.getMaterialCodeList();
String[] strCounts = printForm.getCountList();
String[] strDirtyFlags=printForm.getDirtyFlagList();

int newArrayListPosition=0;
HashMap positionMap=new HashMap();
ArrayList backroomList = new ArrayList();
ArrayList originalbackroomList=new ArrayList();
for (int i = 0; i < strBackrooms.length; i++) {
objOriginalBackroom=new Backroom();
objOriginalBackroom.setBackroomName(strBackrooms[i]);
objOriginalBackroom.setMaterialType(strMaterialCode[i]);
objOriginalBackroom.setCount(strCounts[i]);

if(DistributionConstantUtil.Delete_Changes.equalsIgnoreCase(actionFlag ) || DistributionConstantUtil.One.equals(strDirtyFlags[i]) ){
objBackroom = new Backroom();
objBackroom.setBackroomName(strBackrooms[i]);
objBackroom.setMaterialType(strMaterialCode[i]);
objBackroom.setCount(strCounts[i]);
backroomList.add(objBackroom);
newArrayListPosition++;
positionMap.put(newArrayListPosition,i);
logger.debug("objBackroom-->"+objBackroom);
}
originalbackroomList.add(objOriginalBackroom);

}
logger.debug("position Map---->"+positionMap);


backroomBD.ejbCreate(false, null, 0, applicationCode, dataSource);
printList = backroomBD.saveBackroomList(strFilm,backroomList,true, null);


backroomBD.ejbRemove();

for(int i=0;i<printList.size();i++){
logger.debug("");
int originalObjPosition=(Integer)positionMap.get(newArrayListPosition);
originalbackroomList.remove(originalObjPosition);
originalbackroomList.add(originalObjPosition,(Backroom)printList.get(i));
}
printForm.setBackroomInfo((ArrayList)originalbackroomList);
logger.debug("strFilmName ==" + strFilm);

logger.debug("FilmList size== " + printList.size());
if(DistributionConstantUtil.Save_Changes.equalsIgnoreCase(actionFlag)){
returnForwad=DistributionConstantUtil.LoadCountManagment_Search_Results;
}else if(DistributionConstantUtil.Delete_Changes.equalsIgnoreCase(actionFlag)){

response.setHeader("Cache-Control", "no-cache");
response.setContentType("text/xml");
Backroom objBackrm = (Backroom )printList.get(0);
if(DistributionConstantUtil.Error.equalsIgnoreCase(objBackrm.getMessageFlag())){
response.getWriter().print("ERRORMESSAGE_"+objBackrm.getMessageDesc());
return null;
}else{
response.getWriter().print(DistributionConstantUtil.Blank);
}

}

} catch (Exception e) {
logger.error("Caught Exception in PrintBalancingViewAction.saveBackroomPrintDetails() method ",e);
}
logger.debug("Ended PrintBalancingViewAction.saveBackroomPrintDetails() method.................................");
logger.debug("returnforward = "+returnForwad);
return mapping.findForward(returnForwad);
}
Filename: error1.bmp
File size: 393 Kbytes
 
athul chandran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, I dont get any exception. Blank page is also not shown.
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when you post source code.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your code arrives at the following line?



Try to debug your method and see where do you get out from it.

When you get out what is the value of returnForwad? And is that value present in your struts-config.xml file?


 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Athul, I dont know much about jsps. Try the j2EE forum. You will definitely get some help there. But don't post the same question there. Ask one of the moderator to move your question to the related forum.

Have a nice day.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!