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 7533751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:49:03+00:00 2026-05-30T05:49:03+00:00

I’m using hibernate, Spring and Velocity in Java. I’m extending the SimpleFormController and using

  • 0

I’m using hibernate, Spring and Velocity in Java.

I’m extending the SimpleFormController and using a typical ‘User’ object for the command class.
I wish to update or create the User class using the form, which I reflect back into hibernate so that the values can be updated in the database.

My problem is that I wish to display additional data in the velocity template resolved to ‘userEdit’, but I don’t want to store this data within the user object.

My user object simplified is:

public class User implements Serializable {

    private String username;
    private String password;

    private Set<Object> allowedNames;

    ...
}

My bean is defined as follows:

<bean id="userEditController" class="com.UserEditController">
    <property name="sessionForm"><value>true</value></property>
    <property name="commandClass"><value>com.data.User</value></property>
    <property name="validator"><ref bean="userValidator"/></property>
    <property name="formView"><value>userEdit</value></property>
    <property name="successView"><value>UserEdit</value></property>
    <property name="dao">
        <ref bean="myDAO"/>
    </property>
</bean>

The ‘allowedNames’ variable contains some of the list of Names in the database and is specific to the user. I am wondering how I can also display a full list of names (extracted from the database) so I can use it in my userEdit velocity template. Because I want to show the ‘allowedNames’ next to ‘allNames’.

Using the SimpleFormController allows me to directly control the User object, creating new Users or updating them in the database, however, adding any more information into the form is very difficult for me, because I’m stuck with the User object.

‘allNames’ does not belong in the User class so I have tried to create an object to hold the User object and a Set called allNames. I call it my UserEdit class. My problem there is that I cannot reference the User object variables without accessors in velocity template such as $command.user.username , and I also cannot bind them for errors or use the User object to reflect and form changes back into the database.

My question is in regards to how I can either user this ‘UserEdit’ object in my form or otherwise make use of a different approach in order that my form can have User data and other data and at the same time be able to update the User object(which is reflected in hibernate). Anyone have an approach for this?

  • 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-05-30T05:49:04+00:00Added an answer on May 30, 2026 at 5:49 am

    What I’ve found out myself is that, indeed, the inherited code does not automatically update the commandClass User object through some sort of reflectance in spring.

    What I’ve done to solve my problem is to creat a UserEdit object. This holds any necessary data coming from the form which I then place into the User object before saving it using my DAO.

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

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.