File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Client validation and tiles (nested tags) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Client validation and tiles (nested tags)" Watch "Client validation and tiles (nested tags)" New topic

Client validation and tiles (nested tags)

Henrik Lund

Joined: Nov 28, 2003
Posts: 9

I would like to know if anyone knows how to use Javascript validation
in combination with tiles in a easy and maintainable way. Now my solution
looks like this:
- template.jsp (HTML template containing some <tiles:get name='tile-name'/>
- tiles-defs.xml (<tiles-definitions> for all my possible layouts)

In order to use client-side validation with Javascript, I include the Struts
html:javascript tag in my template.jsp file. This tag needs to know the name
of the form to validate (formName) and since this name differs (from page to page),
I must pass it in to template.jsp in some way. The only way to do it is to nest
two tags, like:
<html:javascript formName="<tiles:getAsString name='validateform'/>"/>

But this doesn't work.

The attribute 'validateform' is defined in tiles-defs.xml and prints out just fine
if only <tiles:getAsString name='validateform'/> is used.

Why cannot I nest two tags like above? How can I solve the problem?

Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Try this:

[ May 24, 2004: Message edited by: Lasse Koskela ]

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Henrik Lund

Joined: Nov 28, 2003
Posts: 9
Thanks. Your solution worked out nicely.

I agree. Here's the link:
subject: Client validation and tiles (nested tags)