GeeCON Prague 2014*
The moose likes Struts and the fly likes Problem in html:text  /html:text input tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in html:text  /html:text input tag" Watch "Problem in html:text  /html:text input tag" New topic

Problem in html:text /html:text input tag

mohsin sheikh

Joined: Mar 28, 2007
Posts: 22
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
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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.

- Brent
Maya Thomas

Joined: Mar 10, 2008
Posts: 3
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.

GeeCON Prague 2014
subject: Problem in html:text /html:text input tag