Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

struts - jsp used to set property attribute in <html:errors/> tag

Thread view: 
jb - 21 Jun 2006 21:32 GMT
I was wondering if anyone has seen something like this before.

It could be a struts issue with jsp....  maybe the property attribute
in the <html:errors /> tag doesn't work with dynamically generated
text?

----------------------------------

I'm trying to print out a message that's saved in an ActionErrors
object.

It DOES work if I hard code it like this.

         <html:errors property="partCost0" />

         (it prints out       "Part cost must be a number" which is
just fine    )

and it does NOT work if I use this method.

         <html:errors property="partCost<%= row%>" />

         ( it just has a blank space    )

I've done a System.out.println on the value  partCost<%= row%> with the
code

         <%System.out.println("    partCost"+ row ); %>

and it does print out

         partCost0, partCost1, etc, for each row, so that's not a
problem.

NOTE - row is an int.

Does anyone know why the dynamically generated text won't work when the
hardcoded value will, even though the dynamic value is correct?
jb - 22 Jun 2006 08:37 GMT
Hello everyone,

I found the answer to this.  In case anyone else needs this, here it
is.

the html errors tag can't parse a property attribute (and maybe other
tags have this issue too) with both a literal and a dynamic element.

It DOES work if you do it this way

<% String partCostString = "partCost"+row;%>

<html:errors property = " partCostString "/>

Have fun.

jb

> I was wondering if anyone has seen something like this before.
>
[quoted text clipped - 34 lines]
> Does anyone know why the dynamically generated text won't work when the
> hardcoded value will, even though the dynamic value is correct?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.