myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ayub Khan" <ayub...@gmail.com>
Subject Re: converter for textArea
Date Thu, 27 Nov 2008 05:25:45 GMT
Hi Berthold,

I tried the option you mentioned below, however I am getting error stating
error testing property commentText in bean of type null. Both
AppointmentBean and also CommentItem bean are defined in faces-config.xml

What might be the issue here ?

Regards
Ayub


On 11/26/08, Berthold Scheuringer <berthold.scheuringer@gmail.com> wrote:
>
> Hi,
>
> I do not know if I really understand your problem, but if you just want to
> bind the commentText to the textarea it will be straight forward like this
>
> appointmentBean.commentItemMap['Event Type'].commentText
>
> this will call the getCommentText() method on the corresponding commentItem
> in the map. No need for a converter here.
> (But keep in mind that there has to be already such an entry in the map)
>
> Regards,
>
> Berthold
>
>
> On Wed, Nov 26, 2008 at 8:35 AM, Ayub Khan <ayub.hp@gmail.com> wrote:
>
>>
>> Hi,
>>
>> I am trying to bind the textArea to a bean property which is of type Map.
>> Could any one assist me what the issue here.
>>
>> JSF page has list of appointments and form to create new appointment. User
>> selects the existing appointment, this populates the appointment form.
>>
>> appointmentBean is mapped to Appointment table in db. which has been
>> prepopulated with ids and event types.
>>
>> in jsf page text area is mapped as appointmentBean.commentItemMap['Event
>> Type']
>> AppointmentBean{
>>
>> Map commentItemmap=new HashMap(0);
>>
>> }
>>
>> CommentItem{
>>
>> int commentId;
>> int commentText;
>>
>> getters and setters for above variables.
>>
>> }
>>
>> In the service methods the commentItem is associated with Formbean as
>> below:
>>
>>
>> getCommentItemMap().put(eventType,newCommentItem);
>>
>> When I submit the form I was getting convertion error on CommentItem. I
>> registered a coverter for CommentItem in faces-config.xml.
>>
>> Now I am getting null pointerexception in the converter, value is null,
>> which indicates the converter is not getting bound to the commentItem of db.
>> *
>>
>> public
>> *String getAsString(FacesContext ctx, UIComponent component, Object
>> value) {
>>
>> *return* ((CommentItem)value).getCommentId().toString*();*
>>
>> }
>>
>> I am not able to understand how to map a preexisting CommentItem which is
>> there in db to jsf textArea field
>>
>> any clues here what I am missing ?
>>
>> Regards
>>
>> Ayub
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
> --
> Berthold Scheuringer
> +43 664 80508 3919
>
> Irian Solutions GmbH
> Your JSF powerhouse
> http://www.irian.at
>



-- 
-- "Two roads diverged in a wood
And I took the one less traveled by
And that has made all the difference.

Robert Frost....."

Mime
View raw message