So do I need to map two different view in action class as follow

{
        String email = (String) request.getParameter("sendValue");
        // perform validation of email address
        try {
            insp.validate(email);
           //iF EMAIL IS VALID it return email and map email.jsp page
            request.setAttribute("returnValue",  email);
            return mapping.findForward(SUCCESS); //View 1
        } catch (Exception e) {
//If email is invalid it retun null with error message and map to blank page.
            request.setAttribute("returnValue",  "-1");
            ActionErrors errors = new ActionErrors();
            errors.add("error", new ActionMessage(e.getMessage(), false));
            this.saveErrors(request, errors);
            return mapping.findForward(FAILURE); //View 2
        }
}
On 12/2/2010 1:42 PM, Dave Newton wrote:
On Thu, Dec 2, 2010 at 1:25 PM, Anjib Mulepati wrote:

But problem I am having is I can't tap the condition where email is
invalid.

$.post(
        "validateEmail.do",
        {sendValue: email},
        function(returnValue){
            addToTable(returnValue); //add email to table

"Tap it" in that function: isn't the returnValue either the email (if
successful) or nothing (if not)?

Although personally I'd still use JSON; easier.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to