I am following the JSP -> Servlet -> JSP architecture for our project.
There are a couple of problems that I am facing :

Let me first draw a simple workflow.

i) Main.jsp displays a screen with Add/Edit/Delete options. It also
instantiates a bean with session scope for encapsulating the properties
related to the
data. As this jsp is again at the end of the loop, for good measure it
also calls
reset on the bean to initialise all the parameters.

ii) user action in Main.jsp is forwarded to a ServletController which
determines which servlet (say Display.class) should be invoked and
forwards the
request to it.

iii) Display populates some data in the bean which helps the following
jsp
to configure the look of the form. It forwards to GetData.jsp.

iv ) GetData.jsp displays the form for data entry, and forwards to
ControllerServlet which forwards to an ActorServlet that actually takes
the
relevant persistence action on the database. On success, it forwards
control back to Main.jsp.

v) Main.jsp again throws up the screen for Add/Delete/Edit along with
details of the last transaction, which it gets from the bean. After
displaying the
same, *it resets the bean variables*.

So far, so good.

Problem No 1) <BIG PROBLEM> If the user presses on refresh at stage (v),

then the same record again gets written to the database. (I know that we
can solve
this at the database end, but that solution is case specific). What is
the cause of
this, and is there a remedy *at the server side* ? </BIG PROBLEM> I have
got a
temporary work around for the same at the server end. At the client
end, I think one may use Javascript to enable/disable/catch certain
events, and
hence obviate the problem.

Problem No 2) <SMALL PROBLEM> The url displayed on the address bar
remains
at http://...../servlet/ControllerServlet. Without doing a
sendRedirect() can
one change this to reflect the current jsp in action. </SMALL PROBLEM>
Both may be related
problems, but the first one is the bigger bother.

Thanks in anticipation.

- Uddipan.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to