• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

struts beginner. Pls answer this.

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have jsp page. it contains two fields

<html:text property="username" />
<html:text property="password">

1. if i use two fields username, and password, Is getter and setter methods are necessary?

2. i have one page contains field name, datatype, length. i want to add both database column and generate getter and setter methods and display in the jsp.

Is it possible? if possible tell me. Actually it is a our own custom field display.

3. If it is not possible, kindly tell me your own suggestions.
Thanks

a.edward durai
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The associated ActionForm should have getter and setter for the username and password field. Hope you wanted to know this. Your question is not very clear..
 
Edward Durai
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excuse me, Thanks for your reply,

Ok. pls answer other questions
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your questions are not very clear, but if I understand you correctly, you are trying to generate fields dynamically, meaning that you don't know the name, type or length of the field until run-time.

One way to do this would be to define your ActionForm as type org.apache.struts.validator.LazyValidatorForm. This is a form bean provided by Struts that does not require you to define getters or setters for properties or to define them ahead of time in the struts-config.xml file. If you use this class as the ActionForm, any <html:text> fields that you define with any property name will be populated into the ActionForm bean when the form is submitted. All of the properties will be of type String, but if you have another field telling you what the correct type is, you can then convert to the correct type.

Here is the link to the javadoc for this class.
 
reply
    Bookmark Topic Watch Topic
  • New Topic