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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:07:29+00:00 2026-05-31T23:07:29+00:00

I have a model-driven Struts Web action: public class ModelDrivenAction<T extends Object> implements ModelDriven<T>,

  • 0

I have a model-driven Struts Web action:

public class ModelDrivenAction<T extends Object> implements ModelDriven<T>, Preparable {

  protected Long id;
  protected T model;

  @Override
  public void prepare() {}

  public void setId(Long id) { this.id = id; }

  @Override
  public T getModel() { return model; }

  public void setModel(T model) { this.model = model; }
}

I have another action which is not currently model-driven:

public class OtherAction implements Preparable {

  private ModelObj modelObj;
  private Long modelId;

  @Override
  public void prepare() { modelObj = repoService.retrieveModelById(modelId); }

  public void setModelId(Long modelId) { this.modelId = modelId; }
}

I wish to make it so, and would like to avoid having to track down all the instances in JavaScript where the action is passed a “modelId” parameter instead of “id” if at all possible. I thought this might work, so either modelId or id could be passed in:

public class OtherAction extends ModelDrivenAction<ModelObj> {

  @Override
  public void prepare() { model = repoService.retrieveModelById(id); }

  public void setModelId(Long modelId) { this.id = modelId; }
}

However, server/path/to/other!method?modelId=123 is failing to set id. I thought so long as a setter matched a parameter name the Struts interceptor would call it on action invocation. Am I missing something here?

  • 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-31T23:07:31+00:00Added an answer on May 31, 2026 at 11:07 pm

    The failure to set id was due to a misconfiguration in Eclipse; the code as listed above actually does do what I had hoped.

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

Sidebar

Related Questions

i have the following action class: package com.pendulum.web; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest;
Lets say I have model inheritance set up in the way defined below. class
If I have Model.objects.all() I want to get only one object for any content_object=foo,
I have a legacy data-driven application with an extremely complicated data model (and hundreds
I have built a data driven model by dragging my tables onto the empty
Does anyone have some idea how to parse the following xml using event-driven model
Suppose the following model public class Product { private Integer requiredQuantity; private Integer allowedQuantity;
I have the following entities in Entity Framework: public class School { public int
I have a class : @SessionScoped public class LoggedUser { private User user; ...
I have a Struts + Velocity structure like for example, a Person class, whose

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.