• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

html tag label equivalent?

 
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!
 
author & internet detective
Posts: 40198
816
Eclipse IDE VI Editor Java
  • 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!
 
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.
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic