[Opensource] REPOST: Outputting elements in JSP (Marc
Schipperheyn)
Michael Rimov
rimovm at centercomp.com
Fri Jul 5 15:19:38 PDT 2002
At 03:49 PM 7/5/2002 +0200, you wrote:
Hi Marc,
First off, the best way for me to debug a controller's output is append the
following parameters to you controller call:
style=XML&XSL=NONE
So if you have a default param, it might look something like so:
http://localhost:8080/MyController.do?state=MyState&style=XML&XSL=NONE
That will display the output in an XML format that you can browse through
to make sure your output tree is functioning correctly.
>Here's my code:
>**External State run method**
> Block blockList = new Block("Dierenoverzicht");
> Dier dierInit = new Dier();
> dierInit.setDBName("dieren");
>
> ArrayList list = soortInit.searchAndRetrieveList("Categorie");
>
> int size = list.size();
>
> ArrayList lDier = dierInit.searchAndRetrieveList("Dier");
> System.out.println(lDier.size());//recordcount = 2
> for(int x=0; x < lDier.size();x++){
> Dier dier = (Dier) lDier.get(x);
> Block blok2 = new Block("Dier" + x);
> Output out = new Output();
> out.setName("dierOverzicht");
> out.setAttribute("dierID", dier.getField("dierID"));
> out.setAttribute("DierNaam", dier.getField("dier"));
Doublecheck yourself by setting the content for your output and try to just
output the content via the taglib. I seem to remember a bug in OutputTag
where attributes weren't getting displayed properly from a while ago. [This
is just off the top of my head though]
The other way to go about displaying your information would be to use the
Struts tags to iteratate through your block and then use
<bean:write name="iteratorName" property="dierOverzicht.dierID"/>
<bean:write name="iteratorName" property="dierOverzicht.DierNaam"/>
At least these are the two approaches that I'd recommend looking into.
HTH!
-Mike
More information about the Opensource
mailing list