File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problems with displaytags and validations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problems with displaytags and validations" Watch "Problems with displaytags and validations" New topic

Problems with displaytags and validations

Henrik Samuelsson

Joined: Jun 10, 2008
Posts: 6

I looked through the topics about displaytags on this forum and on other forums but still havent found the answer to my problem. Of course I tried to solve it myself.

I use displaytags in an application and it works as it should with one mayor issue, the export to excel and pdf dont work. Displaytags doesnt work with my regex validations. I want the swedish letter �, � and � to be allowed. But when I put the displaytag filter first in web.xml the validation dont accept �,� and �, but otherwise it runs as wanted.

And if I put the displaytag after the action2-cleanup filter most of the exports dont work, but the reg ex work so I can write �, � and �.

The validations is the opensymphony validations. Here is a sample of the actionclass code and some jsp.

Action class:

@Validations(regexFields = {@RegexFieldValidator(fieldName = "firstname", message = "Ogiltigt tecken")},


<display:table name="students" id="studentrow" class="dataTable" cellspacing="0" export="true" requestURI="" defaultsort="1">
<s:set name="myrow" value="#attr.studentrow"/>
<display:column property="id" title="Id" sortable="true"/>
<display:column property="firstname" title="F�rnamn" sortable="true" />
<display:column property="lastname" title="Efternamn" sortable="true" />
<display:column property="streetaddress" title="Gatuadress" sortable="true"/>
<display:column property="zipcode.zipcode" title="Postnr" sortable="true"/>
<display:column property="" title="Postort" sortable="true"/>
<s:if test="displayInactive">
<display:column property="activestate" title="Status" sortable="true"/>

Hope you understand what I mean and that someone has an idea how to solve it.

Thanks in advance!
Nyanas Kandhan
Ranch Hand

Joined: Jan 27, 2009
Posts: 35
To Export the data grid to Excel and Pdf you can use display tag. You can download a sample example here. Export To Excel And PDF Using Display Tag

subject: Problems with displaytags and validations
It's not a secret anymore!