[Opensource] (no subject)
Mike Traum
mtraum at cirnetwork.org
Wed Oct 2 10:28:21 PDT 2002
The archives are at http://mail.jcorporate.com/pipermail/opensource/ - muy
gracias to Sandra - a lifesaver.
Here's a previous response I had regarding your question:
I believe you can use the bean:define tag, as in:
<bean:define id="scriptletID" type="java.lang.String" name="blockName"
property="@ID"/>
That will define the jsp-accessible variable called "scriptletID".
See if it works - I've struggled in the past with '/','@', etc in the
property field.
HTH,
Mike
-----Original Message-----
From: opensource-admin at jcorporate.com
[mailto:opensource-admin at jcorporate.com]On Behalf Of Devos, Edward
Sent: Wednesday, October 02, 2002 7:42 AM
To: 'opensource at jcorporate.com'
Subject: [Opensource] (no subject)
Hi All,
I'm having the same problem as Steve Wang reported on Sept 18 '02
I don't seem to be able to get this right, As I consider myself a newby in
Java, Struts and ... expresso
I need to point the property to the controllerResponse where the ID is
found.
The problem seems to be that I'm using a
BLOCK:ListIssue
<iterate k=0;k+1>
+BLOCK:oneIssue+k
+OUTPUT:issue
+Attribute: ID
Now I need the attribute ID in a scriptlet, using <expresso:AttributeTag
name="ID"/> in the HTML works great,
but how do I grab this value in a scriptlet ?? I tried a lot of stuff, but
as long as I don't understand how this works,
I'm not going to learn how to use this !
<bean:define id="variable" ..../>
can someone put me on track here please ?
I've also included my JSP code + runListIssueState() below:
Thanks a lot in advance:
PS is there an archive for the expresso-opensource list ?
<SNIP>----------------------------------------------------------------------
---------------------
<jsp:useBean id="controller" scope="session"
class="org.omini.expresso.webtrack.controller.IssueController" />
<%@ taglib uri="/WEB-INF/tld/expresso.tld" prefix="expresso" %>
<%@ taglib uri="/WEB-INF/tld/expresso-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/expresso-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/expresso-logic.tld" prefix="logic" %>
<%@ page import="org.omini.expresso.webtrack.controller.IssueController" %>
....<some more stuff>....
<table class="jc-default" border="1" align="center" name="IssueList"
cellpadding="2" cellspacing="2" bordercolor="#0000CC" bgcolor="#FFCC33"
width="90%">
<expresso:TableHead value=" ID | CurrentOwner | status | Short Description
"/>
<expresso:ElementCollection type="block">
<expresso:ElementIterator>
<expresso:ElementCollection type="output">
<expresso:ElementIterator>
<expresso:OutputTag name="issue">
<tr>
<!--
<bean:define id="issueID" type="java.lang.String" property=" ??? "/>
// I don't seem to be able to get this wright,
// I mean point to the property of the controllerResponse where the ID is
found
// I want to include the returned value of <expresso:AttributeTag
name="ID"/> in a URL
-->
<td width="4"><expresso:AttributeTag
name="ID"/></font></td>
<td width="150"><expresso:AttributeTag
name="current"/></font></td>
<td width="10"><expresso:AttributeTag
name="status"/></font></td>
<td width="300"><expresso:AttributeTag
name="shortDescription"/></font></td>
</expresso:OutputTag>
</expresso:ElementIterator>
</expresso:ElementCollection>
</expresso:ElementIterator>
</expresso:ElementCollection>
</table>
</SNIP>---------------------------------------------------------------------
----------------------
<SNIP>----------------------------------------------------------------------
---------------------
protected ControllerResponse runListIssueState(
ControllerRequest myRequest, ControllerResponse myResponse )
throws ControllerException
{
String myName=thisClass+"ListIssue() ";
System.out.println( myName );
try {
// Create a block called "CustomerList" which is the root of the
controller
// response.
Block blockList = new Block("IssueList");
// We retrieve all the stocks from the database. For each row
// tuple form the database we create an Output for it.
Issue issue = new Issue();
issue.setDBName( myRequest.getDBName() );
ArrayList list = issue.searchAndRetrieveList( "ID" );
int N=list.size();
for ( int k=0; k < N ; ++k )
{
Issue oneIssue = (Issue)list.get(k);
// Create a Block for each row tuple
Block blockRow = new Block("oneIssue"+k );
// Create an Output for the DBObject row tuple and add to
// the row Block
Output out1 = new Output();
out1.setName("issue");
// set the ID
out1.setAttribute("ID", oneIssue.getField("ID") );
out1.setAttribute("shortDescription",
oneIssue.getField("SHORTDESC"));
// get the Engineers login from the id that is stored in
currentowner
Engineer oneEngineer = new Engineer();
oneEngineer.setDBName(myRequest.getDBName());
oneEngineer.setField("ID",
oneIssue.getField("CURRENTOWNER"));
if ( oneEngineer.find() )
{
try
{
oneEngineer.retrieve();
}
catch (DBException dbe)
{
throw new ControllerException("DataBase Exception
"+dbe);
}
}
out1.setAttribute("current",
oneEngineer.getField("DESCRIPTION") );
// get the Engineers login from the id that is stored in
currentowner
oneEngineer.clear();
oneEngineer.setDBName(myRequest.getDBName());
oneEngineer.setField("ID", oneIssue.getField("CREATEDBY"));
if ( oneEngineer.find() )
{
try
{
oneEngineer.retrieve();
}
catch (DBException dbe)
{
throw new ControllerException("DataBase Exception
"+dbe);
}
}
out1.setAttribute("createdBy",
oneEngineer.getField("DESCRIPTION") );
// get the Staus description from the id that is stored in
status
Status oneStatus = new Status();
oneStatus.setDBName(myRequest.getDBName());
oneStatus.setField("ID", oneIssue.getField("STATUS"));
if ( oneStatus.find() )
{
try
{
oneStatus.retrieve();
}
catch (DBException dbe)
{
throw new ControllerException("DataBase Exception
"+dbe);
}
}
out1.setAttribute( "status",
oneStatus.getField("DESCRIPTION") );
blockRow.add(out1);
blockList.add(blockRow);
}
// Finally add the block to the list
myResponse.addBlock(blockList);
}
catch (DBException dbe) {
throw new ControllerException(
myName+ " database exception: "+dbe.getMessage() );
}
//myResponse.setStyle("listIssue");
myResponse.setStyle("listIssue");
return myResponse;
}
----------------------------------------------------------------------------
---------------
Edward Devos
The information transmitted by this e-mail message is intended solely for
the use of the person to whom or entity to which it is addressed. The
message may contain information that is privileged and confidential.
Disclosure, dissemination, distribution, review, retransmission to, other
use of or taking any action in reliance upon this information by anyone
other than the intended recipient is prohibited. If you are not the intended
recipient, please do not disseminate, distribute or copy this communication,
by e-mail or otherwise. Instead, please notify us immediately by return
e-mail (including the original message with your reply) and then delete and
discard all copies of the message.
Although we have taken precautions to minimize the risk of transmitting
viruses we nevertheless advise you to carry out your own virus checks on any
attachment to this message. We accept no liability for any loss or damage
caused by viruses.
More information about the Opensource
mailing list