Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:14:38+00:00 2026-06-06T09:14:38+00:00

I have one Page which is displaying details of some Client. I am using

  • 0

I have one Page which is displaying details of some Client. I am using t:loop to display some data. In t:loop I am just passing source and value. So far so good, my page is working fine. But when I try to submit the Page it suddenly give me the Exception.

“Could not find a coercion from type java.lang.String to type
[addressUsageValue] Available coercions:……….”

Below is the sample code

<t:loop source="addressUsageInfo" value="addressUsageValue">
                  <tr>
                              <td>${addressUsageValue?.usage}</td>
                              <td>${addressUsageValue?.address}</td>
                              <td>${addressUsageValue?.postCode}</td>
                              <td>${addressUsageValue?.city}</td>
                              <td>${addressUsageValue?.country}</td>
                  </tr>
</t:loop>

I did some goggling and find below references.

http://tapestry.apache.org/5.3.3/apidocs/org/apache/tapestry5/corelib/components/Loop.html
https://issues.apache.org/jira/browse/TAP5-609

So I have created encoder for Loop. Below is the sample code. In below toClient() method I have randomly returned any value and in toValue() method I am returning null.

private final ValueEncoder<DtoAddressUsageInfo> addressUssageEncoder = 
    new ValueEncoder<DtoAddressUsageInfo>() {

    public String toClient(DtoAddressUsageInfo value) {
          return String.valueOf(value.getUsage());
    }

    public DtoAddressUsageInfo toValue(String clientValue) {
          return null;
    }

};

Now my code is working fine and I am able to submit the form.

Here my doubt comes

First – I am not able to understand why encoder is required when using loop?? And if it is required to submit the form then why it is not Mandatory parameter??

Second – I have just implemented the Encoder without any logic. I am not able to understand where toValue() and toClient() method is used and what is the purpose?

Third – when I submit the Page why form required Encoder??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:14:41+00:00Added an answer on June 6, 2026 at 9:14 am

    The formState and encoder parameters solve the following problem: When the form is submitted, how do you make sure the values from the form go to the objects they are intended for?

    If the collection you’re iterating over does not change between the rendering of the form and the form submission, then the simplest solution is to set formState="iteration" (explained nicely in the docs).

    If, however, the collection could change between render and submit, you will have to encode information on which loop iteration is which object. This is done with a ValueEncoder (again, explained nicely in its documentation). A common implementation could for example encode a database ID into the form (toClient()) when rendering, and load the entity back from the database when the form is submitted (toValue()).

    All of this is also explained well in the Loop component documentation that you found.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several forms on one page which are submitted using ajaxForm and show
I have one master page which applies to all pages in this website. On
I have a one-page OpenOffice document which is a POD template. Basically, I use
I have a one page web application, which means alot of javascript. External scripts
I have one drop down list in my page, which contains two options. What
I have a WordPress site which have 4 pages with one page is a
I have a Master Page which has an associated css file. On one of
I have one interceptor, in which I hv to redirect to main Page if
I have google analytics on my site. One page has a button which when
I have one sharepoint custom page application which is rendering from a user control.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.