Advanced Struts / AJAX problem

Discussions

EJB design: Advanced Struts / AJAX problem

  1. Advanced Struts / AJAX problem (3 messages)

    Hello friends,
     I am in the middle of evaluating using AJAX for a particular feature in our Struts based application.
    The scenario is as follows
    There is a web page containing list of users. Along side each user name there is button for enabling/disabling

    This is an ideal place for using AJAX where I can just change the label of the button between enable and disable.
    But what happens if a database error occurs in changing the state of user access.

    We have got a error.jsp already in place
    Till now we have been redirecting to it using findForward and set the html:errors property in the action class

    Any help?
    Regards
    John V
  2. Advanced Struts / AJAX problem[ Go to top ]

    All the DB errors need to be properly handled by catching the DB error and throwing it as an appropriate meaning full error.
    If there is an exception changing the status of the user, catch that exception and convert it to a proper error message and show it as an alert message.
    For ex: if the user is deleted for whatever the reasons, then when a status change operation is performed show an error message in an alert box saying "This user has been deleted, pls refresh the page".

    thanks
    Dashrath
  3. Do not ever forwared to Error page, this is not a good design. Handle almost all the errors/exceptions properly.

    Only in the workcase for unhandled exceptions error page can be shown.

    thanks
    Dashrath
  4. In the Web-app, there is table to which multiple rows can be added ..the rows are filled by ajax calls...rows may be
    deleted as well in which case the deletion is done from client-side javascript call and then refreshing the undeleted rows using the same ajax call...

    Now things work fine till the number of rows are limited to five(in mozilla-based browsers) and 3(in IE).....However if
    the no. of rows exceeds the aforementioned, then ajax-call ("send" part) fails to dispatch the request and the Javascript console displays the following error:

    Error: [Exception... "Component returned failure code: 0x80040111
    (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111
    (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
    http://localhost:8080/catissuecore/Distribution.do?operation=add&pageOf=pageOfDistribution&menuSelected=16
    :: processRequestOnSpecimenIdChange :: line 370" data: no]
    Source File:
    ...............
    Line: 370

    Now line 370 is:
    if (req.status == 200) {

    Evidently the response is unavailable since the request itself failed....Any
    pointers ??

    biboy