Re: WOHyperlink does not work?
Re: WOHyperlink does not work?
- Subject: Re: WOHyperlink does not work?
- From: Johann Werner <email@hidden>
- Date: Tue, 17 Jul 2007 17:33:04 +0200
Thanks for the tip.
The actMenuStatus is a function to define the active menu and uses a
counter variable:
public boolean actMenuStatus() {
return actMenu == actMenuCounter++ ? true : false;
}
That way I am able to add new menu items to the html file reusing
that same function so no change to the java code is necessary.
I added invokeAction() to retrieve the needed value from the parent
again prior to calling super (as it is a stateless component all
values were reset). And now the links are working again :-)
jw
Am 17.07.2007 um 16:19 schrieb Alexander Spohr:
Johann,
what does actMenuStatus do?
I bet you switch state between appendToResponse and invokeAction.
At least your usage of that var/method looks like you have one
boolean that toggles while you draw the page. When the page comes
back to execute the action your actMenuStatus is always false (or
another menu is true now), therefore the component can not find the
hyperlink that you clicked (its just not there anymore). And so
your action can’t be fired.
Tip: Check the value of actMenuStatus in takeValues and invokeAction.
atze
ps.
actual = tatsächlich,
current = aktuell.
Am 17.07.2007 um 15:40 schrieb Johann Werner:
Hi all,
I am a little bit puzzled by the behaviour of some hyperlinks so I
am posting this here, perhaps someone can point me to the error I
must have overlooked.
I have a html page with a menu structure that is wrapped around
the actual content page. That PageWrapper component is set to
isStateless = true and synchronizesVariablesWithBindings = false.
The menu is coded as an unnumbered list for top menu items and
another ul for secondary menu items. These secondary menu items
are wrapped by a WOConditional as to show only those for the
actual selected top menu item. The structure in the html file is:
<div id = "navbar">
<div id = "menue">
<ul>
<li>
<webobject name = "Link1">
<webobject name = "News" /> // primary menu item
</webobject>
<webobject name = "ActMenuStatus">
<ul>
<li>
<webobject name = "UMenu1">
<webobject name = "Inbox" /> // secondary menu item
</webobject>
</li>
<li>
<webobject name = "UMenu2">
<webobject name = "NewMessage" /> // secondary
menu item
</webobject>
</li>
</ul>
</webobject>
</li>
[…]
<li>
<webobject name = "Link5">
<webobject name = "Preferences" /> // primary menu item
</webobject>
<webobject name = "ActMenuStatus">
<ul>
<li>
<webobject name = "UMenu5">
<webobject name = "User Settings" /> //
secondary menu item
</webobject>
</li>
</ul>
</webobject>
</li>
</ul>
</div>
</div>
<div id = "content">
<webobject name = "PageContent"></webobject>
</div>
</webobject>
The .wod file has this content (reduced to those for the three
first links and the conditional for clarity):
Link1: WOHyperlink {
action = parent.goNews;// VALID
id = idStatus;
}
UMenu1 : WOHyperlink {
action = parent.goNews;// VALID
id = idStatusUntermenu;
}
UMenu2 : WOHyperlink {
pageName = "NewMessage";
id = idStatusUntermenu;
}
ActMenuStatus : WOConditional {
condition = actMenuStatus;
}
In the action binding of Link1 and UMenu1 I call a function that
is located in the parent page that is wrapped by the menu page.
The strange thing is that the hyperlink Link1 is working
flawlessly but the link UMenu1 that has the very same action
binding does not. Even the link UMenu2 that just call pageWithName
does not work. I overrode that function in the menu component and
set a debugging breakpoint but apparently the function is never
called. Every click on one of the not working links returns the
same page (context ID changes but nothing else).
So what could be wrong? Could it be related to the statelessness
of the component? But if it is so then why does the first link
work but the other one not? Looking at the syntax of the href in
the webpage source in the webbrowser each links seems correct.
jw
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40freeport.de
This email sent to email@hidden
Freeport & Soliversum
Alexander Spohr
email@hidden
www.freeport.de
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