jsf and action problem

hi

i would like to realize this one:

i have two links. If i click one link the application loads one special site, clicking other link other site will be loaded. How can I do that. Here is what i have:

....

menu.jsp (with my links)

....

<h:commandLink id="german" title="#{myMsg.link_german}" action="?" value ="#{myMsg.link_german}" onmousedown="?"></h:commandLink>

<h:commandLink id="english" title="#{myMsg.link_english}" action="?" value ="#{myMsg.link_english}" onmousedown="?"></h:commandLink>

.....

data.jsp (with my sites included)

.....

<h:panelGrid>

<f:facet name="header">

<f:subview id="header">

<jsp:include flush="true" page="header.jsp"></jsp:include>

</f:subview>

</f:facet>

<f:verbatim>

<jsp:include flush="true" page="html/data1.html"></jsp:include>

</f:verbatim>

(this page i would like to change in dependance of clicking the links->data1)

<f:facet name="footer">

<f:subview id="footer">

<jsp:include flush="true" page="footer.jsp"></jsp:include>

</f:subview>

</f:facet>

</h:panelGrid>

how can i do that?With javascript or serverside code?How can i say my program: now you should include other page?

Thanks in advance

[1982 byte] By [naekoa] at [2007-11-26 15:12:49]
# 1

Hello

You can include/exclude content using a components 'rendered' attr. This is true by default.

To control any attribute you need to bind it to a property (or function) in a backing bean using the notation #{beanName.property}. This would match a managed bean named 'beanName' and its field 'property' which also must has a getProperty/setProperty as per the JavaBean spec.

Your action however can simply bind to a method or your making...if the function returns void you will load the current page, if its returns a string then JSF wil atempt to resolve the name to a JSF page configured in your faces-config.xml.

action="#{bean.performXyz}"

A possible solution to your problem is to wrap your included pages in f:subview tags which have a rendered attr you can set/control.

Bind the attr to a display boolean in the backing bean then on click you can set the value of the boolean which in turn controls if the subview and its content should be displayed....I had a very simple problem in my last post (see 15 Jan JSTL inside JSF Component)

This might not be exactly what your after, but should help I hope.

jamesclintona at 2007-7-8 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
This article might be useful: http://balusc.xs4all.nl/srv/dev-jep-djs.html
BalusCa at 2007-7-8 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...