My Code is as follows:
Struts.xml
<package name="DebtsOwedtoPHAs" namespace="/DebtsOwedtoPHAs"
extends="struts-default">
<action name="PHAInformation"
class="gov.hud.pih.eiv.web.action.reports.DebtsOwedAction" method="listAll">
<result name="success">/reports/debtsowed/tenants.jsp</result>
</action>
<action name="DebtAction"
class="gov.hud.pih.eiv.web.action.reports.DebtsOwedAction" method="input">
<result name="success"
type="redirect-action">PHAInformation</result>
<result name="input">/reports/debtsowed/tenantForm.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>
URL code in tenants.jsp
<s:url action="DebtAction" method="input" id="url">
<s:param name="fmrTenant.sSN" value="sSN"/>
</s:url>
<a href="<s:property value="#url"/>">Edit</a>
prepare method in Action
public void prepare() throws Exception {
setDebtsOwedIface((DebtsOwedIfaceDAO)
ApplicationInitializer.getApplicationContext().getBean("debtOwedIfaceDAO"));
fmrTenants = getDebtsOwedIface().getAllFormerTenants(false);
if (fmrTenant!=null && fmrTenant.getSSN()!=null)
fmrTenant =
getDebtsOwedIface().getFormerTenant(fmrTenant.getSSN());
}
input method in Action
public String doInput() {
return INPUT;
}
getter and setter for formerTenant in Action
public void setFmrTenant(FormerTenants fmrTenant) {
this.fmrTenant = fmrTenant;
}
public FormerTenants getFmrTenant() {
return fmrTenant;
}
The issue is that the URL link in tenants.jsp
<s:url action="DebtAction" method="input" id="url">
<s:param name="fmrTenant.sSN" value="sSN"/>
</s:url>
is not invoking the setFmrTenant method. So inside prepare when I check
whether fmrTenant is null or not I always get that it is NULL and hence this
line of code is never executed:
fmrTenant = getDebtsOwedIface().getFormerTenant(fmrTenant.getSSN());
Below is code for tenantForm.jsp (this is the page that comes up when user
clicks Edit)
<s:form action="DebtAction" method="save" method="post">
SSN: <s:property value="%{fmrTenant.sSN}"/>
<br>
First Name: <s:property value="%{fmrTenant.firstName}"/>
Last Name: <s:property value="%{fmrTenant.lastName}"/>
Middle Initial: <s:property value="%{fmrTenant.middleInitial}"/>
Debt Owed: <s:property value="%{fmrTenant.debtOwed}"/>
Termination Reason: <s:property value="%{fmrTenant.terminationReason}"/>
</s:form>
I am only getting property value of fmrTenant.sSN and nothing else.
I would appreciate any help!
On Tue, Apr 14, 2009 at 7:49 PM, <[email protected]> wrote:
> Sorry i was not very clear: when you configure your application to allow
> the bang (!) notation, the client gets to choose *any* of the
> public methods on your action and use them as action methods as opposed to
> you listing what your action methods are explicitly.
> So?the developer has to be cautious because all public methods on the
> action become fair game.
> Chris?
>
>
> -----Original Message-----
> From: Dave Newton <[email protected]>
> To: Struts Users Mailing List <[email protected]>
> Sent: Tue, 14 Apr 2009 2:25 pm
> Subject: Re: sample CRUD application question
>
>
> Bhaarat Sharma wrote:?
> > so what would be a way to avoid that??
> > > use this instead??
> > >> <s:url action="crud" method="delete" id="url">?
> >> <s:param name="employee.employeeId" value="employeeId"/>?
> >> </s:url>?
> ?
> I don't see any difference there.?
> ?
> I'm not sure what the original response had in mind; the same thing could
> happen with a POST form.?
> ?
> Normally one would check for delete access rights on the server side before
> allowing deletions.?
> ?
> Dave?
> ?
> ---------------------------------------------------------------------?
> To unsubscribe, e-mail: [email protected]?
> For additional commands, e-mail: [email protected]?
> ?
>
>