aspose file tools*
The moose likes Struts and the fly likes format in a text field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "format in a text field" Watch "format in a text field" New topic
Author

format in a text field

Mathur Neni
Ranch Hand

Joined: May 10, 2004
Posts: 33
I have gone through the message and replies regarding - "How to Use bean:write inside html:text". But I couldn't trace out the solution to my problem from that.
I got a field (and defined the property in DynaValidatorForm) which is of type java.util.Date and this is being populated in the action class. I want to store this in a text field.
I think the following is not possible.
<html:text property="mydt"
value="
<bean:write name="form" property="mydt" format="mm/yyyy" />
" />
If I am trying this, it displays fine with the format
<bean:write name="form" property="mydt" format="mm/yyyy" />
But how to format the date in a text box??
Is it possible to access a dynavalidatorform property in jsp Scriplets?
Nimchi Yung
Ranch Hand

Joined: Jan 27, 2004
Posts: 71
The problem is that you cannot have a start a new tag
as an attribute of another tag.
There are a few solutions to that.
1) Use scriptlet
2) Use struts-el tag
3) Or

--Nimchi
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
My Struts,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Mathur Neni
Ranch Hand

Joined: May 10, 2004
Posts: 33
Hi Nimchi,
Is it possible to access a dynavalidatorform property in jsp Scriplets?
Thanks in advance.
Mathur
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

First you get a reference to a form. You can do something like this in a scriptlet:
myForm = request.getAttribute("formNameFromStrutsConfig")
(Change request to session if it is in session scope.)
And then you can call the methods on the form reference from your jsp scriptlets.


A good workman is known by his tools.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: format in a text field