on 01-20-2006 12:21 PM
Hello!
I try to use the requestFocus method in my wd prog but I get a dump like:
Error stacktrace:
java.lang.NullPointerException
at sap.com.telia.inputview.InputView.wdDoModifyView(InputView.java:138)
at sap.com.telia.inputview.wdp.InternalInputView.wdDoModifyView(InternalInputView.java:405)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)
at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:190)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.doModifyView(ClientComponent.java:397)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.modifyView(ClientApplication.java:613)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:372)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:640)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
This is my code in wdDoModifyView:
public static void wdDoModifyView(IPrivateInputView wdThis, IPrivateInputView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if(firstTime) {
IWDInputField input = (IWDInputField)view.getElement("CustomerID");
input.requestFocus();
}
//@@end
}
CustomerID is not in a separate node, it's a value directly under rootnode.
I have CustomerID set as a String, is that a problem?. I just want focus to be on this field when the program starts.
I have a separate method for getting data (I know...it's a ugly hack but I'm a n00b and in the learningphase :
//@@begin javadoc:onActionretrieveData(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionretrieveData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionretrieveData(ServerEvent)
String firstCustomerId = "1234";
String secondCustomerId = "501025";
String usedCustomerId = wdContext.currentContextElement().getCustomerID();
if((usedCustomerId.equals(firstCustomerId)) || (usedCustomerId.equals(secondCustomerId))) {
wdThis.wdGetTeliaPortalDemoCompController().Clear();
wdThis.wdGetTeliaPortalDemoCompController().fillView();
} else wdThis.wdGetTeliaPortalDemoCompController().Clear();
//@@end
}
Hello Peter,
Could you post the code that coressponds to line number 138 in the view <i>InputView</i>?.
Bala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Bala!
That line is actually "input.requestFocus();" of
public static void wdDoModifyView(IPrivateInputView wdThis, IPrivateInputView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if(firstTime) {
IWDInputField input = (IWDInputField)view.getElement("CustomerID");
input.requestFocus();
}
//@@end
}
Peter,
Check ID of InputField. It is not a CustomerID, probably CustomerID is context attribute, but InputField has different id -- see view layout.
Valery Silaev
EPAM Systems
Instead of using IWDViewElement.requestFocus(), you could also use the "indirect" way
IWDViewController.requestFocus(IWDNodeElement nodeElement, IWDAttributeInfo attribute)
This method requests focus for the given context attribute in your case the attribute to which the "value" property of the InputField is bound.
Armin
Peter,
Please read this: https://www.sdn.sap.com/irj/sdn/crphelp.
And please close threads yor opened.
VS
User | Count |
---|---|
77 | |
9 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.