Re: html:errors/ blank page on invalid form

2005-05-26 Thread Gurumoorthy
hello
html:form action=/SubmitLogonForm.do is wrong
html:form action=/SubmitLogonForm

Regards
Guru

- Original Message -
From: Nikola Milutinovic [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 26, 2005 6:04 AM
Subject: Re: html:errors/ blank page on invalid form


 Andy wrote:

 Hi All,
 
 I'm unable to output any errors using html:errors/ tag, in Tomcat
 5.5.7 I've tried numerous configurations and have now ran out of
patience.
 As I haven't been using Struts for more than three days I hope somebody
 more experienced can point help me out.
 
 When I select Submit, entering data into my form fields so the form is
 parsed as valid, the forward works correctly. When I leave the fields
 empty, so the form is parsed as invalid, I just get an empty page back -
 which must be generated by Struts as it doesn't match any HTML I have.
 
 

 Check out the logs, you could be running into an exception. Also, set
 buffer size of 20kb on all your pages, while you're testing. Empty
 output can also be caused by an exception in the page itself, and buffer
 being already sent.

 Here is what I have in various files -
 

---
-
 
 
 logon.jsp -
 
 %@ page contentType=text/html;charset=UTF-8 language=java %
 %@ taglib uri=/tags/struts-bean prefix=bean %
 %@ taglib uri=/tags/struts-html prefix=html %
 html
 head
 titlebean:message key=logon.title//title
 /head
 body
 html:errors/
 html:form action=/SubmitLogonForm.do
 table
 tr
 tdUsername/td
 tdhtml:text property=username//td
 /tr
 tr
 tdPassword/td
 tdhtml:text property=password//td
 /tr
 tr
 td
 html:submit/
 html:cancel/
 /td
 td/td
 /tr
 /table
 /html:form
 
 /body
 
 

 Looks fine, except for the buffer page directive.

 In LogonAction.java -
 
 
 public ActionForward execute(ActionMapping mapping, ActionForm form,
  HttpServletRequest request,
 HttpServletResponse response)
 throws Exception {
 
 if (isCancelled(request)) {
 log.debug(cancel pressed);
 return mapping.findForward(Constants.FAILURE);
 }
 
 

 Why would you consider Cancel a failure? Not that it will not work,
but...

 LogonForm logonForm = (LogonForm)form;
 log.debug(username +logonForm.getUsername());
 log.debug(password +logonForm.getPassword());
 
 return mapping.findForward(Constants.SUCCESS);
 }
 
 

 You're not checking the login, but that's fine for a test.

 In LogonForm.java (I have getters/setters for HTML fields, and a reset
 method,
 not shown) -
 
 public ActionErrors validate(ActionMapping actionMapping,
 HttpServletRequest httpServletRequest) {
 
 log.debug(validate);
 ActionErrors errors = new ActionErrors();
 
 if
 (FormUtils.isNullOrEmpty(httpServletRequest.getParameter(username))) {
 log.debug(logon.form.username.invalid);
 errors.add(ActionErrors.GLOBAL_MESSAGE,new
 ActionMessage(logon.form.username.invalid));
 }
 
 

 You don't need to use GLOBAL_MESSAGE, that is wrong, I think. And use
 errors, not messages. My validation would read:

 errors.add( username, new ActionError( logon.form.username.invalid));

 Nix.

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



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



RE: html:errors/ blank page on invalid form

2005-05-26 Thread Andy

Guru and Nikola,

Thanks for the suggestions, having looked at this again, I think this is a
Struts problem however, so I've posted to struts-users.

Thanks anyway,

Andy.

-Original Message-
From: Gurumoorthy [mailto:[EMAIL PROTECTED]
Sent: 26 May 2005 08:37
To: Tomcat Users List
Subject: Re: html:errors/ blank page on invalid form


hello
html:form action=/SubmitLogonForm.do is wrong
html:form action=/SubmitLogonForm

Regards
Guru

- Original Message -
From: Nikola Milutinovic [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 26, 2005 6:04 AM
Subject: Re: html:errors/ blank page on invalid form


 Andy wrote:

 Hi All,
 
 I'm unable to output any errors using html:errors/ tag, in Tomcat
 5.5.7 I've tried numerous configurations and have now ran out of
patience.
 As I haven't been using Struts for more than three days I hope somebody
 more experienced can point help me out.
 
 When I select Submit, entering data into my form fields so the form is
 parsed as valid, the forward works correctly. When I leave the fields
 empty, so the form is parsed as invalid, I just get an empty page back -
 which must be generated by Struts as it doesn't match any HTML I have.
 
 

 Check out the logs, you could be running into an exception. Also, set
 buffer size of 20kb on all your pages, while you're testing. Empty
 output can also be caused by an exception in the page itself, and buffer
 being already sent.

 Here is what I have in various files -
 

--
-
-
 
 
 logon.jsp -
 
 %@ page contentType=text/html;charset=UTF-8 language=java %
 %@ taglib uri=/tags/struts-bean prefix=bean %
 %@ taglib uri=/tags/struts-html prefix=html %
 html
 head
 titlebean:message key=logon.title//title
 /head
 body
 html:errors/
 html:form action=/SubmitLogonForm.do
 table
 tr
 tdUsername/td
 tdhtml:text property=username//td
 /tr
 tr
 tdPassword/td
 tdhtml:text property=password//td
 /tr
 tr
 td
 html:submit/
 html:cancel/
 /td
 td/td
 /tr
 /table
 /html:form
 
 /body
 
 

 Looks fine, except for the buffer page directive.

 In LogonAction.java -
 
 
 public ActionForward execute(ActionMapping mapping, ActionForm form,
  HttpServletRequest request,
 HttpServletResponse response)
 throws Exception {
 
 if (isCancelled(request)) {
 log.debug(cancel pressed);
 return mapping.findForward(Constants.FAILURE);
 }
 
 

 Why would you consider Cancel a failure? Not that it will not work,
but...

 LogonForm logonForm = (LogonForm)form;
 log.debug(username +logonForm.getUsername());
 log.debug(password +logonForm.getPassword());
 
 return mapping.findForward(Constants.SUCCESS);
 }
 
 

 You're not checking the login, but that's fine for a test.

 In LogonForm.java (I have getters/setters for HTML fields, and a reset
 method,
 not shown) -
 
 public ActionErrors validate(ActionMapping actionMapping,
 HttpServletRequest httpServletRequest) {
 
 log.debug(validate);
 ActionErrors errors = new ActionErrors();
 
 if
 (FormUtils.isNullOrEmpty(httpServletRequest.getParameter(username))) {
 log.debug(logon.form.username.invalid);
 errors.add(ActionErrors.GLOBAL_MESSAGE,new
 ActionMessage(logon.form.username.invalid));
 }
 
 

 You don't need to use GLOBAL_MESSAGE, that is wrong, I think. And use
 errors, not messages. My validation would read:

 errors.add( username, new ActionError( logon.form.username.invalid));

 Nix.

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



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





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



Re: html:errors/ blank page on invalid form

2005-05-26 Thread Gurumoorthy
Andy,
We had this issue before ... can you do email me the
struts-config.xml ?
i think the PATH in forward name is not correct
action 
forward name=SUCCCESS path=/index.jsp
forward name=FAIL path=/login.jsp
/action

- Original Message -
From: Andy [EMAIL PROTECTED]
To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, May 26, 2005 5:00 PM
Subject: RE: html:errors/ blank page on invalid form



 Guru and Nikola,

 Thanks for the suggestions, having looked at this again, I think this is a
 Struts problem however, so I've posted to struts-users.

 Thanks anyway,

 Andy.

 -Original Message-
 From: Gurumoorthy [mailto:[EMAIL PROTECTED]
 Sent: 26 May 2005 08:37
 To: Tomcat Users List
 Subject: Re: html:errors/ blank page on invalid form
 
 
 hello
 html:form action=/SubmitLogonForm.do is wrong
 html:form action=/SubmitLogonForm
 
 Regards
 Guru
 
 - Original Message -
 From: Nikola Milutinovic [EMAIL PROTECTED]
 To: Tomcat Users List tomcat-user@jakarta.apache.org
 Sent: Thursday, May 26, 2005 6:04 AM
 Subject: Re: html:errors/ blank page on invalid form
 
 
  Andy wrote:
 
  Hi All,
  
  I'm unable to output any errors using html:errors/ tag, in Tomcat
  5.5.7 I've tried numerous configurations and have now ran out of
 patience.
  As I haven't been using Struts for more than three days I hope
somebody
  more experienced can point help me out.
  
  When I select Submit, entering data into my form fields so the form is
  parsed as valid, the forward works correctly. When I leave the fields
  empty, so the form is parsed as invalid, I just get an empty page
back -
  which must be generated by Struts as it doesn't match any HTML I have.
  
  
 
  Check out the logs, you could be running into an exception. Also, set
  buffer size of 20kb on all your pages, while you're testing. Empty
  output can also be caused by an exception in the page itself, and
buffer
  being already sent.
 
  Here is what I have in various files -
  
 
 --
 -
 -
  
  
  logon.jsp -
  
  %@ page contentType=text/html;charset=UTF-8 language=java %
  %@ taglib uri=/tags/struts-bean prefix=bean %
  %@ taglib uri=/tags/struts-html prefix=html %
  html
  head
  titlebean:message key=logon.title//title
  /head
  body
  html:errors/
  html:form action=/SubmitLogonForm.do
  table
  tr
  tdUsername/td
  tdhtml:text property=username//td
  /tr
  tr
  tdPassword/td
  tdhtml:text property=password//td
  /tr
  tr
  td
  html:submit/
  html:cancel/
  /td
  td/td
  /tr
  /table
  /html:form
  
  /body
  
  
 
  Looks fine, except for the buffer page directive.
 
  In LogonAction.java -
  
  
  public ActionForward execute(ActionMapping mapping, ActionForm
form,
   HttpServletRequest request,
  HttpServletResponse response)
  throws Exception {
  
  if (isCancelled(request)) {
  log.debug(cancel pressed);
  return mapping.findForward(Constants.FAILURE);
  }
  
  
 
  Why would you consider Cancel a failure? Not that it will not work,
 but...
 
  LogonForm logonForm = (LogonForm)form;
  log.debug(username +logonForm.getUsername());
  log.debug(password +logonForm.getPassword());
  
  return mapping.findForward(Constants.SUCCESS);
  }
  
  
 
  You're not checking the login, but that's fine for a test.
 
  In LogonForm.java (I have getters/setters for HTML fields, and a reset
  method,
  not shown) -
  
  public ActionErrors validate(ActionMapping actionMapping,
  HttpServletRequest httpServletRequest) {
  
  log.debug(validate);
  ActionErrors errors = new ActionErrors();
  
  if
  (FormUtils.isNullOrEmpty(httpServletRequest.getParameter(username)))
{
  log.debug(logon.form.username.invalid);
  errors.add(ActionErrors.GLOBAL_MESSAGE,new
  ActionMessage(logon.form.username.invalid));
  }
  
  
 
  You don't need to use GLOBAL_MESSAGE, that is wrong, I think. And use
  errors, not messages. My validation would read:
 
  errors.add( username, new ActionError(
logon.form.username.invalid));
 
  Nix.
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 



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

html:errors/ blank page on invalid form

2005-05-25 Thread Andy

Hi All,

I'm unable to output any errors using html:errors/ tag, in Tomcat
5.5.7 I've tried numerous configurations and have now ran out of patience.
As I haven't been using Struts for more than three days I hope somebody
more experienced can point help me out.

When I select Submit, entering data into my form fields so the form is
parsed as valid, the forward works correctly. When I leave the fields
empty, so the form is parsed as invalid, I just get an empty page back -
which must be generated by Struts as it doesn't match any HTML I have.

Here is what I have in various files -




logon.jsp -

%@ page contentType=text/html;charset=UTF-8 language=java %
%@ taglib uri=/tags/struts-bean prefix=bean %
%@ taglib uri=/tags/struts-html prefix=html %
html
head
titlebean:message key=logon.title//title
/head
body
html:errors/
html:form action=/SubmitLogonForm.do
table
tr
tdUsername/td
tdhtml:text property=username//td
/tr
tr
tdPassword/td
tdhtml:text property=password//td
/tr
tr
td
html:submit/
html:cancel/
/td
td/td
/tr
/table
/html:form

/body





In LogonAction.java -


public ActionForward execute(ActionMapping mapping, ActionForm form,
 HttpServletRequest request,
HttpServletResponse response)
throws Exception {

if (isCancelled(request)) {
log.debug(cancel pressed);
return mapping.findForward(Constants.FAILURE);
}

LogonForm logonForm = (LogonForm)form;
log.debug(username +logonForm.getUsername());
log.debug(password +logonForm.getPassword());

return mapping.findForward(Constants.SUCCESS);
}





In LogonForm.java (I have getters/setters for HTML fields, and a reset
method,
not shown) -

public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {

log.debug(validate);
ActionErrors errors = new ActionErrors();

if
(FormUtils.isNullOrEmpty(httpServletRequest.getParameter(username))) {
log.debug(logon.form.username.invalid);
errors.add(ActionErrors.GLOBAL_MESSAGE,new
ActionMessage(logon.form.username.invalid));
}
if
(FormUtils.isNullOrEmpty(httpServletRequest.getParameter(password))) {
log.debug(logon.form.password.invalid);
errors.add(ActionErrors.GLOBAL_MESSAGE,new
ActionMessage(logon.form.password.invalid));
}

return errors.isEmpty() ? null : errors;
}





Two tags of interest from struts-config.xml -

   !-- Process a user logon --
   action   path=/SubmitLogonForm
 type=template.action.LogonAction
 name=LogonForm
 scope=request
 input=/logon.jsp
  forward name=success path=/welcome.jsp /
   /action



!-- Logon form --
form-bean name=LogonForm type=template.form.LogonForm/




ApplicationResources.properties - Note this is found and read by Tomcat, I
can
pull values from it using bean:message - the errors.head and prefix are not
displayed however, so clearly no error messages are being generated at all.

index.heading=Index Page Heading
index.logon=Logon
index.register=New User
#
struts.logo.path=/struts-power.gif
struts.logo.alt=Powered by Struts
# form fields
logon.form.username.invalid=Username invalid
logon.form.password.invalid=Password invalid
# page titles
error.title=Error Title
logoff.title=Logoff Title
logon.title=Logon Title
register.title=Register Title
welcome.title=Welcome Title
#
errors.header=Errors
errors.prefix=Error prefix





Well it's 2AM here in London, so here's hoping for an answer when I get up
later
today !

TIA,

Andy.



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



Re: html:errors/ blank page on invalid form

2005-05-25 Thread David Smith
Look for an exception in the logs.  Empty output usually means an 
uncaught exception.


--David

Andy wrote:


Hi All,

I'm unable to output any errors using html:errors/ tag, in Tomcat
5.5.7 I've tried numerous configurations and have now ran out of patience.
As I haven't been using Struts for more than three days I hope somebody
more experienced can point help me out.

When I select Submit, entering data into my form fields so the form is
parsed as valid, the forward works correctly. When I leave the fields
empty, so the form is parsed as invalid, I just get an empty page back -
which must be generated by Struts as it doesn't match any HTML I have.

Here is what I have in various files -




logon.jsp -

%@ page contentType=text/html;charset=UTF-8 language=java %
%@ taglib uri=/tags/struts-bean prefix=bean %
%@ taglib uri=/tags/struts-html prefix=html %
html
head
titlebean:message key=logon.title//title
/head
body
html:errors/
html:form action=/SubmitLogonForm.do
   table
   tr
   tdUsername/td
   tdhtml:text property=username//td
   /tr
   tr
   tdPassword/td
   tdhtml:text property=password//td
   /tr
   tr
   td
   html:submit/
   html:cancel/
   /td
   td/td
   /tr
   /table
/html:form

/body





In LogonAction.java -


   public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws Exception {

   if (isCancelled(request)) {
   log.debug(cancel pressed);
   return mapping.findForward(Constants.FAILURE);
   }

   LogonForm logonForm = (LogonForm)form;
   log.debug(username +logonForm.getUsername());
   log.debug(password +logonForm.getPassword());

   return mapping.findForward(Constants.SUCCESS);
   }





In LogonForm.java (I have getters/setters for HTML fields, and a reset
method,
not shown) -

   public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {

   log.debug(validate);
   ActionErrors errors = new ActionErrors();

   if
(FormUtils.isNullOrEmpty(httpServletRequest.getParameter(username))) {
   log.debug(logon.form.username.invalid);
   errors.add(ActionErrors.GLOBAL_MESSAGE,new
ActionMessage(logon.form.username.invalid));
   }
   if
(FormUtils.isNullOrEmpty(httpServletRequest.getParameter(password))) {
   log.debug(logon.form.password.invalid);
   errors.add(ActionErrors.GLOBAL_MESSAGE,new
ActionMessage(logon.form.password.invalid));
   }

   return errors.isEmpty() ? null : errors;
   }





Two tags of interest from struts-config.xml -

  !-- Process a user logon --
  action   path=/SubmitLogonForm
type=template.action.LogonAction
name=LogonForm
scope=request
input=/logon.jsp
 forward name=success path=/welcome.jsp /
  /action



   !-- Logon form --
   form-bean name=LogonForm type=template.form.LogonForm/




ApplicationResources.properties - Note this is found and read by Tomcat, I
can
pull values from it using bean:message - the errors.head and prefix are not
displayed however, so clearly no error messages are being generated at all.

index.heading=Index Page Heading
index.logon=Logon
index.register=New User
#
struts.logo.path=/struts-power.gif
struts.logo.alt=Powered by Struts
# form fields
logon.form.username.invalid=Username invalid
logon.form.password.invalid=Password invalid
# page titles
error.title=Error Title
logoff.title=Logoff Title
logon.title=Logon Title
register.title=Register Title
welcome.title=Welcome Title
#
errors.header=Errors
errors.prefix=Error prefix





Well it's 2AM here in London, so here's hoping for an answer when I get up
later
today !

TIA,

Andy.



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

 




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



Re: html:errors/ blank page on invalid form

2005-05-25 Thread Nikola Milutinovic

Andy wrote:


Hi All,

I'm unable to output any errors using html:errors/ tag, in Tomcat
5.5.7 I've tried numerous configurations and have now ran out of patience.
As I haven't been using Struts for more than three days I hope somebody
more experienced can point help me out.

When I select Submit, entering data into my form fields so the form is
parsed as valid, the forward works correctly. When I leave the fields
empty, so the form is parsed as invalid, I just get an empty page back -
which must be generated by Struts as it doesn't match any HTML I have.
 



Check out the logs, you could be running into an exception. Also, set 
buffer size of 20kb on all your pages, while you're testing. Empty 
output can also be caused by an exception in the page itself, and buffer 
being already sent.



Here is what I have in various files -




logon.jsp -

%@ page contentType=text/html;charset=UTF-8 language=java %
%@ taglib uri=/tags/struts-bean prefix=bean %
%@ taglib uri=/tags/struts-html prefix=html %
html
head
titlebean:message key=logon.title//title
/head
body
html:errors/
html:form action=/SubmitLogonForm.do
   table
   tr
   tdUsername/td
   tdhtml:text property=username//td
   /tr
   tr
   tdPassword/td
   tdhtml:text property=password//td
   /tr
   tr
   td
   html:submit/
   html:cancel/
   /td
   td/td
   /tr
   /table
/html:form

/body
 



Looks fine, except for the buffer page directive.


In LogonAction.java -


   public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws Exception {

   if (isCancelled(request)) {
   log.debug(cancel pressed);
   return mapping.findForward(Constants.FAILURE);
   }
 



Why would you consider Cancel a failure? Not that it will not work, but...


   LogonForm logonForm = (LogonForm)form;
   log.debug(username +logonForm.getUsername());
   log.debug(password +logonForm.getPassword());

   return mapping.findForward(Constants.SUCCESS);
   }
 



You're not checking the login, but that's fine for a test.


In LogonForm.java (I have getters/setters for HTML fields, and a reset
method,
not shown) -

   public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {

   log.debug(validate);
   ActionErrors errors = new ActionErrors();

   if
(FormUtils.isNullOrEmpty(httpServletRequest.getParameter(username))) {
   log.debug(logon.form.username.invalid);
   errors.add(ActionErrors.GLOBAL_MESSAGE,new
ActionMessage(logon.form.username.invalid));
   }
 



You don't need to use GLOBAL_MESSAGE, that is wrong, I think. And use 
errors, not messages. My validation would read:


errors.add( username, new ActionError( logon.form.username.invalid));

Nix.

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