File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes html tag label equivalent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html tag label equivalent?" Watch "html tag label equivalent?" New topic

html tag label equivalent?

Lars Filbert

Joined: Aug 26, 2004
Posts: 9

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

Joined: May 26, 2003
Posts: 33117

You could use bean:write. For example, <bean:write name="form" property="name" />

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Lars Filbert

Joined: Aug 26, 2004
Posts: 9
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

Joined: May 28, 2004
Posts: 333
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.
I agree. Here's the link:
subject: html tag label equivalent?
It's not a secret anymore!