Re: Question about java method calling
Re: Question about java method calling
- Subject: Re: Question about java method calling
- From: Michael DeMan (GS0) <email@hidden>
- Date: Wed, 6 Oct 2004 16:06:20 -0700
Yes, very handy.
The following has worked for me in the past...
public WOActionResults responseForPageWithName(String pageName) {
PCPage page = (PCPage) pageWithName(pageName);
WORequest r = context().request();
Enumeration keyEnum = r.formValueKeys().objectEnumerator();
while (keyEnum.hasMoreElements()) {
String key = (String) keyEnum.nextElement();
page.takeValueForKey(r.formValueForKey(key), key);
}
if ((page.loginRequired()!=null) && (pcSession().currentUser()==null)) {
LoginPage login = (LoginPage) pageWithName("LoginPage");
login.setPreviousPage(page);
login.setNextPage(page);
WOResponse woresponse = login.generateResponse();
woresponse.disableClientCaching();
}
WOResponse woresponse = page.generateResponse();
woresponse.disableClientCaching();
return woresponse;
}
public WOActionResults performActionNamed(String s) {
NSLog.err.appendln("PCDirectAction - action: " + s);
WOActionResults woactionresults = null;
Method amethod[] = _NSReflectionUtilities.methodsOnClass(getClass());
if(amethod != null && amethod.length > 0) {
for (int m = 0; m < amethod.length; m++) {
if (amethod[m].getName().indexOf(s)>0) return super.performActionNamed(s);
}
}
return responseForPageWithName(s);
}
On Oct 6, 2004, at 3:30 PM, Kevin Xiaowen Ren wrote:
Could I know the code for " The default implementation of WODirectAction's performActionName() appends "Action" to the method's argument. "?
I am trying to call some dynamic method by method name string in class.?
thanks
kevin
At 11:57 6/10/2004 -1000, you wrote:
On Oct 6, 2004, at 11:58 AM, Kevin Xiaowen Ren wrote:
In WO, we have DirectAction class and we call some method, like logonAction, by passing string "logon" in some component.
I'm just wandering there is the similar functionality in Java?
The default implementation of WODirectAction's performActionName() appends "Action" to the method's argument. So the same functionality is available in your Java code.
Aloha,
Art
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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