struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bhaarat Sharma <>
Subject Re: Struts2 crud application gone wrong
Date Mon, 20 Apr 2009 19:55:15 GMT
I just debugged the code and it seems like the doSave method is called when
'Submit' is hit on the edit page.  However, since the doSave is returning
Success and based on struts.xml it will redirect to action index then the
prepare method for EmployeeAction class is called again and at this time
sampleString is just empty.

But I still dont know how I can overcome this problem without restructuring
the whole app?

On Mon, Apr 20, 2009 at 3:47 PM, Bhaarat Sharma <> wrote:

> sorry about the typo. as i was trying to give an example and not just copy
> paste the code I made a mistake.
> This is what I have in my jsp page.
> <s:property value="sampleString" default="test"/>
> I have verified whether it is because of a typographical error but it is
> not. And since you are saying it cant be because I am just calling a
> particular method in the action class. then I dont know what could be
> causing this behavior. ...
> On Mon, Apr 20, 2009 at 3:43 PM, Dave Newton <>wrote:
>> Bhaarat Sharma wrote:
>>> What I wanted to do was that when user edits something and comes back to
>>> the
>>> listing page, they see a message on top saying id XXX has been modified.
>>> However, I think this is not possible because a method name is mentioned
>>> in
>>> struts.xml.  Is that correct?
>> No.
>>  to try it out I added a private member string called successString in
>>> EmployeeAction class and created getter/setters for it.  Then in doSave
>>> and
>>> doDelete methods I added a line that sets the member string. Then on the
>>> listing jsp page. I simple added this line <s:property
>>> value="successString"
>>> default="test"/>  However, it seems that the jsp page is never getting
>>> the
>>> value from getSuccessString method.
>>> Can someone please tell me an approach I can take to overcome this
>>> problem?
>>> Below are the doSave and doDelete methods.
>>>    public String doDelete() {
>>>        empService.deleteEmployee(employee.getEmployeeId());
>>>        setSampleString("successfully deleted");
>>>        return SUCCESS;
>>>    }
>> Here you're calling setSampleString(); in the expository text above you
>> reference a property named "successString". Is that a (repeated)
>> typographical error?
>> Dave
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message