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

  • Home
  • SEARCH
  • 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 9163785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:31:38+00:00 2026-06-17T14:31:38+00:00

in my form I have textField: add(new TextField<String>(awayScore, new PropertyModel<String>(value, awayScore) { private static

  • 0

in my form I have textField:

                add(new TextField<String>("awayScore", new PropertyModel<String>(value, "awayScore") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public String getObject() {
                        logger.info("textField");
                        return super.getObject();
                    }
                }));

as you can see I just add logger.

I didnt see anything wrong here but when I run my application I got this error:

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
     at org.toursys.web.PlayOffPage$PlayOffForm$2$1$1.getObject(PlayOffPage.java:135)

row 135 contains:

return super.getObject();

I am really confused about it because without overriding this works

UPDATE:

when I edit my code to:

Object value = super.getObject();
logger.error(value.getClass() + "");

this code return:

 class java.lang.Integer

which is really weird because according to compiler this should return String

  • 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-17T14:31:40+00:00Added an answer on June 17, 2026 at 2:31 pm

    When you write new PropertyModel<String>(value, "awayScore") you make a promise that the awayScore in your value is a String. The compiler can’t verify your claim and there’s no automatic conversion.

    In AbstractPropertyModel the method getObject is defined to return a T which will get replaced by Object. That’s the reason it still works. As soon as you override the method to return String the cast will fail.

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

Sidebar

Related Questions

I have simple form with 2 textfield Name and Phone and can add new
I have a form: private Class TestForm extends Form<TestString>{ public TestForm(TestString testString){ super(testForm, new
I want to have a Form that can Add or Delete TextFields. I was
I have a form with a textfield element which when a user starts typing
I have a form in Django with a TextField that receives comma separated input
I have a form on the ipad which has many textfield and a button
I have created one jsp form which contains the username textfield. On the click
I have a method, -(void)validateFormInput:(UITextField *)textField that gets called when the form's submit button
Say I have two fields in a new or edit form: <%= f.text_field :email
I have the following model class (simplified) class A{ private String name; private List<B>

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.