Search Results

Search found 2 results on 1 pages for 'ssahmed555'.

Page 1/1 | 1 

  • Set request attributes when a Form is POSTed

    - by ssahmed555
    Is there any way to set request attributes (not parameters) when a form is posted? The problem I am trying to solve is: I have a JSP page displaying some data in a couple of dropdown lists. When the form is posted, my Controller servlet processes this request (based on the parameters set/specified in the form) and redirects to the same JSP page that is supposed to display addition details. I now want to display the same/earlier data in the dropdown lists without having to recompute or recalculate to get that same data. And in the said JSP page, the dropdown lists in the form are populated by data that is specified through request attributes. Right now, after the Form is POSTed and I am redirected to the same JSP page the dropdown lists are empty because the necessary request attributes are not present. I am quite the n00b when it comes to web apps, so an obvious & easy solution to this problem escapes me at the moment! I am open to suggestions on how to restructure the control flow in the Servlet. Some details about this app: standard Servlet + JSP, JSTL, running in Apache Tomcat 6.0. Thanks.

    Read the article

  • How to handle exceptions from an image-generating Servlet?

    - by ssahmed555
    I have a simple (Servlet, JSP, and JSTL) web app whose main functionality is displaying images retrieved from a back-end server. The controller servlet forwards the user to a JSP that in turn uses another Servlet to display the resulting image on that same JSP. Further down, the JSP has a line similar to: <a href="<c:out value='${imageURL}'/>"><img src="<c:out value='${imageURL}'/>" alt="image view" border="1"></a> which invokes a GET request on the image-generating servlet causing it to generate the image. My question is: how do I handle Exceptions thrown by this image-generating servlet? I already have an error page defined (in web.xml) to handle ServletException within my web app but this doesn't work for this image-generating Servlet, and results in the following errors showing up in my Tomcat server logs: SEVERE: Exception Processing ErrorPage[exceptionType=javax.servlet.ServletException, location=/WEB-INF/ExceptionPage.jsp] java.lang.IllegalStateException: Cannot reset buffer after response has been committed What's my recourse in this situation? I'd like to be able to handle Exceptions thrown from this image-generating Servlet, and display some error on the main UI or forward the user to another error page.

    Read the article

1