Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Jsf problem

  Asked By: Howard    Date: Dec 11    Category: Java    Views: 1223
  

I want to send parameter with action in jsf ,my code in jsp page is:


<h:commandLink action="#{personBean.delete}">
<f:param name="selectpersonalid" value="#
{items.personalid}"/>
<h:outputText value="Delete"/>
</h:commandLink>

and I wrote the function in manageBean for get parameter:
(String) FacesContext.getCurrentInstance().getExternalContext
().getRequestParameterMap().get("selectpersonalid");
But when run program ,error appered
I give parameter from list in datatable.
and
I need ebooks about jsf,which site I can download ebook about jsf?

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Casey Montgomery     Answered On: Dec 11

plz check these stuffs, hopefully they work out. (not sequential)

1. "items" must be defined as a variable of <f:dataTable e.g.:
<t:dataTable value="#{aBean.collectionItems}" var="items" ...

2. Define getCollectionItems, which returns a Collection, in bean of class A.

3. Class A should be Serializable. e.g. public class A implements Serializable {...};

4. Class A must be defined in your faces-config.xml

Actually, jsf  errors and exceptions are really crap :)) But, JSF is so useful and I believe that it will capture the interface layer market or at least it is influenced dramatically, by the way.

Obviously, you can buy whatever you want and need through the Amazon.com. probably you can find free e-book about JSF in the following listed web sites, but I'm not sure, cos I didnt try to find it before.

www.free-itebooks.com
www.freeebookdownload.net
www.ebookee.com

Also, I've found http://horstmann.com/corejsf/jsf-tags.html pretty useful. It describes basic JSF tags. Apache is good, as well. and if u can find the following book can really helpful, especially in advance usage of JSF, configiration stuff like that:
Mann, K.D. (2005), "JSF in Action", Manning, USA

 
Answer #2    Answered By: Jonathan Brown     Answered On: Dec 11

Your code  is correct . I think some others problem  has been occurring. Let me know your errors.

 
Answer #3    Answered By: Zobebah Mizrachi     Answered On: Dec 11

Please post the exception message you've got.
There is no official website to download  any ebook regarding JSF,

 
Answer #4    Answered By: Chuong Tran     Answered On: Dec 11

I think you wanna send  parameter to action  to delete a person in your sample, but in correct way you should send an object like 'person entity' to delete it.
so, in this tag '<f:param name="selectpersonalid" value="#{items.persinalid}"/>
you shuold implement like it :


FacesContext facesContext = FacesContext.getCurrentInstance();

if(facesContext == null) {
System.out.println("facesContext is null");
} else {
String id = (String) facesContext.getExternalContext().getRequestParameterMap().get("selectpersonalid");
}
and the best practice is use SEAM Framework and it's Annotations, like this :

@RequestParameter("selectpersonalid")
private String selectpersonalid;

 
Didn't find what you were looking for? Find more on Jsf problem Or get search suggestion and latest updates.




Tagged: