How to Include an Attribute Panel in a JSP Page
The techniques below apply to attribute panels created using Java builders. To display attribute panels on information pages, see Customizing Information Page Components for more information.
To Display a Link or Button That Launches Your Panel
To include a link or button that will launch your panel on a JSP page, create an action for your panel in your custom-actions.xml file and reference the action in an action tag in your JSP page. Your action should have a component subtag whose name is the id for your component builder.
Example action:
<action name="myAttributePanel">
<component name="myPanelComponent" typeBased="true" windowType="page" />
</action>
See Action Framework for Windchill Client Architecture for more information on actions and action attributes.
Example action tag:
<%@ tagliburi="http://www.ptc.com/windchill/taglib/components" prefix="jca"%>
.
.
.
<jca:action actionName="myAttributePanel" actionType="object" showIcon="false”/>
See the javadoc for the action tag for more information on the available tag attributes.
An alternative way to include a link to your panel is to use an <a> tag with a href constructed using the getComponentURL tag or getTypeBasedComponentURL tag. The former would be used when there is a single builder for a component builder id. The latter would be used when there are alternative builders for the builder id based on the type of the panel object. For example:
%@page import="com.ptc.netmarkets.util.misc.NetmarketURL"%
<%@ taglib uri="http://www.ptc.com/windchill/taglib/mvc" prefix="mvc"%>
.
.
.
<a href="<%=NetmarketURL.APPPREFIX%>${mvc:getTypeBasedComponentURL’
(myPanelComponent)}">
In this example “myPanelComponent” is the component builder id.
To Include Your Panel Inline on a JSP Page
Use the getComponentURL or getTypeBasedComponentURL tag to include your panel in a page. For example:
<%@ taglib uri="http://www.ptc.com/windchill/taglib/mvc" prefix="mvc"%>
.
.
.
<jsp:include page="${mvc:getComponentURL(‘attributesTable’)}" />
The getTypeBasedComponentURL should be used with builders that have a TypeBased annotation. It will generate a URLwith a “tcomp” handler key that tells the system to do a type-based lookup of the builder class. For example:
Windchill/ptc1/tcomp/attributesTable?typeBased=%27true%27&
typeIdForTypeLookup=%27wt.doc.WTDocument%27&portlet=component
If the panel builder is not TypeBased, use the getComponentURL tag.
도움이 되셨나요?