Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

request parameters from a list 1

Status
Not open for further replies.

sensory21

Programmer
Jan 27, 2004
79
0
0
GB
Hi all,

Hope Im in the right forum!

This is an extract of the file, my problem is:
at the end of this file I collect in the hidden field the list of nextStageList which is fine but I need to get it back at the top of the page for some other reasons; and i don't know how, i thought about the request below but it doesn't work, any ideas?
for testing i call it samepage.jsp so it reload on itself.

request.getParameterValues("nextStageList");
ArrayList nextStageList = new ArrayList();
....
....
....
<form name="f1" action="samepage.jsp" method="post">
<table width=80% bgcolor=white border=1 cellspacing=0 cellpadding=6 align=center>

<tr>
<%

%>
<%= th.format(ItemTypePeer.DESCRIPTION, "Item Type") %>
<%= th.format(SystemPeer.NAME, "System") %>
<%= th.format(ItemPeer.JTD, "JTD") %>
<%= th.format(ItemPeer.TAG, "Tag") %>
<%= th.format(StageTemplatePeer.DESCRIPTION, "Status") %>


<th class=tableheads nowrap>Next Stage</th>
<th class=tableheads nowrap>% Complete</th>
<th class=tableheads nowrap>Bar Graph</th>
</tr>

<%
Iterator i = items.iterator();

while(i.hasNext()) {
double pc;

Item item = (Item) i.next();
if(item.getNextStage().getStageId() == Stage.DONE) {
pc = 100.0;
}
else {
int done = item.getHistory().size();
int total = item.getItemType().getStages().size();
pc = 100.0 * done / total;
}

String nextStage = item.getNextStage().getStageTemplate().getDescription();
nextStageList.add(nextStage);

%>


<tr>
<td class=columnwhite><%=item.getItemType().getDescription()%></td>
<td class=columnwhite><%=item.getSystem().getName()%></td>
<td class=columnwhite><%=item.getJtd()%></td>
<td class=columnwhite><%=item.getTag()%></td>
<td class=columnwhite><%=item.getStage().getStageTemplate().getDescription()%></td>
<td class=columnwhite><%=nextStage%></td>
<td class=columnwhite><%=roundPercentage.format(pc)%>%</td>
<td class=columnwhite width="75">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #000000;">
<tr>
<% if (pc > 0.00001) {%>
<td width="<%=pc%>%" bgcolor="#3333FF"><img src="images/bargrph_spacer.gif" width="1" height="10"></td>
<%}%>
<% if (pc < 100.00000) {%>
<td bgcolor="#CCCCFF"><img src="images/bargrph_spacer.gif" width="1" height="10"></td>
<%}%>
</tr>
</table>
</td>
</tr>
<%
}
%>
<input type=hidden name=nextStageList value="<%= nextStageList %>">
</TABLE>
</form>
 
After you have populated the 'nextStageList' object, set the object in the session :

session.setAttribute("nextStageList", nextStageList);

You can then retrieve like :

ArrayList nextStageList = (ArrayList)session.getAttribute("nextStageList");

--------------------------------------------------
Free Database Connection Pooling Software
 
Hi,

Im getting confused I think Im tackling the task in the incorrect manner; my task is to have the column 'Next Stage' in the same format as the above (sorted column); the content of that column is retrieved like:
String nextStage = item.getNextStage().getStageTemplate().getDescription();

so there's no straight forward call like for the Tag column.
I thought about retrieving the content of the array at the top of the page like:
ArrayList stages = (ArrayList)session.getAttribute("nextStageList");
which works but not in the th.format
which is String format(String column, String label), of course you can't have an array instead of String column but even having the String column to Array wouldn't do the job.


<%= th.format(ItemTypePeer.DESCRIPTION, "Item Type") %>
<%= th.format(SystemPeer.NAME, "System") %>
<%= th.format(ItemPeer.JTD, "JTD") %>
<%= th.format(ItemPeer.TAG, "Tag") %>
<%= th.format(StageTemplatePeer.DESCRIPTION, "Status") %>

<th class=tableheads nowrap>Next Stage</th>
<th class=tableheads nowrap>% Complete</th>
<th class=tableheads nowrap>Bar Graph</th>

I hope Im clear in my request, any help would be very much appreciated.
cheers
vero
 
Hi Sedj,

in the jsp file:
TableHeadFormat th = new TableHeadFormat("tableheads", "wlink", urlPrefix, btnDown, btnUp, isAsc, sortOrder);


the class file:
public TableHeadFormat(String thClass, String aClass, String hrefPrefix, String arrowDown,
String arrowUp, boolean isAscending, String selColumn) {
setConstrParams(thClass, aClass, hrefPrefix, arrowDown, arrowUp, isAscending, selColumn);
}

public TableHeadFormat(String thClass, String aClass, String hrefPrefix, String arrowDown,
String arrowUp, String isAscending, String selColumn) {
boolean isAsc;
if (isAscending != null) {
isAsc = Boolean.valueOf(isAscending).booleanValue();
} else {
isAsc = true;
}
setConstrParams(thClass, aClass, hrefPrefix, arrowDown, arrowUp, isAsc, selColumn);
}

hope that answer your question?
Cheers
 
Hi,

no help is available for this??

it's urgent please...
 
I'm sorry, I just don't really understand what it is you are trying to do ...

--------------------------------------------------
Free Database Connection Pooling Software
 
Im not surprise, don't think I've explained very well!
We are now using Apache Torque and Im new to it...

I try again

This produce queries like sql:

Criteria cr = new Criteria();
cr.addJoin(ItemPeer.SYSTEMID, SystemPeer.SYSTEMID);
cr.addJoin(ItemPeer.STAGEID, StagePeer.STAGEID);
cr.addJoin(StagePeer.STAGETEMPLATEID, StageTemplatePeer.STAGETEMPLATEID);
cr.addJoin(ItemPeer.ITEMTYPEID, ItemTypePeer.ITEMTYPEID);

and this produce sorted columns and labels:

<%= th.format(ItemTypePeer.DESCRIPTION, "Item Type") %>
<%= th.format(SystemPeer.NAME, "System") %>
<%= th.format(ItemPeer.JTD, "JTD") %>
<%= th.format(ItemPeer.TAG, "Tag") %>
<%= th.format(StageTemplate.DESCRIPTION, "Status") %>

I need to add another sorted column but the ones above are straight forward in the sense that for example in the first line we want to sort the descriptions from the item table, my task is to sort the description in another table and 3 tables are involved :

item
====
stageId
nextStageId

stage
=====
stageId
stageTemplateId

stageTemplate
=============
stageTemplateId
description

so I need a colum to sort the description.stageTemplate from the nextStageId.item

is it clearer?

thanks
vero
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top