getRequest() is called repeatedly because you have a whole bunch of OGNL that 
looks like "request.node.description" etc. that calls getRequest().

If you were using Spring/etc. to handle service instantiation you wouldn't have 
to worry about this. Or you could just not get a new request every time.

Dave


--- On Wed, 6/4/08, Juan Pablo Pizarro <[EMAIL PROTECTED]> wrote:

> From: Juan Pablo Pizarro <[EMAIL PROTECTED]>
> Subject: several action execs to fill a form
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Date: Wednesday, June 4, 2008, 12:05 PM
> Hi All.
> 
> I've a problem, I use a RequestListAction that return a
> List and it is
> used to fill a form. The problem is that the getRequest
> method is
> called several times before showing the result (form
> filled).
> 
> My action:
> 
>       private Request request;
> 
>       public Collection<CommandResult> getLstCommand() {
>       try {
>       lstCommand = new
> CommandResultServiceImpl().getByIdRequest(idRequest);
>       } catch (Exception e) {
>       lstCommand = null;
>       }
>       return lstCommand;
>       }
> 
>       @Override
>       public String execute() throws Exception {
>       return SUCCESS;
>       }
> 
>       public Request getRequest() {
>       try {
>       request = new
> RequestServiceImpl().getByIdRequest(idRequest);
>       } catch (Exception e) {
>       request = null;
>       }
>       return request;
>       }
> 
> 
> My form:
> 
> <s:url id="url" action="RequestList"
> />
> <h3>REQUEST DETAIL</h3>
> <s:form action="%{url}"
> method="POST">
>       <table>
>       <tr>
>       <td><s:property
> value="%{getText('login')}"
> /></td>
>       <td><s:property
> value="request.user.login" /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('country')}"
> /></td>
>       <td><s:property
> value="request.user.country.fullName"
> /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('subject')}"
> /></td>
>       <td><s:property value="request.subject"
> /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('description')}"
> /></td>
>       <td><s:property
> value="request.description" /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('fail')}"
> /></td>
>       <td><s:property
> value="request.failEntity.fail.description"
> /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('node')}"
> /></td>
>       <td><s:property
> value="request.node.description" /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('severity')}"
> /></td>
>       <td><s:property
> value="request.severity.severity"
> /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('siebelId')}"
> /></td>
>       <td><s:property
> value="request.siebelId" /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('remedyId')}"
> /></td>
>       <td><s:property
> value="request.remedyId" /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('paasPA')}"
> /></td>
>       <td><s:property value="request.paasPA"
> /></td>
>       </tr>
>       <tr>
>       <td><s:property
> value="%{getText('datetime')}"
> /></td>
>       <td><s:property
> value="request.datetime" /></td>
>       </tr>
>       </table>
> 
>       <br>
>       <s:if test="%{lstCommand != null}">
>       <s:if test="%{lstCommand.size > 0}">
>       <table class="ex">
>       <tr>
>       <th>Command</th>
>       <th>Description</th>
>       <th>Result</th>
>       </tr>
>       <s:iterator value="lstCommand"
> id="commands" status="cmds_stat">
>       <tr>
>       <td><s:property value="command.command"
> /></td>
>       <td><s:property
> value="command.description" /></td>
>       <td><textarea rows="7"
> cols="30" readonly><s:property
> value="result"/></textarea> </td>
>       <!--<td><s:property value="result"
> /></td>-->
>       <s:hidden value="idCommand" />
>       </tr>
>       </s:iterator>
>       </table>
>       </s:if>
>       <s:else>
>       <s:label>There are not commands
> associated.</s:label>
>       </s:else>
>       </s:if>
>       <br>
>       <s:submit value="FINISH"
> align="left" />
> </s:form>
> 
> My struts.xml
>               <action name="ShowRequest"
>                       class="org.gblx.action.tr.ShowRequestAction">
>                       <result>/TR/showRequest.jsp</result>
>               </action>
> 
> Any idea?
> 
> Thanks
> 
> JP
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to