struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mansou...@yahoo.com
Subject Accessing a Bean from a bean using EL with STRUTS 2 - I really need help
Date Sat, 07 Apr 2007 18:15:45 GMT

All I am trying to do is to retrieve an account from A DB and using 
taglib (data grid) to display the associated invoice with this account. 
Should this be a two-days task.

Maybe something wrong with me.

here's my controller:

package billing;
import com.opensymphony.xwork2.ActionSupport;
public class AccountManager   extends ActionSupport{

    private Account account ;
    private AccountBean accountBean ;
   
    public String execute()
    {
        account = new Account(accountBean);
        return "SUCCESS" ;
    }

    public AccountBean getAccountBean() {
        return accountBean;
    }

    public void setAccountBean(AccountBean accountBean) {
        this.accountBean = accountBean;
    }
}


and here's my jsp

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="ui" uri="/taglibs-datagrid"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c1" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>

<%@ page import="billing.*" %>
<%@ page import="java.util.ArrayList"%>
<%@page import="java.util.Collection"%>

<html>
<head>
</head>
<body>

<div style="background-color:lightblue;"><s:label value="AccId:" />
<s:property value="accountBean.accountNumber" /> <br>
<s:label value="First Name:" />
<s:property    value="accountBean.firstName" /><br>
<s:label value="Last Name: " />
<s:property    value="accountBean.lastName" />
</div>
<hr>

<jsp:useBean id="accountBean" type="billing.AccountBean" scope="request"
        beanName="billing.AccountBean">
</jsp:useBean>

<ui:dataGrid items="${accountBean.invoices}" var="i" name="datagrid1">
              <columns>
                <column width="100" order="true">
                  <header value="ID" />
                  <item   value="${i.id}"/>
                </column>
              <columns>
</ui:dataGrid >
</body>
</html>



Now How can I set a bean called invoices to the value of  the bean 
"account.invoices" ?








---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message