Struts and Velocity Forms

2005-03-23 Thread Robin Mannering
Hi all, Another newbie question here. I'm working with a StrutsForm that holds checkbox selections in a String[] as I normally do when working with struts. In the form, I'm having difficulty pre-selecting checkbox options that the user set on a previous request, so far I have

Embedding a Servletgenerated Graphic into an Template

2005-03-23 Thread Michael Belz
Hi, I'm trying to put a graphic into an Velocity Template (vm). The problem is that the servelt generated graphic should not be physically saved to an temporary folder on the server. It's an encoded jpeg stored in a bytearray. When I use the servlet path at an 'img src'-tag the graphic is

Embedding an temporary Picture into an Template

2005-03-23 Thread Michael Belz
Hi, I'm trying to put a graphic into an Velocity Template (vm). The problem is that the servelt generated graphic should not be physically saved to an temporary folder on the server. It's an encoded jpeg stored in a bytearray. When I use the servlet path at an 'img src'-tag the graphic is

RE: Embedding an temporary Picture into an Template

2005-03-23 Thread Robin Mannering
Hi Michael, We embed images using servlets a fair bit and what we intend to do is this: In the JSP/VM page, have a standard HTML img tag as : img src=servlet/GetImageServlet alt=Server Side Image The servlet that is called from within the image tag then creates the image and streams it

RE: Embedding an temporary Picture into an Template

2005-03-23 Thread Michael Belz
Hi Robin thx for you answer! I know this way to do it. The problem is that the guys here have written their own dispatcher servlet so that I can't access the picture that way. I also need to do a few SQL statements first so that I use a controller I wrote that collects all the data needed and

Re: Embedding an temporary Picture into an Template

2005-03-23 Thread Meikel Bisping
Hi Michael, if you find a solution let me know. In a different context I create temp graphic files and used a FileDeleterThread to delete them again after 300 secs. e.g. Vector tmpFiles=new Vector(); tmpFiles.add(f1); FileDeleterThread fd = new FileDeleterThread(tmpFiles, 300);

How to retreive template node value

2005-03-23 Thread Vinay Agrawal
Hi, I have template #set($name=john) how can i retrieve name value(john) in java file. I got the template by Template temp = Velocity.getTemplate(templateName); After that i unable to retrieve name value. Thanks Vinay

Re: How to retreive template node value

2005-03-23 Thread tarun Narang
hi to retrieve the value u must have to put that variable value in hidden variable in the VTL page input type=hidden name=name value=$!name and in java file u must have to write name = ((HttpServletRequest) data.getRequest()) .getParameter(name); Regards Tarun - Original

Re: Embedding an temporary Picture into an Template

2005-03-23 Thread Christoph Reck
Hi, since your code snippet works for 1 image, then you can refer to this URL from another veloctity generated HTML pages using the img src=... element. The browser will then open additional connections to your server and retrieve the image(s). You may have the problem that HTML generating servlet

Re: Embedding an temporary Picture into an Template

2005-03-23 Thread Christoph . Reck
Hi, since your code snippet works for 1 image, then you can refer to this URL from another veloctity generated HTML pages using the img src=... element. The browser will then open additional connections to your server and retrieve the image(s). You may have the problem that HTML generating servlet

How to run for loop

2005-03-23 Thread tarun Narang
hi I want to run a for loop for a number of times in velocity page how can i Thanks T - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to run for loop

2005-03-23 Thread Dimitrios Kolovos
#foreach ($i in [0..10]) ##Do your stuff here #end Please consider the RTFM principle. Cheers, Dimitrios - Original Message - From: tarun Narang [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Wednesday, March 23, 2005 2:06 PM Subject: How to run for

Re: How to run for loop

2005-03-23 Thread tarun Narang
Thanks but my problem is that i dont want to use the object or ArrayList i want to run the loop like in java as for(int i=0 ;i=5; i++) in velocity page Is it possible to run the code like below #set ($countRow =5) #foreach($i in $!countRow) ...some statements #end - Original

RE: How to run for loop

2005-03-23 Thread Sayed Hashimi
#foreach ($i in [0..5]) try that. -- Sayed Ibrahim Hashimi www.cise.ufl.edu/~sih -Original Message- From: tarun Narang [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 23, 2005 9:42 AM To: Velocity Users List Subject: Re: How to run for loop Thanks but my problem is that i dont want

RE: Struts and Velocity Forms

