-
1. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 3, 2009 2:14 AM (in response to sumeet.singh)when i click on my command button i got the following error:
"Component frmRoleRevokeAndGrant:listShuttle1 has invalid value expression [com.test.smp.pojo.SmpRoleNames@1ceea9d]"
SmpRoleNames is my POJO class having roleId and RoleName as a parameters.
the targetValue and sourceValue linked with properties having datatype ArrayList -
2. Re: unable to catch <h:commandButton> action event while usi
ilya_shaikovsky Nov 3, 2009 5:13 AM (in response to sumeet.singh)read please limitations regarding converter implementation required for component and equals/hasCode methods proper implementation for object.
richfaces-demo has samples which could be downloaded from anonimous SVN. (links at wiki and project site) -
3. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 4, 2009 12:30 AM (in response to sumeet.singh)Hi,
thanks for your reply. I checked the same but still facing the same error. I implemented the hascode and the equals method also but still facing the same problem -
4. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 4, 2009 12:57 AM (in response to sumeet.singh)hi,
where to find "limitations regarding converter implementation required for component"? -
5. Re: unable to catch <h:commandButton> action event while usi
nbelaevski Nov 4, 2009 5:52 AM (in response to sumeet.singh)Look at user guide.
-
6. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 4, 2009 6:23 AM (in response to sumeet.singh)I checked the same but still facing the same error. I implemented the hascode and the equals method also but still facing the same problem
-
7. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 4, 2009 7:39 AM (in response to sumeet.singh)hi,
I even tried the following solution but still facing the same problem:
https://jira.jboss.org/jira/browse/RF-6951
I think there is some thing wrong with component listshuttle.
The examples currently available does not have the command button in it.
I want to retrieve the targetValue values after clicking on the Command button. I want to process and stores the value of targetValue in database.
Please help -
8. Re: unable to catch <h:commandButton> action event while usi
nbelaevski Nov 4, 2009 8:29 AM (in response to sumeet.singh)Check if there are any messages generated.
-
9. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 4, 2009 10:12 AM (in response to sumeet.singh)hi,
i got a message:Component frmRoleRevokeAndGrant:listShuttle1 has invalid value expression [com.test.smp.pojo.SmpRole Names@1ceea9d]
Don't you think that there is some problem with listShuttle component.
I want to retrieve the targetValue values after clicking on the Command button. I want to process and stores the value of targetValue in database. -
10. Re: unable to catch <h:commandButton> action event while usi
nbelaevski Nov 4, 2009 3:13 PM (in response to sumeet.singh)What is bean code?
-
11. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 5, 2009 6:12 AM (in response to sumeet.singh)My Mannaged bean is :
public class RoleReAssignment { // Instance Variables private String strNewRoleId; private String strUserName; private List<SmpRoleNames> lstCurrentRoles = new ArrayList<SmpRoleNames>(); private List<SmpRoleNames> lstAvailableRoles = new ArrayList<SmpRoleNames>(); // Zero Argument constructor public RoleReAssignment() { HttpServletRequest rq = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpSession sess = CommonMethods.fetchSession(rq); if(sess!=null && sess.getAttribute("USERNAME_REASSIGNMENT")!=null) { String username = (String)sess.getAttribute("USERNAME_REASSIGNMENT"); if(username!=null) { if(!username.equals("DEFAULT")) { SmpRoleModel objRoleModel = new SmpRoleModel(); this.lstCurrentRoles = objRoleModel.fetchRoleIdAndNameRelatedToUser(username, true); this.lstAvailableRoles = objRoleModel.fetchRoleIdAndNameRelatedToUser(username, false); this.strUserName = username; sess.removeAttribute("USERNAME_REASSIGNMENT"); } } } } //Getter and setters public String getStrNewRoleId() { return strNewRoleId; } public void setStrNewRoleId(String strNewRoleId) { this.strNewRoleId = strNewRoleId; } public List<SmpRoleNames> getLstCurrentRoles() { return lstCurrentRoles; } public void setLstCurrentRoles(List<SmpRoleNames> lstCurrentRoles) { this.lstCurrentRoles = lstCurrentRoles; } public List<SmpRoleNames> getLstAvailableRoles() { return lstAvailableRoles; } public void setLstAvailableRoles(List<SmpRoleNames> lstAvailableRoles) { this.lstAvailableRoles = lstAvailableRoles; } public String getStrUserName() { return strUserName; } public void setStrUserName(String strUserName) { this.strUserName = strUserName; } //Business logic methods public String roleRevokeAndGrant() { System.out.println("HI FROM roleRevokeAndGrant ===============>"); System.out.println("CURRENTLY SELECTED ROLES ==> "+this.lstCurrentRoles); return ""; } //Action Listener /** * @comment : Method to fetch the details according to user name * @return */ public void fetchDetailsAccordingToUserName(ActionEvent evt) { HttpServletRequest rq = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); String username = rq.getParameter("frmRoleRevokeAndGrant:USERNAME"); HttpSession sess = CommonMethods.fetchSession(rq); sess.setAttribute("USERNAME_REASSIGNMENT", username); } public ArrayList<SmpUserNames> userNameAutocomplete(Object evt) { ArrayList<SmpUserNames> result = new ArrayList<SmpUserNames>(); String pref = (String)evt; ArrayList<SmpUserNames> preCapturedusername = new SmpUserModel().fetchSmpUserNames(); for(int i=0; i<preCapturedusername.size(); i++) { if ((preCapturedusername.get(i).getStrUserNames() != null && preCapturedusername.get(i).getStrUserNames().toLowerCase().indexOf(pref.toLowerCase()) == 0) || "".equals(pref)) { result.add(preCapturedusername.get(i)); } } return result; } }
AND my SmpRoleNames POJO class is:public class SmpRoleNames { // Zero argument constructor public SmpRoleNames() {} // Instance variables private String strRoleName; private String strRoleId; // Constructor with arguments public SmpRoleNames(String roleName) { this.strRoleName = roleName; } public SmpRoleNames(String strRoleId, String roleName) { this.strRoleId = strRoleId; this.strRoleName = roleName; } // Setter Getter methods public String getStrRoleName() { return strRoleName; } public void setStrRoleName(String strRoleName) { this.strRoleName = strRoleName; } public String getStrRoleId() { return strRoleId; } public void setIRoleId(String strRoleId) { this.strRoleId = strRoleId; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((strRoleId == null) ? 0 : strRoleId.hashCode()); result = prime * result + ((strRoleName == null) ? 0 : strRoleName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SmpRoleNames other = (SmpRoleNames) obj; if (strRoleId == null) { if (other.strRoleId != null) return false; } else if (!strRoleId.equals(other.strRoleId)) return false; if (strRoleName == null) { if (other.strRoleName != null) return false; } else if (!strRoleName.equals(other.strRoleName)) return false; return true; } }
-
12. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 5, 2009 6:20 AM (in response to sumeet.singh)I am also using my own converter:
public class GenericConverter implements Converter { public Object getAsObject(FacesContext context, UIComponent component, String value) { System.out.println("VALUE ====> "+value); int index = value.indexOf(':'); System.out.println("VALUE OBJECT ====> "+value.substring(0, index).trim()+":"+value.substring(index + 1).trim()); return new SmpRoleNames(value.substring(0, index).trim(), value.substring(index + 1).trim()); } public String getAsString(FacesContext context, UIComponent component,Object value) { SmpRoleNames taskbean = (SmpRoleNames) value; System.out.println("VALUE IN CONVERTER ========> "+taskbean.getStrRoleId() + ":" + taskbean.getStrRoleName()); return taskbean.getStrRoleId().trim()+":"+taskbean.getStrRoleName().trim(); } }
I tried a lot but still facing the same problem.
I checked in other forums also, some more guys are facing the same problem:
http://www.coderanch.com/t/453055/JSF/java/list-shuttle-exception
but still facing the same problem -
13. Re: unable to catch <h:commandButton> action event while usi
nbelaevski Nov 5, 2009 8:40 AM (in response to sumeet.singh)Try using Collection instead of List
-
14. Re: unable to catch <h:commandButton> action event while usi
sumeet.singh Nov 5, 2009 10:14 AM (in response to sumeet.singh)I will surely try your suggestion, but can you please explain that why you suggest Collection instead of List. Is their anything related to this error? can you please explain