tags:

views:

17

answers:

1

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?

+1  A: 

You can't use navigation cases for this. Use h:outputLink with a direct URL.

<h:outputLink value="http://google.com"&gt;Click&lt;/h:outputLink&gt;

Or just plain vanilla HTML.

<a href="http://google.com"&gt;Click&lt;/a&gt;

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">.

BalusC
Is there a way to do it with a button though? Or is there a way to make the <h:outputLink> element look like a button? The user design requirement is a button... :-/
Brian Knoblauch
<h:commandButton> with the bean works perfect! Thanks!
Brian Knoblauch
You're welcome.
BalusC