You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "p@zdzior" <pa...@interia.pl> on 2003/08/10 12:43:39 UTC
Use Java Bean component
Hi everybody,
I am using using java bean Component Customer:
<jsp:useBean id="Customer" class="com.test.CustomerBean" scope="session"/>
which contails some filed like name, surname, ... and standard setter and getter methods.
I try to do select on database to retreive all data about the current customer:
<sql:query var="cust_data" dataSource="${test}" scope="session">
SELECT CUST_USERNAME, CUST_PHONENO, CUST_NAME, CUST_SURNAME, CUST_STREET, CUST_ZIPCODE, CUST_TOWN,
CUST_EMAIL, CUST_SEX, CUST_AGE FROM CUSTOMER
WHERE CUST_USERNAME = ?
<sql:param><%= request.getRemoteUser()%></sql:param>
</sql:query>
then I would like to set all bean fileds to the retreived values,
I have tried to do:
<c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}" scope="session"/>
unfortunately it does not work, if i try later obtain this value by:
<c:out value="$Customer.name"/> I receive an empty string.
If I use <c:out value="${cust_data.rows[0].CUST_NAME}"/> then it works ok?
I would be gratefull for any help.
regards,
Lukasz
Re: Use Java Bean component
Posted by "p@zdzior" <pa...@interia.pl>.
Thanks,
Works now :)
I had an old JSTL Specification and there was no target parameter described.
thanks again,
lukasz
----- Original Message -----
From: "Serge Knystautas" <se...@lokitech.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Sunday, August 10, 2003 3:19 PM
Subject: Re: Use Java Bean component
> > <c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}"
scope="session"/>
>
> When you are setting JavaBean properties, you need to use the alternate
> approach for <c:set>. What you want is...
>
> <c:set target="${Customer}" property="name" value="${foobar}" />
>
> Check the spec or JSTL in Action if you want more examples or details on
> how this works.
>
> --
> Serge Knystautas
> President
> Lokitech >> software . strategy . design >> http://www.lokitech.com/
> p. 1.301.656.5501
> e. sergek@lokitech.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
> ------------------------------------------------------------
> Gol na stadionie natychmiast na naszej na stronie!
> Wszystkie ligi na zywo! >>> http://link.interia.pl/f1754
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Use Java Bean component
Posted by "p@zdzior" <pa...@interia.pl>.
Thanks,
Works now :)
I had an old JSTL Specification and there was no target parameter described.
thanks again,
lukasz
----- Original Message -----
From: "Serge Knystautas" <se...@lokitech.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Sunday, August 10, 2003 3:19 PM
Subject: Re: Use Java Bean component
> > <c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}"
scope="session"/>
>
> When you are setting JavaBean properties, you need to use the alternate
> approach for <c:set>. What you want is...
>
> <c:set target="${Customer}" property="name" value="${foobar}" />
>
> Check the spec or JSTL in Action if you want more examples or details on
> how this works.
>
> --
> Serge Knystautas
> President
> Lokitech >> software . strategy . design >> http://www.lokitech.com/
> p. 1.301.656.5501
> e. sergek@lokitech.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
> ------------------------------------------------------------
> Gol na stadionie natychmiast na naszej na stronie!
> Wszystkie ligi na zywo! >>> http://link.interia.pl/f1754
>
>
>
Re: how to submit a selected item of a collection
Posted by Sy...@aig.com.
I need help with submission of an item of a collection.
I display a collection of items with each item having a button. I allow
user to click the button to select the item. When I try to get a value
from the Form in my Action, there is nothing. Here is my code. The
display part is ok.
//jsp to display and get selected life
<logic:iterate id="oneLife" name="lives" >
<member>
<tr>
<td width="160"><bean:write name="oneLife" property="surName"/></td>
<td width="160"><bean:write name="oneLife" property="firstName"/></td>
<td><html:submit>Choose</html:submit></td>
</tr>
</member>
</logic:iterate>
// My form to capture data from the selected item
public class SelectLifeForm extends ActionForm {
private String surName = null;
private String firstName = null;
// with getter and setter for each field.
}
// My action class to do something like perform a sql base on the two
values submitted.
public class SelectLifeAction extends Action {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
SelectLifeForm selectLifeForm = (SelectLifeForm) form;
System.err.println("*** selectLifeForm = " +
selectLifeForm.getSurName() );
System.err.println("*** selectLifeForm = " +
selectLifeForm.getFirstName() );
// selectLifeForm have null values in both fields.
...
}
}
Re: Use Java Bean component
Posted by Serge Knystautas <se...@lokitech.com>.
> <c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}" scope="session"/>
When you are setting JavaBean properties, you need to use the alternate
approach for <c:set>. What you want is...
<c:set target="${Customer}" property="name" value="${foobar}" />
Check the spec or JSTL in Action if you want more examples or details on
how this works.
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com/
p. 1.301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Use Java Bean component
Posted by "p@zdzior" <pa...@interia.pl>.
Unfortunately doesn't eor either :(
> Have you tried sessionScope.Customer.name ?
>
> p@zdzior wrote:
>
> >Hi everybody,
> >
> >I am using using java bean Component Customer:
> >
> ><jsp:useBean id="Customer" class="com.test.CustomerBean"
scope="session"/>
> >
> >which contails some filed like name, surname, ... and standard setter and
getter methods.
> >
> >I try to do select on database to retreive all data about the current
customer:
> >
> ><sql:query var="cust_data" dataSource="${test}" scope="session">
> > SELECT CUST_USERNAME, CUST_PHONENO, CUST_NAME, CUST_SURNAME,
CUST_STREET, CUST_ZIPCODE, CUST_TOWN,
> > CUST_EMAIL, CUST_SEX, CUST_AGE FROM CUSTOMER
> > WHERE CUST_USERNAME = ?
> > <sql:param><%= request.getRemoteUser()%></sql:param>
> ></sql:query>
> >
> >then I would like to set all bean fileds to the retreived values,
> >I have tried to do:
> >
> ><c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}"
scope="session"/>
> >
> >unfortunately it does not work, if i try later obtain this value by:
> >
> ><c:out value="$Customer.name"/> I receive an empty string.
> >
> >If I use <c:out value="${cust_data.rows[0].CUST_NAME}"/> then it works
ok?
> >
> >I would be gratefull for any help.
> >
> >regards,
> >Lukasz
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
> ----------------------------------------------------------------------
> Portal INTERIA.PL zaprasza... >>> http://link.interia.pl/f174b
>
>
>
Re: Use Java Bean component
Posted by "p@zdzior" <pa...@interia.pl>.
Unfortunately doesn't eor either :(
> Have you tried sessionScope.Customer.name ?
>
> p@zdzior wrote:
>
> >Hi everybody,
> >
> >I am using using java bean Component Customer:
> >
> ><jsp:useBean id="Customer" class="com.test.CustomerBean"
scope="session"/>
> >
> >which contails some filed like name, surname, ... and standard setter and
getter methods.
> >
> >I try to do select on database to retreive all data about the current
customer:
> >
> ><sql:query var="cust_data" dataSource="${test}" scope="session">
> > SELECT CUST_USERNAME, CUST_PHONENO, CUST_NAME, CUST_SURNAME,
CUST_STREET, CUST_ZIPCODE, CUST_TOWN,
> > CUST_EMAIL, CUST_SEX, CUST_AGE FROM CUSTOMER
> > WHERE CUST_USERNAME = ?
> > <sql:param><%= request.getRemoteUser()%></sql:param>
> ></sql:query>
> >
> >then I would like to set all bean fileds to the retreived values,
> >I have tried to do:
> >
> ><c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}"
scope="session"/>
> >
> >unfortunately it does not work, if i try later obtain this value by:
> >
> ><c:out value="$Customer.name"/> I receive an empty string.
> >
> >If I use <c:out value="${cust_data.rows[0].CUST_NAME}"/> then it works
ok?
> >
> >I would be gratefull for any help.
> >
> >regards,
> >Lukasz
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
> ----------------------------------------------------------------------
> Portal INTERIA.PL zaprasza... >>> http://link.interia.pl/f174b
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Use Java Bean component
Posted by Lyndon Durham <ne...@verizon.net>.
Have you tried sessionScope.Customer.name ?
p@zdzior wrote:
>Hi everybody,
>
>I am using using java bean Component Customer:
>
><jsp:useBean id="Customer" class="com.test.CustomerBean" scope="session"/>
>
>which contails some filed like name, surname, ... and standard setter and getter methods.
>
>I try to do select on database to retreive all data about the current customer:
>
><sql:query var="cust_data" dataSource="${test}" scope="session">
> SELECT CUST_USERNAME, CUST_PHONENO, CUST_NAME, CUST_SURNAME, CUST_STREET, CUST_ZIPCODE, CUST_TOWN,
> CUST_EMAIL, CUST_SEX, CUST_AGE FROM CUSTOMER
> WHERE CUST_USERNAME = ?
> <sql:param><%= request.getRemoteUser()%></sql:param>
></sql:query>
>
>then I would like to set all bean fileds to the retreived values,
>I have tried to do:
>
><c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}" scope="session"/>
>
>unfortunately it does not work, if i try later obtain this value by:
>
><c:out value="$Customer.name"/> I receive an empty string.
>
>If I use <c:out value="${cust_data.rows[0].CUST_NAME}"/> then it works ok?
>
>I would be gratefull for any help.
>
>regards,
>Lukasz
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Use Java Bean component
Posted by Lyndon Durham <ne...@verizon.net>.
Have you tried sessionScope.Customer.name ?
p@zdzior wrote:
>Hi everybody,
>
>I am using using java bean Component Customer:
>
><jsp:useBean id="Customer" class="com.test.CustomerBean" scope="session"/>
>
>which contails some filed like name, surname, ... and standard setter and getter methods.
>
>I try to do select on database to retreive all data about the current customer:
>
><sql:query var="cust_data" dataSource="${test}" scope="session">
> SELECT CUST_USERNAME, CUST_PHONENO, CUST_NAME, CUST_SURNAME, CUST_STREET, CUST_ZIPCODE, CUST_TOWN,
> CUST_EMAIL, CUST_SEX, CUST_AGE FROM CUSTOMER
> WHERE CUST_USERNAME = ?
> <sql:param><%= request.getRemoteUser()%></sql:param>
></sql:query>
>
>then I would like to set all bean fileds to the retreived values,
>I have tried to do:
>
><c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}" scope="session"/>
>
>unfortunately it does not work, if i try later obtain this value by:
>
><c:out value="$Customer.name"/> I receive an empty string.
>
>If I use <c:out value="${cust_data.rows[0].CUST_NAME}"/> then it works ok?
>
>I would be gratefull for any help.
>
>regards,
>Lukasz
>
>
>
>
Re: Use Java Bean component
Posted by Serge Knystautas <se...@lokitech.com>.
> <c:set var="Customer.name" value = "${cust_data.rows[0].CUST_NAME}" scope="session"/>
When you are setting JavaBean properties, you need to use the alternate
approach for <c:set>. What you want is...
<c:set target="${Customer}" property="name" value="${foobar}" />
Check the spec or JSTL in Action if you want more examples or details on
how this works.
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com/
p. 1.301.656.5501
e. sergek@lokitech.com