Getting null pointer exception

S

shanthikpk

After migrating from strut 1.0 to Struts 1.1.

In Struts 1.0 processPopulate method is in ActionServlet there we can
set all the ActionForm instance. i.e setmethods can be used in
processpopulate method. But from 1.1 processPopulate method is having
in RequestProcess. if the same code is keeping in processPopulate
method formInstance creating but mapping.getPath is comming null value.

Code:

ourFormInstance.setRequestCode(mapping.getPath()); //Geting null

// String remoteAddr = request.getRemoteAddr();


String publicRemoteIp=request.getParameter("myLocalIp");
//getting null


System.out.println("Local Network Ip
=================================>>>>>>>>>>>>>>>>>>> " +
publicRemoteIp);

if(publicRemoteIp!=null)
{
System.out.println("Local network IP
=================================>>>>>>>>>>>>>>>>>>> " +
publicRemoteIp);
ourFormInstance.setPublicIpRemateAddr(publicRemoteIp);
}


/*String localAddr = request.getLocalAddr();*/
/*System.out.println("Ramote IP = " + remoteAddr + " Local IP="
+ localAddr);*/

if (ourSession == null) {
try {
InetAddress address =
InetAddress.getByName(publicRemoteIp);
System.out.println("now v r in our session value after
address");

/* if(publicRemoteIp!=null &&
publicRemoteIp.equals("127.0.0.1"))
{
ourFormInstance.setRemoteAddr(publicRemoteIp);
}
else
{*/
//ourFormInstance.setRemoteAddr(remoteAddr);
// ourFormInstance.setRemoteAddr(publicRemoteIp);
System.out.println("after the setremoteAddress");
/* }*/
//ourFormInstance.setRemoteAddr(remoteAddr);
} catch (UnknownHostException ue) {
LogTracer.writeDebugLog(className, methodName, ue);
}

}

if (ourSession != null) {
ourFormInstance.setLoginType(ourSession.getLoginType());
ourFormInstance.setLoginUser(ourSession.getLoginUser());
ourFormInstance.setLocNbr(ourSession.getLocNbr());
ourFormInstance.setRemoteAddr(ourSession.getRemoteAddr());

System.out.println("ourSession.getRemoteAddr() = local
network IP" + ourSession.getRemoteAddr());

//ourFormInstance.setPublicIpRemateAddr(ourSession.getRemoteAddr());
// START CSO 3.9 06-18-2005 rbl
// auto populate process date onto form & request bean

ourFormInstance.setProcessDate(ourSession.getProcessDate());

ourFormInstance.setLocStateCode(ourSession.getLocStateCd());
// END CSO 3.9 06-18-2005 rbl
ourSession.addAction(mapping.getPath());
}

Similarly all the set methods in RequestProcessor is comming null
values. After Executing the loginAction.


Cheers

Shanta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top