Six Stars

How to pass multiple values in tSystem component

I am trying to pass 2 querystring parameters in my Job using tSystem component to launch a JSP page. The page gets launched properly but always i am getting the second parameter as null.

Can you help me in that? See in my screenshot below, i am passing the value as:

"cmd /c start chrome http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid"

This gives first parameter as correct, but second parameter is null.

 

tablename.jpgtablename2.jpg

8 REPLIES
Employee

Re: How to pass multiple values in tSystem component

Encode your url.  It is possible that the & is being interpreted differently in a java script.  Look at URL Encoding when you pass parameters.

Six Stars

Re: How to pass multiple values in tSystem component

Ok. But I am not able to understand how to use  encodeURI in our example.

I think we need to do something like this:

var uri = "my test.asp?name=ståle&car=saab";
var res = encodeURI(uri);

 

How to do it in our case i.e. what would command line look like?

Employee

Re: How to pass multiple values in tSystem component

Hi @ppp_rrr

These are simple developer questions.  It takes less time to google it and find the answer 

https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters

Six Stars

Re: How to pass multiple values in tSystem component

Ya sure @iburtally, it was easy to find on net about encoding, but what I wanted that how to pass it in our URL. i am trying to pass value as:

"cmd /c start chrome " + "URLEncoder.encode(http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid, \"UTF-8"\ +")"; "

 

But not getting success, there are errors in it..so I am only seeking help on Syntax..

Employee

Re: How to pass multiple values in tSystem component

"cmd /c start chrome " + URLEncoder.encode("http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid", "UTF-8")

Six Stars

Re: How to pass multiple values in tSystem component

Thanks for the reply.

But now I am getting the error that URL encoder cannot be resolved!

encode.jpg

Employee

Re: How to pass multiple values in tSystem component

Prefix the URLEncoder class with its package name

java.net.

Six Stars

Re: How to pass multiple values in tSystem component

This resolves my compiler error and my final string is now:

"cmd /c start chrome " + java.net.URLEncoder.encode("http://localhost:8080/TestDataUpdate?tablename=temp_staging_table&pk=empid", "UTF-8")

 

However, on executing my Job, this only launches 'chrome' and the application hosted doesn't gets launched.