Hi Gerardo,
Thanks for your reply.
First:
I cannot use the button since all forms will submit to a single �button action� method which will dispatch the request to different handlers based on the value of the hidden field.
So if I have two forms both of them will have buttons with action = �myBean.process()�, but each form is doing a different action. �myBean.process()� needs to figure out which form is calling it so it takes the right action. Here the hidden field comes into play. I�m not sure how the button will help here.
Secondly, when using
�<h:inputText id="profileId" value="#{myForm.profileId}" size="25"/>�
Would display a text field to the user which I don�t want to. This field should be hard-coded in the jsp form and has nothing to do with the current user
Finally
I�m doing exactly what you described to find out what is the formId, but looks to me too much work to just set a value for a bean property.
Here is what I�m doing to get the formId:
Map parameterMap = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
if (parameterMap.size() > 0) {
Set keys = parameterMap.keySet();
Iterator iter = keys.iterator();
while (iter.hasNext()) {
String key = (String) iter.next();
if (key != null && key.length() > 0) {
int index = key.trim().indexOf(':');
if (index == -1) {
continue;
} else {
formId = key.trim().substring(0, index);
break;
}
}
}
}
String operKey = formId + "
perationId";
I�m not sure if this the right way to do that, I thought JSF may have an easier way to do what I�m trying to do. In struts you can do that in one line!
<html:hidden property="action" name="MyBean" value = "add"/> .
Thanks