Hello,
I am developing an application using the Appfuselight and the flow is kind
of like this
AppList.jps(first page, loads all the records from the database)
    |
 searchApp.jsp (search page)-> AppList.jsp(displays the search results data)

I am using displaytags and the problem is that when I export the data it
loads all the data from the database not just the data returned from the
search results. So it looks like the export option is not using the model
rendered by the page to display the data but the original model(select *
from table)
Any idea what could be the problem

AppList.jsp
[code]
<%@ include file="/WEB-INF/jsp/taglibs.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link type="text/css" rel="stylesheet" href="css/displaytag_screen.css"/>
<title>test</title>
</head>
<body>
<display:table name="model.appinventory" class="table" requestURI=""
id="appList" export="true" pagesize="5" excludedParams="*">>
<display:column property="servername" href="editForm.html" paramId="appid"
paramProperty="appid" title="Server Name" sortable="true" />
<display:column property="appname" title="Application Name" sortable="true" 
/>
<display:column property="primaryfname" title="SME FName" sortable="true" />
<display:column property="primarylname" title="SME LName" sortable="true" 
/>
<display:column property="primaryemail" title="SME email" sortable="true"
autolink="true"/>
</display:table>
searchApps.html Search for applications 
</body>
</html>

[/code]

searhApp.jsp
[code]
[code]
<%@ include file="/WEB-INF/jsp/taglibs.jsp" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"; %>
<%@ taglib uri="http://displaytag.sf.net"; prefix="display" %> 
<html>
<head><meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<link type="text/css" rel="stylesheet" href="css/displaytag_screen.css"/>
<title>Search Applications</title>
</head>
<body>
<form method="post">
<table width="95%" bgcolor="f8f8ff" border="0" cellspacing="0"
cellpadding="5"> 
<tr> 
<td alignment="right" width="20%">Servername:
</td> 
<spring:bind path="appInventory.servername"> 
<td > 
<input type="text" name="servername" value="<cut value="${status.value}"/>"> 
</td> 

</spring:bind> 
</tr>
</table>
<input type="submit" class="button" alignment="center" name="Search"
value="Search">

</form>
<br>
<br>
</body>
</html> 
</code]
searchAppController.java

[code]
public class SearchAppInventoryFormController extends SimpleFormController {
         protected final Log log = LogFactory.getLog(getClass());
    private AppInventoryManager appInvmgr;


    public void setAppInventoryManager(AppInventoryManager appInvmgr) {
        this.appInvmgr = appInvmgr;
    }

    
    public SearchAppInventoryFormController() {
        setCommandName("AppInventory");
        setCommandClass(AppInventory.class);
    }

    public ModelAndView processFormSubmission(HttpServletRequest request,
                                              HttpServletResponse response,
                                              Object command,
                                              BindException errors)
            throws Exception {
        if (request.getParameter("cancel") != null) {
            return new ModelAndView(getSuccessView());
        }

        return super.processFormSubmission(request, response, command,
errors);
    }

     

    public ModelAndView onSubmit(HttpServletRequest request,
                                 HttpServletResponse response, Object
command,
                                 BindException errors)
            throws Exception {
        log.debug("entering 'onSubmit' method...");

        AppInventory appInventory = (AppInventory) command;
        log.debug("servername from command object is" +
appInventory.getServername());
                log.debug("firstname from jsp is" + 
appInventory.getPrimaryfname());
                log.debug("last name from jsp is" + 
appInventory.getPrimarylname());
   
                log.debug("entering search method...");
                Map appslist = new HashMap();
       appslist.put("appinventory", appInvmgr.getRecord(appInventory));
            log.debug("right after search method...");
            
          // return new ModelAndView(getSuccessView());
   return new ModelAndView("searchResults", "model", appslist);
           
    }

    protected Object formBackingObject(HttpServletRequest request)
            throws ServletException {
       
            return new AppInventory();
        
    }
  protected boolean isFormSubmission(HttpServletRequest request)
    {
          //initMenuSelection( request.getSession());
      
      // check here, if any GET-parameters of displaytag-library exists.
      // if so, handle request as POST-request.
      if ("GET".equals(request.getMethod())) {
          Enumeration e = request.getParameterNames();
          while (e.hasMoreElements()) {
              String param = (String) e.nextElement();
              if (param.startsWith("d-"))
                  return true;
          }
      }

      return super.isFormSubmission(request);
  }
}

[/code]

-- 
View this message in context: 
http://www.nabble.com/displaytag-export-option-not-working-correctly-tf4159204s2369.html#a11833585
Sent from the AppFuse - User mailing list archive at Nabble.com.

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

Reply via email to