Skip navigation
JBossDeveloper
Log in
Register
JBoss Community Archive (Read Only)
Home
Content
Places
Search
Cancel
Error: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page.
All Places
>
Seam
>
Seam 2
>
Discussions
Please enter a title.
You can not post a blank message. Please type your message and try again.
Body
This project is read only now.
0 Replies
Latest reply
on Nov 24, 2008 11:23 PM by valatharv
Please help problem comparing hash code of entity, need to click link twice
valatharv
Nov 24, 2008 11:23 PM
I am trying to pass hashcode from xhtml page which needs to be compared with entity hashcode. I have a commandLink which adds a row on the UI.
Issue is on clicking commandLink first time page refreshes but row is not added because the hashcode is not equal.
But when I click the link again it works fine and row is added ...
PLEASE help what is weird in the code and how can I rectify it...
<h:commandLink action="#{projectHome.addTreatmentLink}"
value="Add treatments">
<f:param name="re_hashcode" value="#{info.hashCode()}"/>
</h:commandLink>
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 "";
}
This content has been marked as final.
Show 0 replies