Skip to main content
Nov 11, 2019 7:33 AM UTC
Solved

How I can add my button to some page that will run java code?

Hello, please tell me how I can add my button to some page that will run java code?

fivigAnswer
Nov 12, 2019 3:26 PM UTC
  1. Create jsp page e.g test.jsp with your java code, put to the Windchill_home/codebase/netmarkets/test.jsp
  2. Add AJAX function to the button to invoke your page
    https://wnc_host/Windchill/netmarkets/test.jsp​
  3. new Ajax.Request('netmarkets/test.jsp​', {
     method:'get',
     onSuccess: function(transport) {
     var response = transport.responseText || "no response text";
     alert("Success! \n\n" + response);
     },
     onFailure: function() { alert('Something went wrong...'); }
    });

This information is just an example of how you can invoke a Java code.

Most of new administrative UI use Angular, you can see examples in the directory: Windchill_home/codebase/apps/

4 replies

Nov 11, 2019 6:27 PM UTC

Hi Vlad,

Can you add more details, what type of page you want to customize?

Did you read Windchill Customizer guide?

Windchill UI use different technology, solution may be different.

To invoke java code, you can use: Servlet, JSP, IE tasks, REST Services, RMI call via http...

Some UI customizations.

VladiSlavAuthor
Nov 12, 2019 5:47 AM UTC

Hello, Ivan, I want to add a button to the main page, when you click on the button to run exactly java code, for example, the output of the contents of the database table. Foreign objects I created according to the documentation in the jsp file

 

Снимок.JPG

 

fivigAnswer
Nov 12, 2019 3:26 PM UTC
  1. Create jsp page e.g test.jsp with your java code, put to the Windchill_home/codebase/netmarkets/test.jsp
  2. Add AJAX function to the button to invoke your page
    https://wnc_host/Windchill/netmarkets/test.jsp​
  3. new Ajax.Request('netmarkets/test.jsp​', {
     method:'get',
     onSuccess: function(transport) {
     var response = transport.responseText || "no response text";
     alert("Success! \n\n" + response);
     },
     onFailure: function() { alert('Something went wrong...'); }
    });

This information is just an example of how you can invoke a Java code.

Most of new administrative UI use Angular, you can see examples in the directory: Windchill_home/codebase/apps/