Interpreter.eval(textAreaText) output to ArrayList

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Interpreter.eval(textAreaText) output to ArrayList

Nikita Koselev
Hi.
I write program (jsp+java), which lauches java code entered into form on jsp page.

How can I pass Interpreter.eval(textAreaText) results back to this page, so user can see results?

How can I output Interpreter.eval results to ArrayList?

-----------------------------------------
ITV - Sinu lemmiksaated internetis!
http://www.itv.ee



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: Interpreter.eval(textAreaText) output to ArrayList

Kireitchik, Valeri
concerning 2nd question:
1) you can return ArrayList from interpreted script
2) you can call interpreter in loop and add results in ArrayList

Best regards

Valeri


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]On Behalf Of Nikita Koselev
Sent: Friday, August 05, 2005 12:21 PM
To: [hidden email]
Subject: [Beanshell-users] Interpreter.eval(textAreaText) output to ArrayList


Hi.
I write program (jsp+java), which lauches java code entered into form on jsp page.

How can I pass Interpreter.eval(textAreaText) results back to this page, so user can see results?

How can I output Interpreter.eval results to ArrayList?

-----------------------------------------
ITV - Sinu lemmiksaated internetis!
http://www.itv.ee



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: Interpreter.eval(textAreaText) output to ArrayList

Nikita Koselev
Hi,


Can you be a bit more specific? May be some examples?

I'm very newbie :(

I don't understand - how can I get results from interpreter.

I tried to catch it from System.out using System.setOut(outDisplay) where
outDisplay is child of PrintStream, but I failed to catch stdout output. :(

> concerning 2nd question:
> 1) you can return ArrayList from interpreted script
> 2) you can call interpreter in loop and add results in ArrayList
>
> Best regards
>
> Valeri
>
>
> -----Original Message-----
> From: [hidden email] > [mailto:[hidden email]]On Behalf Of Nikita > Koselev
> Sent: Friday, August 05, 2005 12:21 PM
> To: [hidden email]
> Subject: [Beanshell-users] Interpreter.eval(textAreaText) output to > ArrayList
>
>
> Hi.
> I write program (jsp+java), which lauches java code entered into form on > jsp page.
>
> How can I pass Interpreter.eval(textAreaText) results back to this page, > so user can see results?
>
> How can I output Interpreter.eval results to ArrayList?
>
> -----------------------------------------
> ITV - Sinu lemmiksaated internetis!
> http://www.itv.ee
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle > Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & > QA
> Security * Process Improvement & Measurement * > http://www.sqe.com/bsce5sf
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>

-----------------------------------------
ITV - Sinu lemmiksaated internetis!
http://www.itv.ee



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: Interpreter.eval(textAreaText) output to ArrayList

Daniel Leuck
Hi Nikita,

If you have a file called "C:/script.bsh" with the content

var list = new ArrayList();
list.add("Nikita");
list.add("Koselev");

In your Java code you can run the script and access the list like so:

Interpreter i=new Interpreter();
i.source("C:/script.bsh");
System.out.print(i.get("list"));

Alternatively you could use a command.

If you want to split the lines in a String into a List:

// import List and Arrays from java.util
List list = Arrays.asList(myString.split("\n"));

I suggest you read the BeanShell FAQ and docs relating to using BeanShell
from Java.

Cheers,
Dan

> -----Original Message-----
> From: [hidden email] [mailto:beanshell-users-
> [hidden email]] On Behalf Of Nikita Koselev
> Sent: Thursday, August 04, 2005 11:59 PM
> To: [hidden email], Valeri; Nikita Koselev; beanshell-
> [hidden email]
> Subject: RE: [Beanshell-users] Interpreter.eval(textAreaText) output to
> ArrayList
>
> Hi,
>
>
> Can you be a bit more specific? May be some examples?
>
> I'm very newbie :(
>
> I don't understand - how can I get results from interpreter.
>
> I tried to catch it from System.out using System.setOut(outDisplay) where
> outDisplay is child of PrintStream, but I failed to catch stdout
> output. :(
>
> > concerning 2nd question:
> > 1) you can return ArrayList from interpreted script
> > 2) you can call interpreter in loop and add results in ArrayList
> >
> > Best regards
> >
> > Valeri
> >
> >
> > -----Original Message-----
> > From: [hidden email] > [mailto:beanshell-
> [hidden email]]On Behalf Of Nikita > Koselev
> > Sent: Friday, August 05, 2005 12:21 PM
> > To: [hidden email]
> > Subject: [Beanshell-users] Interpreter.eval(textAreaText) output to >
> ArrayList
> >
> >
> > Hi.
> > I write program (jsp+java), which lauches java code entered into form on
> > jsp page.
> >
> > How can I pass Interpreter.eval(textAreaText) results back to this page,
> > so user can see results?
> >
> > How can I output Interpreter.eval results to ArrayList?
> >
> > -----------------------------------------
> > ITV - Sinu lemmiksaated internetis!
> > http://www.itv.ee
> >
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO
> > September 19-22, 2005 * San Francisco, CA * Development Lifecycle >
> Practices
> > Agile & Plan-Driven Development * Managing Projects & Teams * Testing &
> > QA
> > Security * Process Improvement & Measurement * >
> http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Beanshell-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/beanshell-users
> >
>
> -----------------------------------------
> ITV - Sinu lemmiksaated internetis!
> http://www.itv.ee
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users