f:param with <h:commandLink
843844Jan 21 2009 — edited Jan 22 2009Hi,
i'am trying to send some parameter with <f:param via <h:commandLink. But action and show_type parameters don't send next page (actually i sended itself).
What is my mistake? Do you have any suggestion.
Note: If i dont use <redirect/> direction in navigation-rule it works, but i want to change address bar.
myJSF Code;
<%
String show_type = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("show_type");
String action = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("action");
out.println("show_type ="+show_type);
out.println("action ="+action);
%>
<f:view locale="en">
<h:form>
<h:commandLink value="Denemeye Değer" action="#{panelMenu.updateCurrent}">
<f:param name="action" value="web_manpage" />
<f:param name="show_type" value="post" />
</h:commandLink>
</h:form>
</f:view>
Bean Class;
public class PanelMenu {
private String action;
private String show_type;
public String updateCurrent() {
FacesContext context=FacesContext.getCurrentInstance();
String returnValue = context.getExternalContext().getRequestParameterMap().get("action");
// i can get action and show_type parameteres in this method
System.out.println("updateCurrent action = "+getCurrent());
System.out.println("show_type parametresi = "+context.getExternalContext().getRequestParameterMap().get("show_type"));
return returnValue;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getShow_type() {
return show_type;
}
public void setShow_type(String show_type) {
this.show_type = show_type;
}
}
and faces-config.xml;
<managed-bean>
<managed-bean-name>panelMenu</managed-bean-name>
<managed-bean-class>net.lms.bean.PanelMenu</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>action</property-name>
<value>#{param.action}</value>
</managed-property>
<managed-property>
<property-name>show_type</property-name>
<value>#{param.show_type}</value>
</managed-property>
</managed-bean>
<navigation-rule>
<from-view-id>/cp/*</from-view-id>
<navigation-case>
<from-outcome>account_pass</from-outcome>
<to-view-id>/cp/account_pass.jsp</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
Have a nice day.
Edited by: veli_akcakaya on Jan 21, 2009 1:29 PM