2005-03-23 Thread Robin Mannering
Hi all, Continued working on this problem and have it resolved in the following Velocity macro. I'm surprised it didn't already exist being a very common requirement (maybe it does but I just haven't found it !!) --- #* * HTML velocimacro * @author Robin Mannering *# ##

Re: Struts and Velocity Forms

2005-03-23 Thread Charles N. Harvey III
What is being filled into the StrutsForm? Is it something like: public class MyForm { private String[] interestOptions; public String[] getInterestOptions(){ return this.interestOptions; } public void setInterestOptions( String[] sValue ){ this.interestOptions = sValue;

Re: How to run for loop

2005-03-23 Thread Dimitrios Kolovos
#set($count = 5) #foreach($i in [0..$count]) ##Do your stuff here #end - Original Message - From: tarun Narang [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Sent: Wednesday, March 23, 2005 2:42 PM Subject: Re: How to run for loop Thanks but my problem is

RE: Struts and Velocity Forms

2005-03-23 Thread Robin Mannering
Hi Charlie, Many thanks for that response... I think we're both on the same train of thought here (with the nested loops). The main difference I think is determining if the checkbox had been rendered on each pass through the outer loop. The velocimacro I just submitted is the first I've

velocity.properties

2005-03-23 Thread Robin Mannering
Hi all, I'd like to make a common file to put velocity macros into and I understand I need to create a velocity.properties file, I'm just not sure where to place it within my web application folder tree for it to be picked up. I also don't want to override the default values held in

How to convert string in int

2005-03-23 Thread tarun Narang
Hi Can anyone tell me that how the string can be converted into int in VTL I am recieving the value in count variable through getRequest but this variable has a string value and i have to add some int value in this count variable like $count + 5. #set ($count =

Re: How to run for loop

2005-03-23 Thread tarun Narang
thanks Dimitrios Its work if i place the code as you told but still i have some problems Below is my code Please have a look on it #set ($count= $!data.getRequest().getParameter(countRow)) i am getting this count value through request Parameter which i definately getting as a string that's

Re: How to run for loop

2005-03-23 Thread tarun Narang
its working but still my problem has not solved this 5 is static for this loop #foreach ($i in [0..5]) but in my code i am getting the value of 5 in some variable say $!count = 5 and i tried to run the loop now as #foreach($i in $!count ) ..some statements #end but it is not working Thanks

Re: How to convert string in int

2005-03-23 Thread Mike Kienenberger
tarun Narang [EMAIL PROTECTED] wrote: Can anyone tell me that how the string can be converted into int in VTL I am recieving the value in count variable through getRequest but this variable has a string value and i have to add some int value in this count variable like $count + 5. #set

Re: velocity.properties

2005-03-23 Thread Shinobu Kawai
Hi Robin, I'd like to make a common file to put velocity macros into and I understand I need to create a velocity.properties file, I'm just not sure where to place it within my web application folder tree for it to be picked up. I also don't want to override the default values held in

Re: How to convert string in int

2005-03-23 Thread tarun Narang
its working but its not work with NumberTool its properly runs by using MathTool Thanks - Original Message - From: Mike Kienenberger [EMAIL PROTECTED] To: Velocity Users List velocity-user@jakarta.apache.org Cc: Velocity Users List velocity-user@jakarta.apache.org Sent: Wednesday,

Re: Struts and Velocity Forms

2005-03-23 Thread Shinobu Kawai
Hi Robin, Can you break out of a velicity foreach loop? Could get rid of the 'rendered' boolean then. Unfortunately, no. But fortunately, we have the IteratorTool. :) http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/generic/IteratorTool.html Best regards, --

JSP code runs in velocity templates?

2005-03-23 Thread Robert Koberg
Hi, I am (velocity newbie) running velocity (latest from last weeks cvs) in resin 2.1.16. First, let me say I love velocity and wish I would have come here sooner! I am converting some JSP to velocity and noticed that JSP code will run in my *.vm pages. Is this to be expected? I could not find

Re: JSP code runs in velocity templates?

2005-03-23 Thread Will Glass-Husain
Not typically. Though I guess it all depends on what servlet you are using. Not with standard configurations of any of the Velocity servlet (e.g. the VelocityViewServlet). Very strange. WILL - Original Message - From: Robert Koberg [EMAIL PROTECTED] To:

Re: JSP code runs in velocity templates?

2005-03-23 Thread Robert Koberg
ufff... nevermind... I have XSL transforming to velocity pages and forgot that I was generating velocity code along side an uncleaned up source XML. Sorry for the bother, -Rob Robert Koberg wrote: Hi, I am (velocity newbie) running velocity (latest from last weeks cvs) in resin 2.1.16. First,