views:

1138

answers:

3

Hi,

I have a problem invoking actions from my jsp pages with tag in struts2. I have the login.jsp file:

<s:action name="headerMenu" executeResult="true" namespace="/menu"</s:action>
<s:form action="executeLogin">
    <s:textfield name="username" label="Username"></s:textfield>
    <s:password name="password" label="Password"></s:password>
    <s:submit></s:submit>
</s:form>

The headerMenu action renders the result in header.jsp:

<div id="menu">
    <s:iterator value="menus">
        <s:property escape="false" value="'<a href=\"'+path+'\" title=\"'+description+'\">'+title+'</a>'"/>
    </s:iterator>
</div>

This jsp file renders a menu that comes from a LinkedList (named menus) in the Action class of headerMenu action.

When accessing the "login.action", the menu is rendered fine, but if I enter data in the form, the submit the form, and submission has validation errors, I return to the page, the form is rendered ok, but the menu is missing. I still have "..." in the page, but no menu... It is like the action that gives the menu is invoked but the execute() method does not execute...

Can somebody please help me with this?

Vasi.

A: 

I'd be looking into whether the cause might be related to the following 2 snippets from the struts2 tag documentation:

"Any result processor defined for this action in struts.xml will be ignored, unless the executeResult parameter is specified."

"The action will not be published to the context until the whole tag is evaluated, meaning that inside the body of the tag, the action cannot be accessed"

Peter Kelley
A: 

Hey Any updates on this issue ? I am having the same exact issue, the Action executes fine , but then it does nto work .

Neil
A: 

Please pay attention to the 1st line. The s:action tag is not closed properly. It should be as follows:

<s:action name="headerMenu" executeResult="true" namespace="/menu"></s:action>
Jitendra