Reputation: 21369
On my JSF website, I've got a couple elements that I'd like to use to cause navigation to our old classic ASP site (no data needs survive, just simple navigation). What's the best way to do this?
Thoughts so far: - Using the outcome/navigation rules implies that you're staying within the same site. Can it be used to navigate outside?
Upvotes: 2
Views: 1017
Reputation: 1108802
You can't use navigation cases for this. Use h:outputLink
with a direct URL.
<h:outputLink value="http://google.com">Click</h:outputLink>
Or just plain vanilla HTML.
<a href="http://google.com">Click</a>
Update:
A <h:commandButton>
is also doable, but then you have to add a bean action method which does ExternalContext#redirect()
to the desired URL.
public void submit() {
FacesContext.getCurrentInstance().getExternalContext().redirect("http://google.com");
}
An alternative is indeed to style the link to make it look like a button. Here's a kickoff example:
a.button {
display: inline-block;
background: lightgray;
border: 2px outset lightgray;
cursor: default;
}
a.button:active {
border-style: inset;
}
Use it as <h:outputLink styleClass="button">
or <a class="button">
.
Upvotes: 3