Hi all, i am developing a project in struts.I have created a form that accepts date from user.I want a default value in date field i.e todays date.I am using Create Date:<html:text property="createdate"> </html:text> now when i am using "value" attribute in the above tag, then it is giving error.So tell me which attribute in the above tag should be used which will replace value attribute used in <input> tag.I want default value in create date tag as system date
What error did you get? It might be that you cannot have both a value and an ending tag. I did not see any mention in the document that I looked at but I would not be surprised if it uses the body of the tag as the value. Rather than set a default value in the JSP, I would rather set a default value in the form. In your example, if you set a default value for the createdate property then that will be shown with the page is displayed.
I don't think setting the value attribute should produce an error.But, if you do want to initialize form fields, you could always do it in the Action class by setting the Actionform property for which you want to show the default. On other hand, you would have to use scriptlets if you do it from the JSP.