You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JavaNoobie87 <vi...@enzentech.com> on 2011/07/11 11:54:27 UTC

Using Display Tag library

Hi All,
Im developing a web app that performs the display of data in a tabular
manner.
Im trying to  use the display tag library  to help me with the pagination
and sorting of the data being presented . But , seem to have hit a roadblock
here , all samples of the displaytag library that I have come across ,
involve storing the entire resultset from the query in the session, which is
a huge performance  issue for me , Does anybody know how I could use the
displaytag library using only the request scope? Or any other library that
helps in pagination but uses only the request??

Many Thanks,
Vivek.


--
View this message in context: http://struts.1045723.n5.nabble.com/Using-Display-Tag-library-tp4574481p4574481.html
Sent from the Struts - User mailing list archive at Nabble.com.

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


[OT] Re: Using Display Tag library

Posted by Dave Newton <da...@gmail.com>.
On Mon, Jul 11, 2011 at 8:34 AM, JavaNoobie87 wrote:
> The thing is I'm  NOT using struts 2 here , just basic jsp,javabeans and
> servlets .(Its a sort of demo project!).

Well, this is a Struts mailing list.

> As of now my DAO fetches the result according to this query

How the data is retrieved isn't relevant, unless you need to implement
paging, which is a matter of offset and length.

> FROM DOMAIN WHERE DOMAINTYPE_OID='"+dt_oid+"' ORDER BY

Please search the web for "sql injection".

> I really didnt quite understand how external paging would help me ?

By making it unnecessary to keep your entire list in session or
request, like your original question seemed to ask.

Dave

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


Re: Using Display Tag library

Posted by JavaNoobie87 <vi...@enzentech.com>.
Hey Eric,
thanks for replying!
The thing is I'm  NOT using struts 2 here , just basic jsp,javabeans and
servlets .(Its a sort of demo project!).
As of now my DAO fetches the result according to this query
	if (con != null){
					System.out.println("Connected");
					String query= "SELECT OBJECTID,CODE,DESCRIPTION,ISEDITABLE, ISACTIVE
FROM DOMAIN WHERE DOMAINTYPE_OID='"+dt_oid+"' ORDER BY
DOMAINTYPE_OID,OBJECTID " ;
					stmt = con.prepareStatement(query);
					rs = stmt.executeQuery();
					while (rs.next()){
						domainBean= new DomainBean();
						domainBean.setObjid(rs.getInt("OBJECTID"));
						domainBean.setCode(rs.getString("CODE"));
						//processing of the bean
						domainBean.setDescription(rs.getString("DESCRIPTION"));
						domList.add(domainBean);
					}

Set this servlet to the request in my servlet--
request.setAttribute("domList", domList);
And in the jsp i display it as follows.

<display:table name="${domList}"
					pagesize="10" id="dl" export="true" class="FrmBodyDataGridHeading">
					<display:setProperty name='css.tr.even' value="FrmBodyDataGridData" />
					<display:setProperty name='css.tr.odd'
						value="FrmBodyDataGridAlternateRow" />
					<display:column property="code" sortable="true" />
					<display:column property="description" sortable="true" />
					<display:column property="statusActive" sortable="true"
						title="IsActive?" />
					<display:column property="statusEdit" title="IsEdit?"
						sortable="true" />

					<display:column title="Edit" media="html">
						<c:set var="id" value="${dl.objid}" />
						 ControlServlet?selected=${dl.objid} Edit  
					</display:column>
I really didnt quite understand how external paging would help me ? Could
you kindly elaborate with respect to my situation . 
Many Thanks.

					</display:table></TD>.
Any ideas how I should go about modifying my code ?


--
View this message in context: http://struts.1045723.n5.nabble.com/Using-Display-Tag-library-tp4574481p4574825.html
Sent from the Struts - User mailing list archive at Nabble.com.

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


Re: Using Display Tag library

Posted by Eric Lentz <Er...@sherwin.com>.
> all samples of the displaytag library that I have come across ,
>involve storing the entire resultset from the query in the session

Really? I use displaytag all the time through the equivalent of request 
scope. Just pass it a list in the same way you would use a Struts2 select 
list (http://struts.apache.org/2.2.1/docs/select.html).

If passing the whole list is problematic, you can also use the external 
paging/sorting option of displaytag (
http://www.displaytag.org/1.2/tut_externalSortAndPage.html).

- Eric