Re: html:errors question

2006-02-24 Thread Niall Pemberton
Have you checked the docs?

http://struts.apache.org/struts-taglib/tagreference-struts-html.html#html:errors

Niall

- Original Message - 
From: red phoenix [EMAIL PROTECTED]
Sent: Friday, February 24, 2006 3:47 AM


application.properties file:

errors.footer=
errors.header=
errors.abc.required=This is a test

when I use html:errors property=abc header=errors.footer footer=
errors.header /,I get following error:
org.apache.jasper.JasperException: /index.jsp(10,20) Attribute header
invalid for tag errors according to TLD
org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


On 2/24/06, Niall Pemberton [EMAIL PROTECTED] wrote:

 Try having the following in your message resources:

 errors.footer=
 errors.header=

 ... or rather than using the default, you could specify empty
 header/footer
 labels. In your application resources:

 empty.footer=
 empty.header=

 ... then on the errors tag:

 html:errors property=abc header=empty.footer footer=empty.header /

 ...or you could use the messages tag instead:

 html:messages property=abc id=msgbean:write
 name=msg//html:messages

 See:
 http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html

 Niall

 - Original Message -
 From: red phoenix [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Friday, February 24, 2006 2:30 AM
 Subject: Re: html:errors question


 Thanks Niall,html:errors property=logstime/ works well. But I find
 another question,first look at my application.properties file:
 errors.footer=nbsp;
 errors.header=nbsp;
 errors.abc.required=This is a test

 In my jsp,use follows statement
 html:text property=abc /html:errors name=abc/

 If errors is not empty,it will should the error message This is a test
 My question is when I run it,it can show the error message This is a
 test,but the message is not showing in the line with the same line of
 html:text
 property=abc /,I guess the reason is html:errors name=abc/ shows
 not
 only errors.abc,but shows errors.header and errors.footer,so the
 html:text
 property=abc / and html:errors name=abc/ will not show in the same
 line,if I delete errors.footer and errors.header from
 application.properties,
 application.properties only contain a single line,like follows
 errors.abc.required=This is a test

 When I run html:text property=abc /html:errors name=abc/,it will
 show:

 the content of html:text property=abc
 null
 This is a test
 null

 How to make the show of html:errors name=abc/ is in the same line of
 the
 show of html:text property=abc / and only show html:errors
 name=abc/
 without errors.header and errors.footer?

 Thanks in advance



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: html:errors question

2006-02-23 Thread Chandra.Ravinithala
Which version of Struts are you using?

From Struts 1.0:
DEPRECATIONS - The entire custom tag library that is documented in
struts-form.tld has been deprecated because this library has been
renamed struts-html.tld instead; for ref:
http://struts.apache.org/struts-action/userGuide/release-notes-1.0-b3.ht
ml

 If you still want to use struts-form.tld then there is no property
attribute as far as I remember; It should be name instead property

Hope this will help

Chandra

-Original Message-
From: red phoenix [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 23, 2006 12:48 PM
To: Struts Users Mailing List
Subject: html:errors question

I have a JSP file,and I use html:errors in this page,but it raise
error,my code is follows:

%@ taglib uri=/WEB-INF/struts-form.tld prefix=html % html head
link rel=stylesheet href=style.css type=text/css /head
html:errors/ html:form method=post action=log.do html:text
property=abc /html:errors property=abc/ /html:form

and my Form is follows:
..
public ActionErrors validate(ActionMapping mapping,HttpServletRequest
request) {
ActionErrors errors = new ActionErrors(); if(abc!=null 
abc.length()0){
   errors.add(abc,new ActionError(error.abc.required));
 }
 return errors;
}

When I run it,it raise following error:
org.apache.jasper.JasperException: /index.jsp(8,15) Attribute property
invalid for tag errors according to TLD
org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va
:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.ActionServlet.processValidate(ActionServlet.jav
a
:2149)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1565)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

I have looked up html:errors API,I find it have property attribute:
  property Name of the property for which error messages should be
displayed. If not specified, all error messages (regardless of property)
are displayed. (RT EXPR)

Why raise above error? How to do with it?

Thanks in advance!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:errors question

2006-02-23 Thread red phoenix
I modify my code,like follows,this time it don't show any error,but when the
content of text abc is '123',it's length isn't equals 10,so it should raise
error,but it don't show any error! Why?

%@ taglib uri=/WEB-INF/struts-form.tld prefix=html %
html
head
link rel=stylesheet href=style.css type=text/css
/head
html:errors/
html:form method=post action=log.do
html:text property=abc /html:errors name=abc/
/html:form


On 2/23/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Which version of Struts are you using?

 From Struts 1.0:
 DEPRECATIONS - The entire custom tag library that is documented in
 struts-form.tld has been deprecated because this library has been
 renamed struts-html.tld instead; for ref:
 http://struts.apache.org/struts-action/userGuide/release-notes-1.0-b3.ht
 ml

 If you still want to use struts-form.tld then there is no property
 attribute as far as I remember; It should be name instead property

 Hope this will help

 Chandra

 -Original Message-
 From: red phoenix [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 23, 2006 12:48 PM
 To: Struts Users Mailing List
 Subject: html:errors question

 I have a JSP file,and I use html:errors in this page,but it raise
 error,my code is follows:

 %@ taglib uri=/WEB-INF/struts-form.tld prefix=html % html head
 link rel=stylesheet href=style.css type=text/css /head
 html:errors/ html:form method=post action=log.do html:text
 property=abc /html:errors property=abc/ /html:form

 and my Form is follows:
 ..
 public ActionErrors validate(ActionMapping mapping,HttpServletRequest
 request) {
 ActionErrors errors = new ActionErrors(); if(abc!=null 
 abc.length()0){
   errors.add(abc,new ActionError(error.abc.required));
 }
 return errors;
 }

 When I run it,it raise following error:
 org.apache.jasper.JasperException: /index.jsp(8,15) Attribute property
 invalid for tag errors according to TLD
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(
 JspServletWrapper.java:510)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
 va
 :375)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 org.apache.struts.action.ActionServlet.processValidate(ActionServlet.jav
 a
 :2149)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1565)
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

 I have looked up html:errors API,I find it have property attribute:
 property Name of the property for which error messages should be
 displayed. If not specified, all error messages (regardless of property)
 are displayed. (RT EXPR)

 Why raise above error? How to do with it?

 Thanks in advance!

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: html:errors question

