Getting null pointer exception at line --
if(lForm.getUserId()!=null && lForm.getPassword()!= null){
Please help
package com.app.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.app.form.LoginForm;
public class LoginAction extends Action {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LoginForm lForm = (LoginForm) form;
String forwardString = "";
//lForm.setUserId("shats");
try{
if(lForm.getUserId()!=null && lForm.getPassword()!= null){
if(lForm.getUserId().equals("shats") && lForm.getPassword().equals("admin"))
{
forwardString = "success";
}
else
{
forwardString = "failure";
}
}
}
catch(Exception e){
System.out.println("Error ::::::"+e);
}
forwardString = "success";
return mapping.findForward(forwardString);
}
}