InfoEngine for Beginners: Setup Tomcat and write your first jsp-task

 IT  Kommentare deaktiviert für InfoEngine for Beginners: Setup Tomcat and write your first jsp-task
Dez 072014
 

There are two different types of IE tasks. The first type is based on JSP technology (file-ending *.jsp). This enables you to run that task in a browser. The second type is a „pure“ IE task (file-ending *.xml).

In this small introduction to InfoEngine I will use the first one (JSP). Before we start with the development of an IE task, we should setup Tomcat to run in DEV-Mode. Run the following command in a Windchill shell (see Windchill Instal Config Guide):

cd Windchill/tomcat
ant -f config.xml configureJspEngine -Dmode=dev

To switch back to production setup, just replace mode=dev with mode=prod. Then (re-) start your Windchill Server.

Open the IE Taskeditor (from Windchill-Shell):

// on Windows:
taskeditor\bin\modeler.bat

// or on unix:
taskeditor\bin\modeler

Create a new JSP. Store them inside codebase or inside a subfolder of codebase:

Create new JSP Task

Create new JSP Task

Add the following lines to your JSP:

<%@ page language="java" session="false" %>

<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie" %>

<html>
    <body>
    <h1>
       List of WTParts with Name : klotz_001.prt
    </h1>

    <!-- Get all WTParts with name=klotz_001.prt -->
    <ie:webject name="Query-Objects" type="OBJ">
        <ie:param name="INSTANCE" data="net.mymhp.pboss.Windchill"/>
        <ie:param name="PAGE_COUNT" data="10"/>
        <ie:param name="TYPE" data="wt.part.WTPart"/>
        <ie:param name="WHERE" data="name=klotz_001.prt"/>
        <!-- The "Return-Group" is named to outputGroup -->
        <ie:param name="GROUP_OUT" data="outputGroup"/>
    </ie:webject>

    <!-- Display the queried group from above webject (WTParts) in a HTML Table -->
    <ie:webject name="Display-Table" type="DSP">
        <ie:param name="GROUP_IN" data="outputGroup"/>
    </ie:webject>

    </body>
</html>

Your Result should look like this:

IE Task Source

IE Task Source

At the bottom there is a button named „Execute“. With this button you can test your task, but you will probably get the following error:

Error JSP Task

Error JSP Task

The root-cause is, that this request to Tomcat was not authenticated. Add the blue marked part to your URL and re-execute the script:

protocolAuth

protocolAuth

The task has been executed successfully.