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

struts beginner. Pls answer this.

Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
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.

a.edward durai

Thank You<br />Edward
Amit Ghai
Ranch Hand

Joined: Mar 24, 2004
Posts: 35
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..

Reasonable people adapt themselves to the world. Unreasonable people attempt to adapt the world to themselves. All progress, therefore, depends on unreasonable people.
Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
Excuse me, Thanks for your reply,

Ok. pls answer other questions
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: struts beginner. Pls answer this.
It's not a secret anymore!