[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Missing post? - see this post about spam for more information.
[Struts] GETTING ERROR WHILE TRYING TO ACCESS DYNACTION FORM BEAN FORM PROPERTY TWICE ?  XML
Forum Index » J2EE Application Development
Author Message
faisalloe

Newbie

Joined: 12/25/2005 04:34:50
Messages: 2
Offline

public class ActivityAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm
actionForm, HttpServletRequest request, HttpServletResponse response)
throws Exception {
DynaActionForm form = (DynaActionForm) actionForm;

try {
ActionForward defaultForward = super.execute(mapping,
actionForm, request, response);
//String searchIn = (String) form.get("searchIn");

String
months[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
String days[] =
{"", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

String searchIn = null;
String vonicsNumber = null;
String year = null;
String month = null;
String day = null;
String currentServerDate = "";

if (mapping.getPath().equals(IWebConstants.CALLS_SEARCH)) {
request.setAttribute("searching", "true");
String to = request.getParameter("toPhone");
ArrayList dialedCalls = null, receivedCalls = null;
if (to == null) {
return defaultForward;
}

//test ----------------------------

/*************************************************************************/
I M GETTING SEARCHIN PROPERTY HERE WHICH IS DYNA ACTION
FORM) searchIn = (String) form.get("searchIn");
I M GETTING SEARCHIN PROPERT HERE WHICH IS DYNA ACTION FORM
/*************************************************************************/
searchIn = (String) form.get("searchIn");
to = request.getParameter("toPhone").toString();
System.out.println("------ search in -------"+searchIn+"----- Search in ----");
if(searchIn!=null){
if(searchIn.equalsIgnoreCase("Dialed")){

//to = request.getParameter("toPhone").toString();
dialedCalls = ActivityRecordInfo.getDialedCalls(to, -1, -1, -1, request);
request.setAttribute("Receve","false");
}else if(searchIn.equalsIgnoreCase("Received")){
System.out.println("REC..REC..REC..REC..REC..");
request.setAttribute("Receve","true");
receivedCalls = ActivityRecordInfo.getReceivedCalls(to, -1, -1, -1, request);

}

if(to == null)
to = request.getParameter("toPhone");
}
//test----------------------------------


request.setAttribute("dialedRec", dialedCalls);
request.setAttribute("receivedRec", receivedCalls);

return defaultForward;
}

//DynaActionForm form = (DynaActionForm) actionForm;

year = (String) form.get(IWebConstants.FORM_VONICS_YEAR);
month = (String) form.get(IWebConstants.FORM_VONICS_MONTH);
day = (String) form.get(IWebConstants.FORM_VONICS_DAY);


vonicsNumber = (String) form.get(IWebConstants.FORM_VONICS_PHONE);//request.getParameter("billingPhone");

if (year == null || year.trim().length() == 0 || day == null || day.trim().length() == 0) {
Calendar cal = Calendar.getInstance();
year = "" + cal.get(Calendar.YEAR);
month = "" + cal.get(Calendar.MONTH);
day = "" + cal.get(Calendar.DATE);
form.set(IWebConstants.FORM_VONICS_YEAR, year);
form.set(IWebConstants.FORM_VONICS_MONTH, month);
form.set(IWebConstants.FORM_VONICS_DAY, day);
}

if (vonicsNumber == null) {
HttpSession session = request.getSession();
if (session != null) {
AccountPhones phone = (AccountPhones) session.getAttribute(IWebConstants.SESSION_SELECTED_ACCOUNT_PHONES_KEY);

if (phone != null)
vonicsNumber = phone.getPhoneNumber();
}
}

HttpSession session = request.getSession();
TimeZone timeZone = (TimeZone) session.getAttribute(IWebConstants.SESSION_USER_TIME_ZONE);

java.util.Calendar cal = java.util.Calendar.getInstance(timeZone);
currentServerDate +=
days[cal.get(java.util.Calendar.DAY_OF_WEEK)] + ", ";
currentServerDate += cal.get(java.util.Calendar.DATE) + " ";
currentServerDate += months[cal.get(java.util.Calendar.MONTH)] +
", ";
currentServerDate += cal.get(java.util.Calendar.YEAR);

request.setAttribute("currentDate", currentServerDate);


ArrayList dialedCalls = null, receivedCalls = null;


/*************************************************************************/
IF I M TRYING TO GET AGAIN THIS PROPERTY IT IS
searchIn = (String) form.get("searchIn");
EVEN IF ABOVE I M PUTTING SEARCHING VALUE IN STRING IT IS
NOT AVAILABLE IN THE BOTTM HERE
I M GETTING SEARCHIN PROPERT HERE WHICH IS DYNA ACTION FORM
/*************************************************************************/

/* ERROR IS HERE ON BELOW LINE */
String searchin = (String)form.get("searchIn"); // here on this line

dialedCalls =
ActivityRecordInfo.getDialedCalls(vonicsNumber, Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day), request);
receivedCalls=
ActivityRecordInfo.getReceivedCalls(vonicsNumber, Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day), request);

request.setAttribute("dialedRec", dialedCalls);
request.setAttribute("receivedRec", receivedCalls);

return defaultForward;


} catch (Throwable e) {
handleError(e, request, IWebConstants.MESSAGES_ERROR_SYSTEM,
true);
}

return mapping.findForward("failure");
}
}

This message was edited 1 time. Last update was at 01/10/2006 09:45:43

stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline

What error are you getting? You'd get different exceptions if the parameter doesn't exist or if it isn't set.

Is there an exception or something? Let us know - I'm confident that you can get() the same parameter more than once.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
faisalloe

Newbie

Joined: 12/25/2005 04:34:50
Messages: 2
Offline

ops ya dats fine, parameter was not comming @ this page, and i was trying to get it.
its fixed
thanx
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline

No problem - glad to have helped!

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
 
Forum Index » J2EE Application Development
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2012 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle