Matt Thomassan

Ranch Hand
+ Follow
since Dec 23, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matt Thomassan

Thanks Jim and Christophe!

But I am still finding it difficult to print one list object using 2 threads. Based on Jim's suggestion, when making the instance of thread, I am passing the reference of the list object. But how can I pass the reference of the list object in the run method.

Here is my code:


Am I doing something wrong in here?

Thanks>
@ Christophe

I am slightly confused. Do you mean I should put ProcessingThread class inside the main method of ThreadTest class?

I was looking at the API there is no overloaded method of run() that takes parameter. In such case, how can I pass the reference of the list object to the run method?

Thanks
I think it synchronization is the way to share an object between multiple threads.

But this code doesn't print anything:



What do you think?

Thanks>
Hi Christophe,

Thanks for your reply. I tried to put your suggestion in code but was struck as there is no overloaded run() in Thread class.

This is the code that I wrote.



How can I make the result object to be printed by 2 threads?

Many Thanks
Hello Ranchers,

I am trying to improve the performance of iterating through a collection object. Lets assume there is a List<String> with 100 objects. I want to loop through it and do some operation based on the String object. How can I use 2 threads to do loop through the List object.



How can I use 2 threads to go through the list object using 2 threads?

Any help/guidance is appreciated.

Thanks
@ James

Yes, we can use scriptlets or el expressions to retrieve values from a model.

Ok assume that, in your example, we are getting the string "whatever" from a java service after we submit the form.
I then have to pass this string "whatever" to a js function.
Assume myFunction1() is js function called after onchange event of a drop down.

Eg:
function myFunction1(){
this.formName.submit() // this will submit the form, a service gets called, service puts the string "whatever" into a model, and then we use EL to retrieve it eg: var result=${model.returnValue}
var result=${model.returnValue}
loadFile(result) //loadFile is another js function, ie. predefined in the api and its argument is the latest string retrieved from the service. Now the problem is after saying this.formName.submit(), the control never returns to the myFunction1()
}

Hope I have made the problem clear. I know we could do this using AJAX but we do not want to use AJAX.

Please let me know if you think there is another way of solving this problem.

Thanks for taking the effort to solve it.

Any suggestions are welcome.

Thanks
@ Eric.

Sorry for posting the question in multiple forums.

Can you give some example on post back?

Thank you for your guidance.

Thanks
@ James

I am picking the new value in the JSP using EL expression.
But the problem is, the new value has to be used in the javascript function. I have to pass this new value some how to a predefined javascript function.

Is there any way around except AJAX?

Thanks
Hi Ranchers,

Following is my problem:
There is a drop down menu. and onchange event a javascript function is called.
In the javascript function, I am doing 3 things:
1)alerting "before submit"
2)submitting the form
3)alerting "after submit"



But both the alerts get printed and then the form gets submitted.
What I want is:
1) Print the alert -- "Before Submit"
2) Submit the form (Thus reload the page)
3) Print the alert -- "After Submit"


Can you please guide me in achieving this?

Thanks a lot
Hi Ranchers,

I have the following problem while submitting a form on onchange event of a drop down menu.




I want to submit the form onchange of drop down, it calls a servlet, servlet returns the model to the jsp. I want to use this model into my javascript function.

But what is happening is finalFile variable in the js function is running before the form submit. Thus I am getting older value in model.fileName.

I want that on change event, the form must get submitted, and then the finalFile must be assigned the value in model.fileName.

Any suggestions are welcome.

Thans
Hi Bear,

Thank you so much for your guidance.

I appreciate it.

Thanks
10 years ago
JSP
Hi Bear,

Thanks for your reply.

Once we have put the Map of name value pair in the application scope, JSP can retrieve them.

But how do I get them into a javascript function?

I am sorry if it is a trivial question.

Thanks
10 years ago
JSP
Hi Ranchers,

I am facing a problem.

In my web application, I have a properties file that has many name-value pairs.

I want to use the names in properties file in a javascript function.

Eg:
1)
system.properties file:
jdbcurl = jdbcracle:thin:@myhost.com:1520:TID007z

2) javascript function:
function testfunction(jdbcurl){
var connectionurl=jdbcurl;
// some processing with connectionurl
}


So, how can i load the value of jdbcurl in the javascript function from the system.properties file?

Any suggestions are welcome.

Thanks
10 years ago
JSP
Hi Bear,

Thanks for your prompt reply.

Can you give some example?

Thanks
Hi Ranchers,

I am facing a similar problem.

In my web application, I have a properties file that has many name-value pairs.

I want to use the names in properties file in a javascript function.

Eg:
1)
system.properties file:
jdbcurl = jdbc:oracle:thin:@myhost.com:1520:TID007z

2) javascript function:
function testfunction(jdbcurl){
var connectionurl=jdbcurl;
// some processing with connectionurl
}


So, how can i load jdbcurl from the system.properties file?

Any suggestions are welcome.

Thanks