• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing the value of bean:write tag as a prameter. Is it possible?

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

I just wanted to find out, if the following code is valid..

html:link action="/set.do?NAME=<bean:write name='groupdisplay' property='name'/>" >

set is the action class which would be called when the link is clicked and the parameter NAME should get the value of the <bean:write> tag..is it possible?.If not is there any way out???

Please Reply Fast!!!

Thanks in advance

Bhuvana
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can right

<a href="set.do?NAME=<bean:write name='groupdisplay' property='name'/>">Set</a> This works for me.

Thank you
 
bhuvan sundar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

The value of the bean is not passed to the parameter NAME, when i say getParameter in my action class....it is returning me the tag as such...as...<bean:write...> .So is there anyway to pass the value of the <bean:write> tag to the parameter NAME?

Thanks for your reply.Do reply Fast!!!

Thanks in advance
 
Vikas
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
convert your single quotes to the double quotes(") Hope this helps!!
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i think we can't get the <bean:write> property. you set the value as hidden variable , then you can get the value.

Thanks
 
Vikas
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try <a href="set.do?NAME=<bean:write name="groupdisplay"
property="name"/>">Set</a> all double quotes ("") it works for me
 
bhuvan sundar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

First I would like to thank you all for your response. Thanks a Lot.

But Still I have that issue.If I change to double quotes, it is not working, since Iam Using <html:link>.

So I think I have to Pass it as a Hidden variable.As Iam new to struts, Can Anyone Tell Me in Detail , how to use Hidden variables.

Please Reply Fast!!!
Thank you in Advance!

Bhuvana
 
Vikas
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How will you send it as a hidden field when it's an anchor tag not a FORM??
 
Vikas
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try <html:link page="/set.do" paramName="groupdisplay" paramProperty="name" paramId="NAME"/>

or

<html:link page="/set.do" name="groupdisplay" property="NAME"><bean:write name="groupdisplay" property="name" /></html:link>


I don't know if it works for you as I haven't tried it yet please let me know.
[ March 29, 2005: Message edited by: Vikas Sharda ]
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What Vikas Sharda suggested will work:


I use it in a couple of my JSP(s).

The paramName and paramProperty references your javabean. The paramId name/value pair is what will be attached to the url.

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I am stuck with the same problem but how to give with form elements like

<html:text> and <html:select>

Thanks in advance..
Srilakshmi
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
using nested struts tags won't work. i.e. <bean:write> won't work if it's nested inside another struts tag like <html:link>. Instead you need to use the way Sharda suggested.

Seshu
reply
    Bookmark Topic Watch Topic
  • New Topic