Foren

h:button and h:link

PortletFaces Community Member, geändert vor 12 Jahren.

h:button and h:link

Regular Member Beiträge: 199 Beitrittsdatum: 03.04.12 Neueste Beiträge
I'm having problems using these elements, but I don't know if it has anything to do with the bridge.
I'm using version 2.0.1 of the bridge in Liferay. When I use these elements, the generated html is:
"onclick="window.location.href='null';", i.e. the button or link doesn't work.

Could this be a problem with the bridge or should I search elsewhere?
thumbnail
Johann Kneringer, geändert vor 12 Jahren.

RE: h:button and h:link

Junior Member Beiträge: 42 Beitrittsdatum: 10.11.11 Neueste Beiträge
If you want to navigate to a certain view, you have to use the "action" with an outcome...

You have to use h:commandButton or h:commandLink

If you have 2 views, mypage1.xhtml & mypage2.xhtml, and you want to navigate from view 1 to 2, you have to make a h:commandButton on view1. Write in the action of the commandbutton "mypage2".

If this wont work, you have to define certain navigation rules in your faces-config.xml....


Check the demo-portlets for further information
PortletFaces Community Member, geändert vor 12 Jahren.

RE: h:button and h:link

Regular Member Beiträge: 199 Beitrittsdatum: 03.04.12 Neueste Beiträge
As I understand it, h:button and h:link were introduced in JSF 2 to support navigation using HTTP GET, as opposed to using HTTP POST when e.g. h:commandButton is used. Of course I can use h:commandButton but it seems unnecessary to use POST when there's no form data to process.
PortletFaces Community Member, geändert vor 12 Jahren.

RE: h:button and h:link

Regular Member Beiträge: 199 Beitrittsdatum: 03.04.12 Neueste Beiträge
Bumping this thread.
Has any one successfully used h:button or h:link in a portlet?
thumbnail
Neil Griffin, geändert vor 9 Jahren.

RE: h:button and h:link

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Please refer to alloy:button and alloy:link in the Liferay Faces Showcase.
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: h:button and h:link

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
PortletFaces Community Member:
When I use these elements, the generated html is:"onclick="window.location.href='null';", i.e. the button or link doesn't work.


Okay, no one has asked the obvious, so I will. What exactly are you trying to use with the tags? Can you share the full use of the tag? I mean, not to be condescending or anything, but if you just add a <h:link /> tag with no attributes and no children, well then the generated html would be nonsense (even though you really can't do a link in this way, it's just an example to show how you might get bad generated code because the tag itself doesn't have enough to make sense).