Re: AjaxTabbedPanel - Implementation changes
Re: AjaxTabbedPanel - Implementation changes
- Subject: Re: AjaxTabbedPanel - Implementation changes
- From: Chuck Hill <email@hidden>
- Date: Wed, 2 Feb 2011 12:15:30 -0800
What you are doing is not something that I have used the AjaxTabbedPanel for, nor something I expected it to be used for. I suspect the problem is in your code, but if you do find a bug in the AjaxTabbedPanel source, patches are welcome.
http://wiki.objectstyle.org/confluence/display/WONDER/Creating+and+Submitting+an+Acceptable+Patch
Chuck
On Feb 2, 2011, at 11:23 AM, Raghavender wrote:
> Hi Chuck,
>
> As explained in the email below, I have implemented AjaxTabbedPanel and AjaxTabbedPanelTab 's, in each Tab I am loading a component page and from that page I am navigating to the next page using AjaxSubmitButton action. From the first page I am able to successfully navigate to the second page, and when I tried to navigate from the second page to third page using AjaxSubmitButton action but it is invoking the first page's AjaxSubmitButton action method. The second page AjaxSubmitButton action method is not being called, and not able to navigate to the third page. Please suggest how to handle multiple ajax submit actions in the same AjaxTabbedPanelTab page navigations.
>
> Only the main page that has AjaxTabbedPanel and AjaxTabbedPanelTab 's have WOForm with multipleSubmit = true. The component pages loaded in the Tab and navigated does not have any form in those pages.
>
> Regards,
> Raghu.
>
> On 02-Feb-11, at 12:58 AM, Chuck Hill wrote:
>
>>
>> On Feb 1, 2011, at 10:54 AM, Raghavender wrote:
>>
>>> Hi Chuck,
>>>
>>> I have implemented AjaxTabbedPanel with eight AjaxTabbedPanelTab 's, in each Tab I am loading a component page. And in that component page I have next submit button that takes the user input data from this page to next component page. In this way I have to keep navigating to three to four component pages in each AjaxTabbedPanelTab. All these three or four component pages should be keep navigating in the same AjaxTabbedPanelTab. For example a Admin User selects a "Test Results" tab, and in that Tab the District selection page is displayed, after the district is selected then user clicks on next button to move to School selection page then move to next page for Students selection and finally generates a report.
>>> All these component pages are extended ERXComponent and now in order to achieve complete Ajax based application and keep tracking of data while navigating from one page to another in the same AjaxTabbedPanelTab, what changes have to be made, please suggest.
>>
>> My best suggestion is to come up with a better UI!. What you want to do might "just work" if you manipulate the selected bindings in code.
>>
>>
>> Chuck
>>
>>
>>
>>> On 31-Jan-11, at 11:54 PM, Chuck Hill wrote:
>>>
>>>>
>>>> On Jan 31, 2011, at 7:19 AM, Raghavender wrote:
>>>>
>>>>> Hi Chuck,
>>>>>
>>>>> I have loaded a component page in the AjaxTabbedPannedTab, in that page when I am trying to do some action (in that subcomponent page) then the page is getting cleared off.
>>>>>
>>>>> Any suggestions.
>>>>
>>>> Make sure that isSelected is bound to a boolean variable.
>>>>
>>>>
>>>> Chuck
>>>>
>>>>> On 29-Jan-11, at 10:15 AM, Raghavender wrote:
>>>>>
>>>>>> Thanks a lot Chuck, I have updated Wonder frameworks and the issue got resolved. Now I am able to see the AjaxTabbedPannel and Tabs.
>>>>>>
>>>>>> Thanks,
>>>>>> Raghu.
>>>>>>
>>>>>> On 29-Jan-11, at 8:27 AM, Chuck Hill wrote:
>>>>>>
>>>>>>>> Caused by: java.lang.NullPointerException
>>>>>>>> at er.ajax.AjaxTabbedPanel.findTabs(AjaxTabbedPanel.java:94)
>>>>>>>
>>>>>>> I have no idea what you have on that line, that is an old version. Check your source at that line. Or update Wonder and see if the problem goes away.
>>>>>>>
>>>>>>>
>>>>>>> Chuck
>>>>>>>
>>>>>>>
>>>>>>> On Jan 28, 2011, at 6:09 PM, Raghavender wrote:
>>>>>>>
>>>>>>>> Hi Chuck,
>>>>>>>>
>>>>>>>>>> WOActionResults res = super.invokeAction(aRequest, aContext);
>>>>>>>>>> ...
>>>>>>>>>> return ((WOComponent)res); // Exception occurring at this line-151.
>>>>>>>>>
>>>>>>>>
>>>>>>>> I have changed the casting from WOResponse to WOComponent, and now the error in the Session invokeAction(. .) method is not occurring. But the exception (InvokeTargetException) is occurring in the my Application's dispatchRequest(.) method, getting the following exception:
>>>>>>>>
>>>>>>>> Also I see a NullPointerException from the AjaxTabbedPanel class at the end of the following exception:
>>>>>>>> -------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>> 29193 [WorkerThread15] INFO NSLog - <DDStartPage name: DDStartPage subcomponents: null >
>>>>>>>> 29203 [WorkerThread15] WARN NSLog - <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
>>>>>>>> com.webobjects.foundation.NSForwardException [java.lang.reflect.InvocationTargetException] null:java.lang.reflect.InvocationTargetException
>>>>>>>> [2011-1-28 14:16:3 EST] <WorkerThread15> com.webobjects.foundation.NSForwardException [java.lang.reflect.InvocationTargetException] null:java.lang.reflect.InvocationTargetException
>>>>>>>> at com.webobjects.foundation._NSUtilities._explainInstantiationException(_NSUtilities.java:600)
>>>>>>>> at com.webobjects.foundation._NSUtilities.instantiateObject(_NSUtilities.java:620)
>>>>>>>> at com.webobjects.appserver.WOApplication.dynamicElementWithName(WOApplication.java:2404)
>>>>>>>> at com.webobjects.appserver.parser.WOHTMLWebObjectTag._elementWithClass(WOHTMLWebObjectTag.java:179)
>>>>>>>> at com.webobjects.appserver.parser.WOHTMLWebObjectTag._elementWithDeclaration(WOHTMLWebObjectTag.java:234)
>>>>>>>> at com.webobjects.appserver.parser.WOHTMLWebObjectTag.dynamicElement(WOHTMLWebObjectTag.java:155)
>>>>>>>> at com.webobjects.appserver.parser.WOBundleComponentTemplateParser.didParseClosingWebObjectTag(WOBundleComponentTemplateParser.java:68)
>>>>>>>> at com.webobjects.appserver.parser.WOHTMLParser.didParseClosingWebObjectTag(WOHTMLParser.java:194)
>>>>>>>> at com.webobjects.appserver.parser.WOHTMLParser.endOfWebObjectTag(WOHTMLParser.java:161)
>>>>>>>> at com.webobjects.appserver.parser.WOHTMLParser.parseHTML(WOHTMLParser.java:68)
>>>>>>>> at com.webobjects.appserver.parser.WOBundleComponentTemplateParser.parse(WOBundleComponentTemplateParser.java:109)
>>>>>>>> at com.webobjects.appserver.parser.WOHTMLTemplateParser.parse(WOHTMLTemplateParser.java:40)
>>>>>>>> at com.webobjects.appserver.parser.WOComponentTemplateParser.templateWithHTMLAndDeclaration(WOComponentTemplateParser.java:438)
>>>>>>>> at com.webobjects.appserver._private.WOComponentDefinition.template(WOComponentDefinition.java:364)
>>>>>>>> at com.webobjects.appserver.WOComponent.template(WOComponent.java:499)
>>>>>>>> at com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:1112)
>>>>>>>> at er.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:107)
>>>>>>>> at com.webobjects.appserver.WOSession.appendToResponse(WOSession.java:1385)
>>>>>>>> at er.extensions.appserver.ERXSession.appendToResponse(ERXSession.java:540)
>>>>>>>> at com.webobjects.appserver.WOApplication.appendToResponse(WOApplication.java:1794)
>>>>>>>> at er.extensions.appserver.ERXApplication.appendToResponse(ERXApplication.java:1704)
>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:242)
>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:298)
>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:332)
>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:369)
>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:442)
>>>>>>>> at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
>>>>>>>> at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:1802)
>>>>>>>> at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1767)
>>>>>>>> at Application.dispatchRequest(Application.java:505)
>>>>>>>> at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
>>>>>>>> at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
>>>>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>>>> Caused by: java.lang.reflect.InvocationTargetException
>>>>>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>>>>>>> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>>>>>> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>>>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>>>>>> at com.webobjects.foundation._NSUtilities.instantiateObject(_NSUtilities.java:614)
>>>>>>>> ... 31 more
>>>>>>>> Caused by: java.lang.NullPointerException
>>>>>>>> at er.ajax.AjaxTabbedPanel.findTabs(AjaxTabbedPanel.java:94)
>>>>>>>> at er.ajax.AjaxTabbedPanel.findTabs(AjaxTabbedPanel.java:107)
>>>>>>>> at er.ajax.AjaxTabbedPanel.<init>(AjaxTabbedPanel.java:75)
>>>>>>>> ... 36 more
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>>
>>>>>>>> Adding my Application's dispatchRequest(.) method code:
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>> public WOResponse dispatchRequest(WORequest aRequest){
>>>>>>>> //here we basically want to capture one recently served perfect request, so to get to this, we'll check the request as follows.
>>>>>>>> if(recentlyServedPerfectReq == null || canResetRecentlyServedPerfectReq || (recentlyServedPerfectReq.sessionID() != null && aRequest.sessionID() != null
>>>>>>>> && recentlyServedPerfectReq.sessionID().equals(aRequest.sessionID()) == false))
>>>>>>>> {
>>>>>>>> recentlyServedPerfectReq = aRequest;
>>>>>>>> canResetRecentlyServedPerfectReq = (recentlyServedPerfectReq.sessionID() == null);
>>>>>>>> }
>>>>>>>>
>>>>>>>> // first check if the session is created for this Request
>>>>>>>> // Session not created means, first time user
>>>>>>>> System.out.println("aRequest.sessionID()---->>>>>>"+aRequest.sessionID()); // Session is not null, printing the session ID
>>>>>>>> if(aRequest.sessionID() == null || (aRequest.sessionID() != null && aRequest.formValueForKey(".loginPage") != null) || (aRequest.sessionID() != null && aRequest.formValueForKey(".homePage") != null) || (aRequest.sessionID() != null && aRequest.formValueForKey(".exitPage") != null)){
>>>>>>>> //This is the case where the session is not created Yet or the first page is not LoginPage
>>>>>>>> return super.dispatchRequest(aRequest); // Exception is occurring at this line-505.
>>>>>>>> }else if(aRequest.sessionID() != null && aRequest.cookieValueForKey(aRequest.sessionID()) != null){
>>>>>>>> // This is the case where the session is created and there is a cookie created in this request
>>>>>>>> // check to see if the cookie matches the one that's set
>>>>>>>> String userNameInSes = "";
>>>>>>>> String hostNameInReq = "";
>>>>>>>> String cookieValue = aRequest.cookieValueForKey(aRequest.sessionID());
>>>>>>>> if(this.sessionStore() != null && this.sessionStore().restoreSessionWithID(aRequest.sessionID(),aRequest) != null){
>>>>>>>> userNameInSes = ((Session)this.sessionStore().restoreSessionWithID(aRequest.sessionID(),aRequest)).loginUser().fullName();
>>>>>>>> hostNameInReq = getHostNameFromRequest(aRequest);
>>>>>>>>
>>>>>>>>
>>>>>>>> //System.out.println(" Cookie Value Constructed from session and request values= " + userNameInSes+hostNameInReq);
>>>>>>>>
>>>>>>>> // check to see if the value of cookie is same as that obtained now
>>>>>>>> if((userNameInSes+hostNameInReq).equals(cookieValue)){
>>>>>>>> // success. Send the user to the respective Page
>>>>>>>> return super.dispatchRequest(aRequest);
>>>>>>>>
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> }
>>>>>>>> // Any of the case doesn'e match, send the user to the login Page.
>>>>>>>> WOResponse res = new WOResponse();
>>>>>>>> WOComponent redirectPage = pageWithName("Main",createContextForRequest(aRequest));
>>>>>>>> WOResponse resp = redirectPage.generateResponse();
>>>>>>>> res.setContent(resp.contentString());
>>>>>>>> //res.setContent("<html><body><h1>Error</h1></body></html>");
>>>>>>>> return res;
>>>>>>>> }
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Raghu.
>>>>>>>>
>>>>>>>> On 28-Jan-11, at 10:15 PM, Chuck Hill wrote:
>>>>>>>>
>>>>>>>>>> WOActionResults res = super.invokeAction(aRequest, aContext);
>>>>>>>>>> ...
>>>>>>>>>> return ((WOResponse)res); // Exception occurring at this line-151.
>>>>>>>>>
>>>>>>>>> Perhaps if you cast correctly? The issue is with your code, not AjaxTabbedPanel.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Jan 28, 2011, at 6:53 AM, Raghavender wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I am trying to implement Project Wonder's AjaxTabbedPanel and AjaxTabbedPanelTab in my application by following the Wonder Ajax Examples from the link http://webobjects.mdimension.com/cgi-bin/WebObjects/AjaxExample.woa/1 . But after added these AjaxTabbedPanel and AjaxTabbedPanelTab in my component's html and wod files then my page is not loading, getting the following exception:
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>>>> 23848 [WorkerThread15] WARN NSLog - <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
>>>>>>>>>> java.lang.ClassCastException: DDStartPage cannot be cast to com.webobjects.appserver.WOResponse
>>>>>>>>>> [2011-1-28 9:42:11 EST] <WorkerThread15> java.lang.ClassCastException: DDStartPage cannot be cast to com.webobjects.appserver.WOResponse
>>>>>>>>>> at Session.invokeAction(Session.java:151)
>>>>>>>>>> at com.webobjects.appserver.WOApplication.invokeAction(WOApplication.java:1745)
>>>>>>>>>> at er.extensions.appserver.ajax.ERXAjaxApplication.invokeAction(ERXAjaxApplication.java:50)
>>>>>>>>>> at er.extensions.appserver.ERXApplication.invokeAction(ERXApplication.java:1687)
>>>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedPage(WOComponentRequestHandler.java:206)
>>>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:298)
>>>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:332)
>>>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:369)
>>>>>>>>>> at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:442)
>>>>>>>>>> at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
>>>>>>>>>> at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:1802)
>>>>>>>>>> at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1767)
>>>>>>>>>> at Application.dispatchRequest(Application.java:503)
>>>>>>>>>> at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
>>>>>>>>>> at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
>>>>>>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> My Application and Session classes extends ERXApplication and ERXSession classes.
>>>>>>>>>>
>>>>>>>>>> Any help would be appreciated.
>>>>>>>>>>
>>>>>>>>>> Also adding my Session class invokeAction method code:
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>>>> public WOActionResults invokeAction(WORequest aRequest, WOContext aContext) {
>>>>>>>>>>
>>>>>>>>>> WOElement element = (WOElement)requestLookup.objectForKey(aRequest.uri());
>>>>>>>>>> if ( element == null ) {
>>>>>>>>>> WOActionResults res = super.invokeAction(aRequest, aContext);
>>>>>>>>>> try{
>>>>>>>>>> element = ((WOComponent)res).template();
>>>>>>>>>> }catch(Exception e){
>>>>>>>>>> e.printStackTrace();
>>>>>>>>>> return ((WOResponse)res); // Exception occurring at this line-151.
>>>>>>>>>> }
>>>>>>>>>> if (res!=null && element != null && !isReportMillComponent(element)) {
>>>>>>>>>> requestLookup.setObjectForKey(element, aRequest.uri());
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>> return res;
>>>>>>>>>> }
>>>>>>>>>> else if ( element instanceof WOComponent ){
>>>>>>>>>> ((WOComponent)element).ensureAwakeInContext(aContext);
>>>>>>>>>> return (WOComponent)element;
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>> return null;
>>>>>>>>>> }
>>>>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>> Raghu.
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>>>
>>>>>>>>>> This email sent to email@hidden
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Chuck Hill Senior Consultant / VP Development
>>>>>>>>>
>>>>>>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>>>>>>> http://www.global-village.net/products/practical_webobjects
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Chuck Hill Senior Consultant / VP Development
>>>>>>>
>>>>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>>>>> http://www.global-village.net/products/practical_webobjects
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Chuck Hill Senior Consultant / VP Development
>>>>
>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>> http://www.global-village.net/products/practical_webobjects
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> Chuck Hill Senior Consultant / VP Development
>>
>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>>
>>
>>
>>
>>
>>
>>
>
>
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden