Ok second also doesn't work.

1. I have AJAX post as follow:

$.post(
        "validateEmail.do",
        {sendValue: email},
        function(returnValue){
            addToTable(returnValue);
        },
        "text"
    );

2. I have action as:
{
        String email = (String) request.getParameter("sendValue");
        // perform validation of email address
        try {
            insp.validate(email);
            request.setAttribute("returnValue",  email);
            return mapping.findForward(SUCCESS);
        } catch (Exception e) {
            request.setAttribute("returnValue",  null);
            ActionErrors errors = new ActionErrors();
            errors.add("error", new ActionMessage(e.getMessage(), false));
            this.saveErrors(request, errors);
            return mapping.findForward(FAILURE);
        }
}

My page display email if valid and null if invalid.

3. I have action mapping as

<action path="/validateEmail"
                type="actions.ValidateEmailAction" >
<forward name="success" path="/pages/email.jsp" />
<forward name="failure" path="/pages/blank.jsp" />
</action>

4. Email.jsp simply display email
<%= request.getAttribute("returnValue") %>*
*
5. blank.jsp is just blank**page*

*Where I am doing wrong?

Anjib
*
*

On 12/2/2010 11:58 AM, Dave Newton wrote:
On Thu, Dec 2, 2010 at 11:44 AM, Anjib Mulepati wrote:

1. My record in the table disappear if page is refresh.

Don't refresh? Otherwise you need a mechanism to "remember" what you're
working with, like the session.


2. And If some of my email is incorrect I don't want that to be get back to
view again. I just want to show a error.

Look at the results of the AJAX call. If it's an error, display a message.
Should be trivial if using JSON, only marginally less trivial if you're not.

Dave


Reply via email to