This content has been marked as final.
Show 4 replies
-
1. Re: How to retain the values of text field on link click, tried using s:link ..
cosmo Nov 26, 2008 2:23 PM (in response to valatharv)Hello,
is the value submited to the form bean null or the value that it is shown after page reload is null?If it is the first one I think you need to remove the immediate="true"?
If it is the second one, I believe you need to define a explicit conversation in the form backing bean. -
2. Re: How to retain the values of text field on link click, tried using s:link ..
diegocoronel Nov 26, 2008 4:26 PM (in response to valatharv)try c:forEach instad ui:repeat
-
3. Re: How to retain the values of text field on link click, tried using s:link ..
valatharv Nov 26, 2008 8:17 PM (in response to valatharv)Reagent entity contains treatment and 1 reagent can have multiple treatments.
Please suggest.....
a) I need to use immediate as link was not working on first click and hashcode from UI was not matching the entity.
Here, I am matching the hashcode from ui with the one of an entity and adding a row to UI..
b) UI:repeat works fine, all logic is implemented accordingly, I am not sure how I can replace c:for each, any suggestions
<ui:repeat value="#{projectHome.reagent}" var="info" >
<h:inputText id="pname1" required="true" value="#{info.pname}"/>
....
<ui:repeat value="#{info.treatment}" var="itreat">
<h:inputText id="treatmentCompoundName" value="#{itreat.treatmentCompoundName}"/>
......
</ui:repeat>
<h:commandLink action="#{projectHome.addTreatmentLink}"
value="Add treatments" immediate="true" >
<f:param name="re_hashcode" value="#{info.hashCode()}"/>
</h:commandLink>
</ui:repeat>
public String addTreatmentLink(){
javax.faces.context.FacesContext facesContext = (new org.jboss.seam.faces.FacesContext()).getContext();
javax.servlet.http.HttpServletRequest hsr=(javax.servlet.http.HttpServletRequest)facesContext.getCurrentInstance().getExternalContext().getRequest();
String reagentHashcode=hsr.getParameter("re_hashcode");
for(int i=0;i<reagent.length;i++){
if(reagent[i].hashCode()==Integer.parseInt(reagentHashcode)){
reagent[i].getTreatment().add(new Treatment());
break;
}
}
return "";
} -
4. Re: How to retain the values of text field on link click, tried using s:link ..
valatharv Nov 29, 2008 9:21 PM (in response to valatharv)Please suggest..... it is very important...
I used immediate=true as link was not working on first click and hashcode from UI was not matching the hashcode of entity.
Here, I am matching the hashcode from ui with the one of an entity and adding a row to UI..
I just need that on clicking "Add Treatment" link "pname1" text field should not become null... please check the code above and help...