Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Client validation and tiles (nested tags)

 
Henrik Lund
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

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?


Regards
Henrik
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

[ May 24, 2004: Message edited by: Lasse Koskela ]
 
Henrik Lund
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Your solution worked out nicely.

Regards
Henrik
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic