jQuery in Action, 2nd edition*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html tag label equivalent?" Watch "html tag label equivalent?" New topic
Author

html tag label equivalent?

Lars Filbert
Greenhorn

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

Joined: May 26, 2003
Posts: 30136
    
150

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


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Lars Filbert
Greenhorn

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: html tag label equivalent?
 
Similar Threads
Can I set the cursor in a particular JTextField?
Best Layout for Simple Forms?
How do you label a TextField
How do you label a TextField
mutiple record validate