Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Struts extension doubt...help is very much needed

Status
Not open for further replies.

mu5tang

IS-IT--Management
Dec 3, 2005
1
US
Dear friends

our web application's action classes' methods depend upon web-helper objects.

so this scenario is typical


public ActionForward dispatch-method-xyz(ActionMapping mapping,
ActionForm form,
ServletRequest request,
ServletResponse response){


helperobjectclass helperobject = new helperobjectclass();
//do sth on helper object that returns some data.

}

I have a peculiar requirement to set the helper object at runtime..so that i can pass in a dummy helper or a real helper object. So, i refactored the helper creation from nside of Action's method and placed it in a setter method like this.

//Note that i also have a common interface for real and dummy helper objects.

setHelperObject(HelperObjectInterface helperIntf){
Assign to Action instance's interface variable
}


I plan to override processActionCreate( method in RequestProcessor that returns an Action instance for the specific request path. I wish to set the appropriate helper to the Action here.

See that this has a similarity to spring framework where you can set Action's methods.

Now,

1. Please comment on the process above. Any comments?

2. Do anybody see any issues now that i am exposing helper related objects as instance level of Action's?(as i have to set them instead of creating inside Action methods as before)

Comments invited.

thanks in advance.






















 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top