Hello,
I have in a doProcessBeforeOutput the code:
String url = myProfile.getProperty("url").toString();
String navigationAction = "EPCM.doNavigate('" + url + "',0)";
Button myButton = (Button) getComponentByName("ButtonSearch");
<b> myButton.setOnClientClick(navigationAction);</b>
at the bolded line I get "java.lang.NullPointerException"
Thanks for any feedback
Regards,
Altafin
Hi Altafin,
as I know, the getComponentByName will only be something (not null) if your current request is issued from an HTMLB iView which had a button with id 'ButtonSearch'. (Typical form handling). This way you'll get something alike the button that was created in the previous request.
Regards,
Armin
Hi Altafin,
looks like you want to <u>create</u> a button...
So how about:
Button button = new Button("ButtonSearch", "ButtonSearch");
button.setOnClientClick(navigationAction);
getComponentByName(..) is used in doProcessAfterInput to get a component out of the pagecontext. An example is reading the value of an input field:
InputField myInputField = (InputField) getComponentByName("USER_NAME");
if (myInputField != null) {
this.name = myInputField.getValueAsDataType().toString();
}
Regards, Karsten
edit: damn, Armin was faster 😉
Message was edited by: Karsten Stombrowski
Add a comment