Bharat Makwana

Ranch Hand
+ Follow
since May 21, 2007
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 Bharat Makwana

Hi All,

please suggest me some good books on hibernate, spring, UML and algorithms.
Hi Prashanth try this

prepare you template say userTemplate.vm


you have to put userList object in velocity context. for this do the following




Hi All,

I tried to used velocity tags instead of using plain html tags. I copied velocity tags from following url
http://struts.apache.org/2.0.14/docs/velocity-tags.html

and tried to access .vm file, but it throws following exception, strange thing is that it throws exception when i use #sform tag, if i just use #stextfield and #ssubmit, it does not throw any exception both text field and submit button are appearing properly.

can someone help me with this exception please ?


Velocity version : 1.6
Velcocity tool : 1.4





11 years ago
Thanks for the replies guys ! But can anybody tell me how should I handle such requirement ?

I am thinking of appending all the key value [comma separated] to a hidden field and same for the value field is this good approach ?

Thanks
Bharat
11 years ago
Hi there,

my code dynamically add two input fields for key and value which I want to retrieve at server side in a servlet code.[in following code I have shown two only ]


Can anyone tell me how should I retrieve these key and value at server side please?

If I use request.getParameterValues("key") [assume first key has value 'Name' and second has 'Surname'], at server side I recieve String array, is it guaranteed that they will be in order i.e array[0] = Name and array[1] = Surname ?

Thanks
Bharat


11 years ago
Hi Tom,

Thank you very much for your time and reply, problem solved. There was a silly mistake in my previous code.
updated code for getData() method would be


Thanks again,
Bharat
11 years ago
Hi All,

I am facing some problem with my servlet code, I am trying to display the image returned by 3rd party server in the browser.
But it gives me error : The image “http://localhost:8080/velocity/googlechart/” cannot be displayed, because it contains errors.

code is as follows, can someone tell me what I'm doing wrong here ?

in the code,

String urlStr = "http://chart.apis.google.com/chart?cht=lc&chs=300x250&chxt=x%2Cy&chxs=$&chxl=0%3A|1%20amn|2%20am|3%20am|4%20am|5%20am&chdlp=bv&chco=ff7f00%2C339999%2Ccc9966&chxr=1%2C59%2C1170&chd=t:40,20,50,20,100|75,74,66,30,10";

is the .png image url.



Thanks,
Bharat
11 years ago
Finally

$velocityCount is the answer.

Thanks verybody.
~Bharat
Hi there,

one can use struts2.x's tag libraries in jsp using <taglib>, how to use these tag libraries in .vm(velocity template) file ?

anyone ?

Thanks,
Bharat
11 years ago
I am using velocity-1.6.1.jar,velocity-tools-*-1.4.jar.
velocity.properties is

resource.loader = file
file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path = D:/eclipse/workspace/manager/WebContent/vm
file.resource.loader.cache = true
file.resource.loader.modificationCheckInterval = 2

Thanks,
Bharat
yes Ulf, I tried $foreach.count then it produces
$foreach.count . Not
$foreach.count . my
$foreach.count . fault

saw some stringe behavior when I use $!{foreach.count} output is

. Not
. my
. fault


~Bharat
Hi All,

I am trying to iterate through a string array, also want to print the iteration number,

output should be,
1. Not
2. my
3. fault

but when it produces,
${foreach.count} . Not
${foreach.count} . my
${foreach.count} . fault

Anyone can tell what's going wrong here ? on server console I get
INFO: Velocity [debug] Null reference [template '/Test.vm', line 3, column 13] : $foreach.count cannot be resolved.

Thanks
Bharat
Hi All,

I am doing some basic tutorials in velocity, i am familiar with jsp, my question is do I always have to put java class (may be bean) object in context to use it in .vm file ?
or there is other way like the one in jsp we can create bean object using <useBean> ?

Thank you.
Bharat
Hi there,

I am using org.w3c.dom.Dom parser to parser my XML document.
one Node in that xml is

I am using following code to get url node value




and I am putting that value in one hashtable, but getNodeValue() method only returns http://server-img.ppapi.com/transcode?refresh=true from url node, it's not returning location=http://ad.pp.com/adserver/image%3fpath%3db0a18ef22074416d9f2c01d73cf9adc4.jpg&qpub=0&dfmt=jpg after '&', it should return full value like
http://server-img.ppapi.com/transcode?refresh=true&location=http://ad.pp.com/adserver/image%3fpath%3db0a18ef22074416d9f2c01d73cf9adc4.jpg&qpub=0&dfmt=jpg

Any help is highly appreciated !

Thanks,
Bharat