I have created a from in JSP page name add.jsp
to save data like this
<s:form action="AddDomain">
<s:push value="idp">
<s:textfield name="domainName" label="Domain Name" />
<s:textfield name="url" label="Domain URL" />
<s:textfield name="noOfLicense" label="License Purchased" />
<s:textfield name="licenseExpireDate" label="License Expire Date" title="YYYY-MM-DD like 2013-01-21" />
<s:textfield name="userActiveDuration" label="Active User Duration"
title="please mention in days" />
<s:textarea cols="30" rows="5" name="notes" label="Note"></s:textarea>
<s:submit value="Add"></s:submit>
</s:push>
</s:form>
Action Method that show this view is as
public String addDomainPage() {
return ActionSupport.SUCCESS;
}
I have created another page that list the all domains and provide a edit link to edit any domain. When Use click on edit URL this action is called
public String loadDomain() {
HttpServletRequest request = ServletActionContext.getRequest();
String url = request.getParameter("durl");
IDPBroker broker = new IDPBroker();
idp = broker.getDomainByURL(url);
return ActionSupport.SUCCESS;
}
On successful completion of action I show the add.jsp
page. Struts populate the data in JSP page.
Now, issue is that I want to change the value of action attribute of form tag. I also want to change the value of submit button
to 'Edit'. I have plan to create some private attribute(action,Label)
in Action
class and when an addDomainPage
action is call I will change the value of these attribute with respect to add page. Similar for loadDomain
action. Now I don't know how to do this means how to use these private attributes in view. Tell me is I am doing correctly and what to do next?