From: <php...@li...> - 2013-04-30 20:21:06
|
I'm trying to include a .jsp file from PHP. I'm experienced in PHP, but new to Java. If I just include it using java_virtual() it includes and displays correctly, unless the attributes are used, in which case it fails with "org.apache.tiles.jsp.taglib.TilesJspException: Attribute with name 'title' not found": echo java_virtual("WEB-INF/views/tiles/test.jsp", true); But I can't figure out how to define the attributes from PHP. I've also tried using this method, which appears to have a mechanism for specifying attributes, but I'm new to Java and can't find any value that works for the foo.bar.bazTag part: $attributes = array("att1"=>"98.5", "att2"=>"92.3","att3"=>"107.7"); $pc = new java_PageContext($session); $tag = new java_Tag($pc, "foo.bar.bazTag", $attributes); if($tag->start()) { do { $pc->getPageContext()->getOut()->print("member:: "); $pc->getPageContext()->getOut()->println($pc->getPageContext()->getAttribute("member")); } while($tag->repeat()); } $tag->end(); I've tried the .tag filename, relative path, full path, and "name" attribute defined in WEB-INF/tiles-layout.xml: <definition name=".test" template="/WEB-INF/views/tiles/test.jsp"> <put-attribute name="title" value="${title}"/> </definition> Which loads it the same as doing this in PHP: $thisTag = new Java("foo.bar.bazTag"); It looks like either way should work if I can figure out how to define attributes for the first method, if possible, or know how to call it using java_Tag. Thanks, Brian |