You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ORACLEADF <or...@gmail.com> on 2013/04/06 14:32:26 UTC
Bind ResultSet of a SQL query with wicket datatable
How to Bind the ResultSet of a SQL query or a MSSQL stored procedure with
wicket data table.
The following example shows how to bind wicket combo box :
* List<PersonnelDTO> personnelDTOList;
personnelDTOList = handler.gettblPersonnel("0", "0", "1", "0");
DropDownChoice<PersonnelDTO> personnelCombo = new
DropDownChoice<PersonnelDTO>("personnelCombo"
, new Model<PersonnelDTO>()
, personnelDTOList
, new IChoiceRenderer<PersonnelDTO>() {
@Override
public Object getDisplayValue(PersonnelDTO personnelDTO) {
return personnelDTO.getPersonnelName();
}
@Override
public String getIdValue(PersonnelDTO personnelDTO, int i) {
selected = personnelDTO.getID();
return personnelDTO.getID();
}
});
*
-----
Regards
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by Martin Grigorov <mg...@apache.org>.
http://central.maven.org/maven2/org/wicketstuff/wicketstuff-inmethod-grid/
You can use 1.5.9.1
On Tue, Apr 16, 2013 at 4:39 PM, ORACLEADF <or...@gmail.com> wrote:
> I use the following link and I think the last version is 1.5-RC5.1.
> http://mvnrepository.com/artifact/org.wicketstuff/inmethod-grid
> Now I changed its version to 1.5.7 but it couldn’t download required jar
> files from remote maven repository.
> Please help me how do this.
>
>
>
>
> -----
> Regards
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793p4658026.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by ORACLEADF <or...@gmail.com>.
I use the following link and I think the last version is 1.5-RC5.1.
http://mvnrepository.com/artifact/org.wicketstuff/inmethod-grid
Now I changed its version to 1.5.7 but it couldn’t download required jar
files from remote maven repository.
Please help me how do this.
-----
Regards
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793p4658026.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Apr 16, 2013 at 4:08 PM, ORACLEADF <or...@gmail.com> wrote:
> Finally I could complete this job without error so I write my experience
> here. This may be helpful for other users like me.
> I updated wicket framework from version 1.4.21 to new version 1.5.7, also I
>
why 1.5.7 instead of 1.5.10 ?
> updated wicketstuff-inmethod-grid module form version 1.4.14 to new version
> 1.5-RC5.1, in pom.xml.
>
why 1.5-RC1 instead of 1.5.7 (1.5.10) ?
> Great thanks to Andrea Del Bene for his Great guide book.
> The important parts of book re
> lated to this job: Appendix B.5, Chapter 11.4
> I uploaded codes. This project is a maven project and uses JDBC to call a
> mssql stored procedure to fetch personnel data in service layer and uses
> Spring framework to inject objects to presentation layer.
> sale3.rar
> <http://apache-wicket.1842946.n4.nabble.com/file/n4658023/sale3.rar>
> Untitled.png
> <http://apache-wicket.1842946.n4.nabble.com/file/n4658023/Untitled.png>
>
>
>
> -----
> Regards
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793p4658023.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by ORACLEADF <or...@gmail.com>.
Finally I could complete this job without error so I write my experience
here. This may be helpful for other users like me.
I updated wicket framework from version 1.4.21 to new version 1.5.7, also I
updated wicketstuff-inmethod-grid module form version 1.4.14 to new version
1.5-RC5.1, in pom.xml.
Great thanks to Andrea Del Bene for his Great guide book.
The important parts of book re
lated to this job: Appendix B.5, Chapter 11.4
I uploaded codes. This project is a maven project and uses JDBC to call a
mssql stored procedure to fetch personnel data in service layer and uses
Spring framework to inject objects to presentation layer.
sale3.rar
<http://apache-wicket.1842946.n4.nabble.com/file/n4658023/sale3.rar>
Untitled.png
<http://apache-wicket.1842946.n4.nabble.com/file/n4658023/Untitled.png>
-----
Regards
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793p4658023.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Tue, Apr 16, 2013 at 7:47 AM, ORACLEADF <or...@gmail.com> wrote:
> Hi
> After reading the Andrea’s book (Appendix B.5) finally I could fill a grid
> simply with the following code, but when I want to navigate between pages
> at
> run time I got a Page Expired error. I don’t know what is wrong.
>
Check the server logs.
Most probably some of your objects is not serializable.
>
> final ListDataProvider listDataProvider = new
> ListDataProvider(personnelDTOList);
> List<IGridColumn> cols = (List) Arrays.asList(
> new PropertyColumn(new Model("PersonnelName"), "PersonnelName"),
> new PropertyColumn(new Model("PersonnelPhone"), "PersonnelPhone")
> );
> DataGrid grid = new DefaultDataGrid("grid", new
> DataProviderAdapter(listDataProvider), cols);
> add(grid);
>
>
>
>
> -----
> Regards
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793p4658003.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by ORACLEADF <or...@gmail.com>.
Hi
After reading the Andrea’s book (Appendix B.5) finally I could fill a grid
simply with the following code, but when I want to navigate between pages at
run time I got a Page Expired error. I don’t know what is wrong.
final ListDataProvider listDataProvider = new
ListDataProvider(personnelDTOList);
List<IGridColumn> cols = (List) Arrays.asList(
new PropertyColumn(new Model("PersonnelName"), "PersonnelName"),
new PropertyColumn(new Model("PersonnelPhone"), "PersonnelPhone")
);
DataGrid grid = new DefaultDataGrid("grid", new
DataProviderAdapter(listDataProvider), cols);
add(grid);
-----
Regards
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793p4658003.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by ORACLEADF <or...@gmail.com>.
Hi Andrea ,Thank you.
I created the following data provider, please help me how to bind this
provider with a dataview.
*public class PersonnelsProvider implements IDataProvider<PersonnelDTO> {
private List<PersonnelDTO> personnelDTOList;
private final DatabaseHandler handler;
public PersonnelsProvider(DatabaseHandler handler) {
this.handler = handler;
personnelDTOList = this.handler.gettblPersonnel("0", "0", "1", "0");
}
@Override
public Iterator<? extends PersonnelDTO> iterator(int first, int count) {
return personnelDTOList.iterator();
}
@Override
public int size() {
return personnelDTOList.size();
}
@Override
public IModel<PersonnelDTO> model(PersonnelDTO personnelDTO) {
return new LoadableDetachableModel<PersonnelDTO>() {
@Override
protected PersonnelDTO load() {
return null; //To change body of implemented methods use
File | Settings | File Templates.
}
};
}
@Override
public void detach() {
}
}
*
-----
Regards
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793p4657980.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Bind ResultSet of a SQL query with wicket datatable
Posted by Andrea Del Bene <an...@gmail.com>.
Hi,
you should use a custom implementation of interface IDataProvider to
bind your query result to the component. Then, you can take a look at
class PropertyColumn to know how to map your data to table's columns.
> How to Bind the ResultSet of a SQL query or a MSSQL stored procedure with
> wicket data table.
> The following example shows how to bind wicket combo box :
> * List<PersonnelDTO> personnelDTOList;
> personnelDTOList = handler.gettblPersonnel("0", "0", "1", "0");
>
> DropDownChoice<PersonnelDTO> personnelCombo = new
> DropDownChoice<PersonnelDTO>("personnelCombo"
> , new Model<PersonnelDTO>()
> , personnelDTOList
> , new IChoiceRenderer<PersonnelDTO>() {
> @Override
> public Object getDisplayValue(PersonnelDTO personnelDTO) {
> return personnelDTO.getPersonnelName();
> }
>
> @Override
> public String getIdValue(PersonnelDTO personnelDTO, int i) {
> selected = personnelDTO.getID();
> return personnelDTO.getID();
> }
> });
> *
>
>
>
> -----
> Regards
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Bind-ResultSet-of-a-SQL-query-with-wicket-datatable-tp4657793.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org