2006-02-23 Thread Dave Newton
red phoenix wrote:
 I modify my code,like follows,this time it don't show any error,but when the
 content of text abc is '123',it's length isn't equals 10,so it should raise
 error,but it don't show any error! Why?
   
Most likely because in your code you check to see if its length is
greater than 10.
 if ((abc != null)  (abc.length()  0)) {
 
I could be wrong.

Dave



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:errors question

2006-02-23 Thread red phoenix
 I changed following code
if ((abc != null)  (abc.length()  10))


but when the  content of text abc is '123',it's length isn't equals 10,so it
should raise error,but it don't show any error!
If I use html:errors/ instead of html:errors name=abc/,I can get right
value. Why html:errors works well,and html:errors name=abc/ don't
work. I am puzzled with it.


On 2/23/06, Dave Newton [EMAIL PROTECTED] wrote:

 red phoenix wrote:
  I modify my code,like follows,this time it don't show any error,but when
 the
  content of text abc is '123',it's length isn't equals 10,so it should
 raise
  error,but it don't show any error! Why?
 
 Most likely because in your code you check to see if its length is
 greater than 10.
  if ((abc != null)  (abc.length()  0)) {
 
 I could be wrong.

 Dave



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: html:errors question

2006-02-23 Thread Niall Pemberton
You should be using the property attribute (as you had in your first post)
to do what you want...

http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section5

...not the name attribute - that does a different job...

http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section4

In your first post you indicated that you were using the old (pre 1.0)
struts-form.tld.

   %@ taglib uri=/WEB-INF/struts-form.tld prefix=html %

... change that to use the html taglib tld:

   %@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

then there shouldn't be any problem with the property attribute. If you're
using a pre 1.0 version of struts I highly recommend you upgrade.

Niall

- Original Message - 
From: red phoenix [EMAIL PROTECTED]
Sent: Friday, February 24, 2006 12:46 AM


I changed following code
if ((abc != null)  (abc.length()  10))


but when the  content of text abc is '123',it's length isn't equals 10,so it
should raise error,but it don't show any error!
If I use html:errors/ instead of html:errors name=abc/,I can get right
value. Why html:errors works well,and html:errors name=abc/ don't
work. I am puzzled with it.


On 2/23/06, Dave Newton [EMAIL PROTECTED] wrote:

 red phoenix wrote:
  I modify my code,like follows,this time it don't show any error,but when
 the
  content of text abc is '123',it's length isn't equals 10,so it should
 raise
  error,but it don't show any error! Why?
 
 Most likely because in your code you check to see if its length is
 greater than 10.
  if ((abc != null)  (abc.length()  0)) {
 
 I could be wrong.

 Dave



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:errors question

2006-02-23 Thread red phoenix
Thanks Niall,html:errors property=logstime/ works well. But I find
another question,first look at my application.properties file:
errors.footer=nbsp;
errors.header=nbsp;
errors.abc.required=This is a test

In my jsp,use follows statement
html:text property=abc /html:errors name=abc/

If errors is not empty,it will should the error message This is a test
My question is when I run it,it can show the error message This is a
test,but the message is not showing in the line with the same line of
html:text
property=abc /,I guess the reason is html:errors name=abc/ shows not
only errors.abc,but shows errors.header and errors.footer,so the html:text
property=abc / and html:errors name=abc/ will not show in the same
line,if I delete errors.footer and errors.header from application.properties,
application.properties only contain a single line,like follows
 errors.abc.required=This is a test

When I run html:text property=abc /html:errors name=abc/,it will
show:

the content of html:text property=abc
null
This is a test
null

How to make the show of html:errors name=abc/ is in the same line of the
show of html:text property=abc / and only show html:errors name=abc/
without errors.header and errors.footer?

Thanks in advance




On 2/24/06, Niall Pemberton [EMAIL PROTECTED] wrote:

 You should be using the property attribute (as you had in your first
 post)
 to do what you want...


 http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section5

 ...not the name attribute - that does a different job...


 http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section4

 In your first post you indicated that you were using the old (pre 1.0)
 struts-form.tld.

   %@ taglib uri=/WEB-INF/struts-form.tld prefix=html %

 ... change that to use the html taglib tld:

   %@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

 then there shouldn't be any problem with the property attribute. If
 you're
 using a pre 1.0 version of struts I highly recommend you upgrade.

 Niall

 - Original Message -
 From: red phoenix [EMAIL PROTECTED]
 Sent: Friday, February 24, 2006 12:46 AM


 I changed following code
 if ((abc != null)  (abc.length()  10))


 but when the  content of text abc is '123',it's length isn't equals 10,so
 it
 should raise error,but it don't show any error!
 If I use html:errors/ instead of html:errors name=abc/,I can get
 right
 value. Why html:errors works well,and html:errors name=abc/ don't
 work. I am puzzled with it.


 On 2/23/06, Dave Newton [EMAIL PROTECTED] wrote:
 
  red phoenix wrote:
   I modify my code,like follows,this time it don't show any error,but
 when
  the
   content of text abc is '123',it's length isn't equals 10,so it should
  raise
   error,but it don't show any error! Why?
  
  Most likely because in your code you check to see if its length is
  greater than 10.
   if ((abc != null)  (abc.length()  0)) {
  
  I could be wrong.
 
  Dave



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: html:errors question

2006-02-23 Thread Niall Pemberton
Try having the following in your message resources:

errors.footer=
errors.header=

... or rather than using the default, you could specify empty header/footer
labels. In your application resources:

empty.footer=
empty.header=

... then on the errors tag:

  html:errors property=abc header=empty.footer footer=empty.header /

...or you could use the messages tag instead:

 html:messages property=abc id=msgbean:write
name=msg//html:messages

See:
http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html

Niall

- Original Message - 
From: red phoenix [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Friday, February 24, 2006 2:30 AM
Subject: Re: html:errors question


Thanks Niall,html:errors property=logstime/ works well. But I find
another question,first look at my application.properties file:
errors.footer=nbsp;
errors.header=nbsp;
errors.abc.required=This is a test

In my jsp,use follows statement
html:text property=abc /html:errors name=abc/

If errors is not empty,it will should the error message This is a test
My question is when I run it,it can show the error message This is a
test,but the message is not showing in the line with the same line of
html:text
property=abc /,I guess the reason is html:errors name=abc/ shows not
only errors.abc,but shows errors.header and errors.footer,so the html:text
property=abc / and html:errors name=abc/ will not show in the same
line,if I delete errors.footer and errors.header from
application.properties,
application.properties only contain a single line,like follows
 errors.abc.required=This is a test

When I run html:text property=abc /html:errors name=abc/,it will
show:

the content of html:text property=abc
null
This is a test
null

How to make the show of html:errors name=abc/ is in the same line of the
show of html:text property=abc / and only show html:errors name=abc/
without errors.header and errors.footer?

Thanks in advance



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:errors question

2006-02-23 Thread red phoenix
 application.properties file:

errors.footer=
errors.header=
errors.abc.required=This is a test

when I use html:errors property=abc header=errors.footer footer=
errors.header /,I get following error:
org.apache.jasper.JasperException: /index.jsp(10,20) Attribute header
invalid for tag errors according to TLD
org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)





On 2/24/06, Niall Pemberton [EMAIL PROTECTED] wrote:

 Try having the following in your message resources:

 errors.footer=
 errors.header=

 ... or rather than using the default, you could specify empty
 header/footer
 labels. In your application resources:

 empty.footer=
 empty.header=

 ... then on the errors tag:

 html:errors property=abc header=empty.footer footer=empty.header /

 ...or you could use the messages tag instead:

 html:messages property=abc id=msgbean:write
 name=msg//html:messages

 See:
 http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html

 Niall

 - Original Message -
 From: red phoenix [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Friday, February 24, 2006 2:30 AM
 Subject: Re: html:errors question


 Thanks Niall,html:errors property=logstime/ works well. But I find
 another question,first look at my application.properties file:
 errors.footer=nbsp;
 errors.header=nbsp;
 errors.abc.required=This is a test

 In my jsp,use follows statement
 html:text property=abc /html:errors name=abc/

 If errors is not empty,it will should the error message This is a test
 My question is when I run it,it can show the error message This is a
 test,but the message is not showing in the line with the same line of
 html:text
 property=abc /,I guess the reason is html:errors name=abc/ shows
 not
 only errors.abc,but shows errors.header and errors.footer,so the
 html:text
 property=abc / and html:errors name=abc/ will not show in the same
 line,if I delete errors.footer and errors.header from
 application.properties,
 application.properties only contain a single line,like follows
 errors.abc.required=This is a test

 When I run html:text property=abc /html:errors name=abc/,it will
 show:

 the content of html:text property=abc
 null
 This is a test
 null

 How to make the show of html:errors name=abc/ is in the same line of
 the
 show of html:text property=abc / and only show html:errors
 name=abc/
 without errors.header and errors.footer?

 Thanks in advance



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]