Questions tagged [model-driven]

An interface to support model component of the Struts2 MVC architecture.

An interface to support model component of the Struts2 MVC architecture. This interface should implement action classes which applying a user model as a generic parameter. If an action class implements the interface ModelDriven then it needs to return an object from the getModel() method. Struts2 will then populate the fields of this object with the request parameters, and this object will be placed on top of the valueStack once the action is executed. Validation will also be performed on this model object, instead of the action.

ModelDriven action uses it's own interceptor modelDriven which included in the defaultStack interceptor stack. Thus every action that uses that stack invokes this interceptor to check if an action is instance of ModelDriven then applying a model to it.

There's also a ScopedModelDriven interface that is used for models that has lifecycle for the specified scope.

128 questions
2
votes
4 answers

jQuery plugin vs Dojo plugin using ModelDriven in Struts 2

I am using Struts2 with ModelDriven for form submitting. When I use datetimepicker tag of Dojo and select date from that tag the form is submitted correctly with the form values populated in the ModelDriven object. But when datepicker tag of jQuery…
Kidaaaa
  • 91
  • 1
  • 5
1
vote
1 answer

Struts2 Bulk Data display using ModelDriven

I know the basic Concept of Model Driven process. How ever i would like to know whether the same ModelDriven Interface process can be used to display bulk data on the action tagged response page ? To explain this with example Request page is normal…
N.S.Karthik
  • 485
  • 13
  • 29
1
vote
0 answers

How to customize color of MUI range slider's track (in react/typescript using PCF controls) to include success, warning and error color?

I have an imported range slider from @mui. But I need to customize the color of the slider track to show success(green color) from 0 to first slider thumb, warning(orange color) from slider thumb 1 - slider thumb 2 and last error( red color) from…
GMS2288
  • 11
  • 1
1
vote
0 answers

How to send a new product to Action in Struts 2

It looks like basical, but I am new with Struts2. I want to send a new product created with name, price and category. I work with struts2 version 2.5.26, Maven, tomcat 9.0, java jdk 1.8.0_241 It seams that the code I use to send the product is…
PascalP
  • 11
  • 1
  • 3
1
vote
1 answer

Struts2 CRUD, how to update the model : ModelDriven. It's always blank in the JSP

I'm not able to retreive my Model in my JSP to update the object. public class ViewDashboardAction extends ActionSupport implements ModelDriven { private Clinique clinique = null; @Override public Clinique getModel() { return…
Sebastien Dionne
  • 757
  • 2
  • 19
  • 34
1
vote
1 answer

Action classes hierarchy chaining from SuperAction to SubAction methods in Struts 2

I'm migrating an existing Struts1 application to Struts2. I've kept the Actions and ActionForms classes hierarchy the same. The Struts2 actions SuperAction extends from ActionSupport and has a ModerlDriven member variable SuperForm while SubAction…
Shah-G
  • 652
  • 1
  • 8
  • 22
1
vote
1 answer

Why JSP doesn't throw error for non-mapped fields in Struts 2

I've my Struts 2 actions as ModelDriven. I've some fields defined on the actions themselves as well. However, if in the JSP I use wrong field names that are neither in ModelDriven model nor directly used as action member fields then I don't get any…
Shah-G
  • 652
  • 1
  • 8
  • 22
1
vote
2 answers

The bounded wildcard gives a error using ModelDriven in Struts 2

I'm porting a Struts 1 application to Struts 2. In the Struts 1 application, there is a CommonAction class that inherits from org.apache.struts.actions.DispatchAction. public class CommonAction extends DispatchAction The CommonAction class is…
Shah-G
  • 652
  • 1
  • 8
  • 22
1
vote
2 answers

Conditional Validation Angular 2 - Model Driven Forms

I have a form in Angular 2 in which I have a checkbox that changes some input[text] on the page. If the checkbox is checked an input that is called 'CPF' is changed to 'CNPJ'. I need CNPJ to be required only if the checkbox is checked since the user…
1
vote
1 answer

How to put data into a list inside a object using Struts2 ModelDriven

I am doing my practice project and meet a problem. How can I encapsulate data i entered in jsp into a set which is inside a object using ModelDriven. Here's the sample code. I have debugged my program and it showed null value. I knew the problem is…
Ryan Dong
  • 21
  • 2
1
vote
1 answer

ParametersInterceptor Error in server console after submitting the form, when devMode is true

When I am submitting a form in Struts 2, I am getting the below ERROR in server console when devMode set to true. Though this is not impacting my functionality, not sure why this is occurring. //Error msg 14:34:54,748 ERROR…
CMG
  • 69
  • 6
1
vote
1 answer

net.sf.json.JSONException: There is a cycle in the hierarchy in Struts 2

I am using Struts 2 class which implements ModelDriven. I am able to pass the data from jQuery and save the data on the database. When I try to retrieve the data back and pass it back to jQuery, I am not sure why it's not available in jQuery. I am…
CrazyMac
  • 462
  • 4
  • 19
1
vote
1 answer

Upload file Action class with ModelDriven in Struts 2

I'm studying Struts 2 and get an issue: cannot upload file in ActionClass that implements ModelDriven Product.java public class Product { String name, image; public Product() { } public Product(String name, String image) { …
maphongba008
  • 2,114
  • 4
  • 20
  • 33
1
vote
2 answers

The sequence of ModelDriven and Prepare?

I put the println() in each method of Action class. public String execute() throws Exception { System.out.println("execute"); //... } public void prepare() throws Exception { System.out.println("prepare"); //... } public Object…
Deckard
  • 1,409
  • 6
  • 32
  • 59
1
vote
1 answer

how to validate date format in struts2

i am trying to warn the user when he entered a date in other than (DD-MON-YYYY) format The problem i am facing is i have used xml validation to validate my jsp. when i googled it we have only checking for date range in struts2 xml validation. this…
Ashok Ogirala
  • 121
  • 2
  • 15
1 2 3
8 9