That should be it. Just to make sure it is not related to the errors or
the messages, replace the <s:actionmessage/> with some fixed text, and
see if that text is showing up.
musachy
kedgecomb wrote:
> I am using a single taglib directive:
>
> <%@(protected)" %>
>
> Is there something else I need? Also, I get the messages correctly if I
> call the url directly, (not using an async call).
>
> I will try the Firebug suggestion.
>
>
>
>
> Musachy Barroso-2 wrote:
>
>> The ajax request is handled just like any other request (its
>> asynchronous nature is only related to the client). So whatever the
>> action outputs, it will be sent to the client and inserted inside the
>> div. Use Firebug to see what is the return of the ajax call, plus make
>> sure the jsp fragment has all the required taglib directives.
>>
>> regards
>> musachy
>>
>> kedgecomb wrote:
>>
>>> I have been using the actionErrors and actionMessage features of Struts2
>>> for
>>> some time and they have worked well for providing user feedback, (e.g.;
>>> "Business Center deleted successfully", "User already exists with this
>>> ID",
>>> etc.). I add the error or the message in the action class like so:
>>>
>>>
>>> public String add() throws Exception {
>>>
>>> try {
>>> service.addUser(user);
>>> users = service.getAllUsers();
>>>
>>> } catch(PersistenceExistsException ee) {
>>> addActionError(getText("user.alreadyExists"));
>>> return Action.INPUT;
>>>
>>> } catch(PersistenceNotFoundException nfe) {
>>> this.addActionError(getText("global.unableToProcessRequest"));
>>> return Action.INPUT;
>>> }
>>> addActionMessage(getText("user.addSuccess"));
>>> return SUCCESS;
>>> }
>>>
>>> This had the effect of deleting a user, refreshing the list of all users,
>>> and sending a success message if all went well.
>>> If something went wrong, a descriptive error would be displayed just
>>> above
>>> the list of users.
>>>
>>> It worked well until I began to incorporate the AJAX tags into the mix.
>>> I
>>> use a s:div to display the list of users:
>>>
>>> <tr>
>>> <td colspan="2">
>>> <s:div id="users" theme="ajax" href="userAdmin.do"
>>> listenTopics="delete"
>>>
>>>
>>>> loading...</s:div>
>>>>
>>>>
>>> </td>
>>> </tr>
>>>
>>> The JSP fragment that is returned to this div contains the list of users.
>>> This also worked well. But the JSP also contains the actionError and
>>> actionMessage tags:
>>>
>>> <tr>
>>> <td colspan="4" class="PageStatus">
>>> <font color="#FF0000"><s:actionerror/></font>
>>> </td>
>>> </tr>
>>> <tr>
>>> <td colspan="4" class="PageStatus">
>>> <font color="#00FF00"><s:actionmessage/></font>
>>> </td>
>>> </tr>
>>>
>>> The problem is that these tags are never populated while using the AJAX
>>> feature. Neither errors nor messages are displayed at any time. If I
>>> use
>>> the same url that the s:div tag uses, and key it into the browser
>>> address,
>>> the row is added or deleted and the message displays correctly, (using
>>> the
>>> exact same jsp). When I use an ajax link:
>>>
>>> <s:url id="removeUrl" action="removeUser">
>>> <s:param name="userId" value="userId" />
>>> </s:url>
>>> <s:a href="%{removeUrl}" theme="ajax" notifyTopics="delete" ><s:text
>>> name="global.delete"/></s:a>
>>>
>>> the correct user is deleted, the div is refreshed with the new list of
>>> users, but no message displays.
>>>
>>>
>>> Are the message tags handled differently when using AJAX?
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)