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

[struts2] rendering textfielderror

 
khekhone yvan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi people
i don't know how change the color and position of textfield error message on my jsp . i use strut2.
on my actioncode, i use the methode validate


and on my jsp page :


the errorfield message display is automatic so cannot manage the position and the rendering on error message.in this case the error message is on the field and i want the message on the right field and the color red.

the second question i use the tag <s:fielderror fieldName="password"></s:fielderror> but the interline(the space between two ligne) how i can do to change that.

i m sorry my english is weak.can you help me.


any people can help me please to know how to
 
khekhone yvan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you dont understand something about my problem .ask me and i can to explain again .
 
pooja par
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't exactly understand what you want.
The below code would display all the field error messages of the jsp in red color above the form

In your jsp

You need to change the cssErrorStyle
cssErrorStyle is the attribute where you can define you own style and this will override cssErrorClass.

 
khekhone yvan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi pooja thank to answer me
i try your code its ok

but i use also


on my action

when you dont fill the field an error message display on the field.

the application manages itself the localisation and the color message without tag.

but i want change color and localisation message see the picture.

red color to my message instead black color.

the error message is on the field and i want on the right field.
Filename: Sans titre.bmp
Description:
File size: 221 Kbytes
[Download Sans titre.bmp] Download Attachment
 
pooja par
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked you to add ---cssErrorStyle="color:red;"--- as well in your JSP


did you add that.. and is still not working.
If that doesn't work add below code in your css


this link may help you
http://www.roseindia.net/struts/struts2/struts-2-example.shtml
 
khekhone yvan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks pooja
yeah it's working now i put on my css file.
but now how to put on the right to the field.
 
pooja par
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have any idea how to do that.. sorry
 
khekhone yvan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no problem
thanks you are very kind to asnwer me and find my problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic