cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Is there any possibility to read endpoint tag values in JSP page?

Manoj_Dokku4
11-Garnet

Is there any possibility to read endpoint tag values in JSP page?

My Requirement is to read a (CR)text box value, when Clicked to fetch the values, I have to show a Dropdown list of (CN's) associated to it.

 

I'm just trying to read the values first.

 

 

 

<html>
<head>
<script>
	var request;
	function sendInfo() {
		var v = document.vinform.t1.value;
		var url = "http://Server/Windchill/servlet/odata/v1/ProjFolder/EndpointName?%24count=false";
		if (window.XMLHttpRequest) {
			request = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			request = new ActiveXObject("Microsoft.XMLHTTP");
		}

		try {
			request.onreadystatechange = getInfo;
			request.open("GET", url, true);
			request.send();
		} catch (e) {
			alert("Unable to connect to server");
		}
	}

	function getInfo() {
		if (request.readyState == 4) {
			var val = request.responseText;
			document.getElementById('amit').innerHTML = val;
		}
	}
</script>
</head>
<body>
	<marquee>
		<h1>This is an example of ajax</h1>
	</marquee>
	<form name="vinform">
		<input type="text" name="t1"> 
		<input type="button" value="ShowTable" onClick="sendInfo()">
	</form>
	<span id="amit"> </span>
</body>
</html>

 

 

 

I'm trying to read required JSON tags from the output and pass them to the  Dropdown values to select.

 

@HelesicPetr  any idea on this?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Manoj_Dokku4 

For JSP pages I use taglibs that can be used in windchill Wizards

so I can build a dropdown selection (ComboBox)

 

<%@ taglib prefix="wrap" uri="http://www.ptc.com/windchill/taglib/wrappers" %>

<%
//search for a list in the ComboBox
List<String> order_internal_vals = AVCommands.getSubTypePartAttributesforcomboBox(); // my own java function
request.setAttribute("order_display_vals", order_internal_vals); // save output in a request for display list
request.setAttribute("order_internal_vals", order_internal_vals); // save output in a request internal list
%>

<wrap:comboBox id="orderPart2" name="orderPart2" multiSelect="false" size="1"
displayValues="${order_display_vals}"
internalValues="${order_internal_vals}"
onchange="selectProject('orderPart2','zipProject2')" editable="true"/>
 
<script type="text/javascript">

function selectProject(lokotable, projectTable) {
var comboLokomotive = document.getElementById(lokotable);
if (comboLokomotive != null && comboLokomotive != undefined) {
var index = comboLokomotive.selectedIndex;
//itemValue = comboLokomotive.options[index].value;
setValueProject(index, projectTable);
}
}

function setValueProject(value, projectTable) {
var comboProject = document.getElementById(projectTable);
if (comboProject != null && comboProject != undefined) {
comboProject.selectedIndex = value;
}
}
</script>

 Maybe it can help you

 

PetrH

View solution in original post

2 REPLIES 2

Hello @Manoj_Dokku4 

For JSP pages I use taglibs that can be used in windchill Wizards

so I can build a dropdown selection (ComboBox)

 

<%@ taglib prefix="wrap" uri="http://www.ptc.com/windchill/taglib/wrappers" %>

<%
//search for a list in the ComboBox
List<String> order_internal_vals = AVCommands.getSubTypePartAttributesforcomboBox(); // my own java function
request.setAttribute("order_display_vals", order_internal_vals); // save output in a request for display list
request.setAttribute("order_internal_vals", order_internal_vals); // save output in a request internal list
%>

<wrap:comboBox id="orderPart2" name="orderPart2" multiSelect="false" size="1"
displayValues="${order_display_vals}"
internalValues="${order_internal_vals}"
onchange="selectProject('orderPart2','zipProject2')" editable="true"/>
 
<script type="text/javascript">

function selectProject(lokotable, projectTable) {
var comboLokomotive = document.getElementById(lokotable);
if (comboLokomotive != null && comboLokomotive != undefined) {
var index = comboLokomotive.selectedIndex;
//itemValue = comboLokomotive.options[index].value;
setValueProject(index, projectTable);
}
}

function setValueProject(value, projectTable) {
var comboProject = document.getElementById(projectTable);
if (comboProject != null && comboProject != undefined) {
comboProject.selectedIndex = value;
}
}
</script>

 Maybe it can help you

 

PetrH

Hi - first, take out that activexobject code. Obsolete and confusing.  Next, replace EndpointName with something real. Try an experiment at

server/Windchill/netmarkets/html/wrs/doc.html

 

A small amount of trial-and-error on that site tells me that a working request is GET: 

server/Windchill/servlet/odata/v5/ChangeMgmt/ChangeNotices?%24count=false

You need to send that with a header of accept: application/json because {mumble}

 

PTC has a document describing WRS (Windchill Rest Services). Here is the 2.2 version (there is a 2.3 version but I don't have the link handy).

https://www.ptc.com/support/-/media/support/refdocs/Windchill_REST_Services/2,-d-,2/wrs_pdf.pdf?sc_lang=en

 

cheers -- Rick

Top Tags