• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html tag label equivalent?

 
Lars Filbert
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What I want to do is very simple, but I can't figure out the slick way to do it in Struts. I just want to show like a "name" value on my web page. The name variable is in my actionForm ( i.e. getName() setName()). I know how to do this if I would want the name to be diplayed in a text field i.e.:

<html:text property="name"/>

but I don't want it in a textfield - I just want it to be like a "label" in Swing land - or rather just regular text.

I would rather not do a useBean - or have to explicitly put my form into the session - I think there must be some slick struts way to do this - like the slick way to display the name in the textfield.

Many Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34669
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lars,
You could use bean:write. For example, <bean:write name="form" property="name" />
 
Lars Filbert
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for the response but when I tried this, I got the error:

Cannot find bean form in any scope

I don't think I want to explicity put a useBean at the top with form as the name - right? - because I have tried that type of approach - but that seems to be a different instance or something and I can't get the values like I can with say with using the Struts html tags.

I am using Weblogic but I wouldn't think that makes any difference here.

Any other ideas?

Many Thanks Again!
 
Kedar Dravid
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its more like <bean:write name="single object in collection of objects" property="whatever"/>.
For example, if u r passing an ArrayList, then the value of the name attribute would be a single bean object in the ArrayList.
Of course, the bean:write in this case would be inside a <logic:iterate> tag. But then, u may/may not use logic:iterate, depending on ur preferences.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic