By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,262 Members | 1,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,262 IT Pros & Developers. It's quick & easy.

null pointer exception

P: 3
public ActionForward edit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
MissionForm missionForm = (MissionForm) form;

String strMissionId = InsEncr.getSingleton().decrypt(missionForm.getMiss ionId().toString());

Long userEntityTypeId = getUserEntityTypeId(request);
String strUserEntityTypeId = String.valueOf(userEntityTypeId);
String actionForward = PARAM_EDIT_MISSION;
if (!StringUtil.isEmpty(strMissionId)) {
actionForward = handleEditWhenMissionIsNotNew(strMissionId, mapping, request);
} else if (Constants.EntityType.NATIONAL.equals(strUserEntit yTypeId) ||
Constants.EntityType.SECTORIAL.equals(strUserEntit yTypeId)) {
actionForward = handleAddMissionWhenEntityIsNationalOrSectorial(re quest);
}

return mapping.findForward(actionForward);

}

In the above when i execute to add a new item its throwing exception null pointer exception
String strMissionId = InsEncr.getSingleton().decrypt(missionForm.getMiss ionId().toString());

so anyone can get the solution so that it shouldnot throw exception

advance thanks
May 23 '06 #1
Share this Question
Share on Google+
3 Replies


Banfa
Expert Mod 5K+
P: 8,916
I would guess that the most likely problem is that form is not a MissionForm and so when you cast it (which is quite a bad idea) to MissionForm and then try to call the GetMissionId member that member does not exist for form causing an exception.

Assuming this is C++ you may wish to consider using dynamic_cast to cast your form ensuring that it is actually possible to do it (and catch the exception that happens if it isn't).
May 23 '06 #2

P: 3
I would guess that the most likely problem is that form is not a MissionForm and so when you cast it (which is quite a bad idea) to MissionForm and then try to call the GetMissionId member that member does not exist for form causing an exception.

Assuming this is C++ you may wish to consider using dynamic_cast to cast your form ensuring that it is actually possible to do it (and catch the exception that happens if it isn't).


its missionform and missionid is also present but like when executing its taking null value to missionid and displaying nullpointerexception.only java
May 24 '06 #3

P: 3
its missionform and missionid is also present but like when executing its taking null value to missionid and displaying nullpointerexception.only java
May 24 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.