Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet - Urgent help required.

 
Hutton Chris
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
we have a new application that is deployed in Tomcat server 4.0.
We have used Frames. The problem is, after submitting the JSP form, we get the target JSP correctly. But the I.E browser progress bar (at the bottom of internet explorer browser) still displays the progress as though something is still being downloaded.
We tried deploying the application in BEA weblogic also. Still we see the same problem.
Is it because of using Frames?
Any suggestions?
 
Andy Bowes
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt that it is caused by the use of the frameset. Basically the browser doesn't believe that it has been passed enough bytes as set by the setContentLength() method on the servlet. I have seen this happen on a clients site on pages that were being served over HTTPS (basically the size of the page was always 1 byte small than expected) and so the browser keeps expecting info until the request eventually times out.
I have never seen it happen on servlets generated from JSPs. On the servlets I eventually resolved the problem by simply removing the line of code that called the setContentLength() method.
HTH
 
Hutton Chris
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy,
Thanks for your reply.
In fact our JSP page (FORM) invokes a Servlet and when servlet returns the target JSP page, we see the problem that I mentioned earlier.
There is no code in our servlet that checks for content length.
Any suggestions?
 
Andy Bowes
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a snippet of code from the end of one of my servlets to show the order in which I set the details on the response:


Can you post the code in your servlet to this forum so that I can have a look at what you are doing. It could be as simple as not setting the status on the response.
HTH
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might see this if your servlet is not closing the output stream.
Bill
 
Hutton Chris
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill and Andy,
Thanks for your reply.
Here is the code we use.
public class AdminServlet extends HttpServlet
{
HttpSession session = null;
public AdminServlet()
{
}

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doPost(request,response);
}

public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
String action=null;
String url=null;
session=req.getSession(true);
try
{
if(req.getParameter("actionName") != null)
{
action = req.getParameter("actionName");
}

if("ENQUIRY".equals(action))
{
req=createRecord(req,resp);
url="/userinterface/a.jsp";
}
if("REVIEW".equals(action))
{
req=updateStatus(req,resp);
url="/userinterface/b.jsp";
}
}
catch(Exception e)
{
req.setAttribute("message","Server Maintenance : Please try after some time");
}
finally
{
getServletContext().getRequestDispatcher(
resp.encodeURL(url)).forward(req,resp);
}
}
We do not use ServletOutputStream.
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you should post your jsp page. Probably the problem is in there somewhere.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic