Re: html:errors/ don't display anything

2012-08-04 Thread Mihir

Hello friend,
i have the same error. but i found the solution.
there is an error in your ApplicationResources file.check every key and
formation of key very well.
have you mapped the key name correctly while mapping it to action message in
your action ??

Thank You
Mihir Parekh



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: html:errors/ don't display anything

2012-04-16 Thread Javier Moreno
El 14 de abril de 2012 20:37, Oussama Jlassi oussa...@live.fr escribió:

 ApplicationResource.properties
 error.userName.required = User Name is required.error.password.required =
 Password is required.


Try to enter each key  on a separate line as follows:

error.userName.required = User Name is required.
error.password.required = Password is required.

I'd copied your code in a new proyect, I've tabbed it and it works perfect.
So maybe the problem is a bad copy-paste.


Re: html:errors/ don't display anything

2012-04-14 Thread Anjib


 I didn't see any error in you code. I ran in my machine it works fine.
You can test  just a Login action and debug from there.

On 4/14/2012 2:37 PM, Oussama Jlassi wrote:
i use struts 1.3 in tomcat 6 every thing work fine but the html error do not display my error messages how to fix it 


login.jsp
%@ page language=java pageEncoding=ISO-8859-1%%@ taglib uri=http://struts.apache.org/tags-html; prefix=html %%@ 
taglib uri=http://struts.apache.org/tags-logic; prefix=logic %%@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html:html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleJSP Page/title /head body div style=color:red 
html:errors/ /div   html:form action=/LoginUser Name :html:text name=loginf property=userName/  brPassword  :html:password name=loginf 
property=password/  br html:submit value=login/   /html:form
 /body/html:html

LoginForm.java
import javax.servlet.http.HttpServletRequest;import 
org.apache.struts.action.ActionErrors;import 
org.apache.struts.action.ActionMapping;import 
org.apache.struts.action.ActionMessage;import 
org.apache.struts.action.ActionForm;
public class LoginForm extends ActionForm {private String userName;
private String password;   public LoginForm() {   }
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {ActionErrors errors = new 
ActionErrors();if (userName == null || userName.length()  1) {errors.add(userName, new 
ActionMessage(error.userName.required));}if (password == null || password.length()  1) {  
  errors.add(password, new ActionMessage(error.password.required));   }
return errors;}
 public String getUserName() {System.out.println(Inside getter 
+userName);return userName;}
 public void setUserName(String userName) {System.out.println(Inside 
setter +userName);this.userName = userName;}
 public String getPassword() {return password;}
 public void setPassword(String password) {this.password = 
password;}

 public String toString(){return user name:  + getUserName() +  
password   + getPassword(); }}

struts-config.xml
?xml version=1.0 encoding=ISO-8859-1 ?!DOCTYPE struts-config PUBLIC  -//Apache 
Software Foundation//DTD Struts Configuration 1.3//EN  
http://struts.apache.org/struts/dtds/struts-config_1_3.dtd;

struts-config
form-beans  form-bean name=helloForm type=HelloForm /   form-bean name=loginf 
type=LoginForm/   form-bean name=HelloWorldForm type=HelloWorldForm/  /form-beans
action-mappings action path=/hello type=HelloAction name=helloForm input=index.jsp  
forward name=success path=/helloStruts.jsp //action
 action input=/login.jsp name=loginf path=/Login  scope=session type=LoginAction  
  forward name=success path=/success.jsp /forward name=failure path=/failure.jsp /
 /action
action input=/index2.jsp name=HelloWorldForm path=/helloworldscope=session 
type=HelloWorldAction   forward name=success path=/helloWorld.jsp /
/action /action-mappings
message-resources parameter=ApplicationResource/message-resources 
parameter=Resources //struts-config

ApplicationResource.properties
error.userName.required = User Name is required.error.password.required = 
Password is required.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org






-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: html:errors/ don't display anything

2012-04-14 Thread Oussama Jlassi

when i click the button when the textbox is empty it do not give error 
messagesame case when the textbox have one character
here is my action class that i used 
import javax.servlet.http.HttpServletRequest;import 
javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;import 
org.apache.struts.action.ActionMapping;import 
org.apache.struts.action.ActionForward;

public class LoginAction extends org.apache.struts.action.Action {
       public ActionForward execute(ActionMapping mapping, ActionForm form,     
       HttpServletRequest request, HttpServletResponse response)            
throws Exception {        LoginForm loginForm = (LoginForm) form;        if 
(loginForm.getUserName().equals(loginForm.getPassword())) {            return 
mapping.findForward(success);        } else {            return 
mapping.findForward(failure);        }  }}
 Date: Sat, 14 Apr 2012 17:32:18 -0400
 From: anji...@hotmail.com
 To: user@struts.apache.org
 Subject: Re: html:errors/ don't display anything
 
 
   I didn't see any error in you code. I ran in my machine it works fine.
 You can test  just a Login action and debug from there.
 
 On 4/14/2012 2:37 PM, Oussama Jlassi wrote:
  i use struts 1.3 in tomcat 6 every thing work fine but the html error do 
  not display my error messages how to fix it 
 
  login.jsp
  %@ page language=java pageEncoding=ISO-8859-1%%@ taglib 
  uri=http://struts.apache.org/tags-html; prefix=html %%@ taglib 
  uri=http://struts.apache.org/tags-logic; prefix=logic %%@ taglib 
  uri=http://struts.apache.org/tags-bean; prefix=bean %
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html:html head meta http-equiv=Content-Type 
  content=text/html; charset=UTF-8 titleJSP Page/title 
  /head body div style=color:red 
  html:errors/ /div   html:form action=/Login
  User Name :html:text name=loginf property=userName/  br
  Password  :html:password name=loginf property=password/  br 
  html:submit value=login/   /html:form
   /body/html:html
 
  LoginForm.java
  import javax.servlet.http.HttpServletRequest;import 
  org.apache.struts.action.ActionErrors;import 
  org.apache.struts.action.ActionMapping;import 
  org.apache.struts.action.ActionMessage;import 
  org.apache.struts.action.ActionForm;
  public class LoginForm extends ActionForm {private String userName; 
 private String password;   public LoginForm() {  
   }
  public ActionErrors validate(ActionMapping mapping, 
  HttpServletRequest request) {ActionErrors errors = new 
  ActionErrors();if (userName == null || userName.length()  1) { 
 errors.add(userName, new 
  ActionMessage(error.userName.required));}if (password == 
  null || password.length()  1) {errors.add(password, new 
  ActionMessage(error.password.required));   }
  return errors;}
   public String getUserName() {System.out.println(Inside getter 
  +userName);return userName;}
   public void setUserName(String userName) {
  System.out.println(Inside setter +userName);this.userName = 
  userName;}
   public String getPassword() {return password;}
   public void setPassword(String password) {this.password = 
  password;}
 
   public String toString(){return user name:  + 
  getUserName() +  password   + getPassword(); }}
 
  struts-config.xml
  ?xml version=1.0 encoding=ISO-8859-1 ?!DOCTYPE struts-config PUBLIC  
  -//Apache Software Foundation//DTD Struts Configuration 1.3//EN   
 http://struts.apache.org/struts/dtds/struts-config_1_3.dtd;
 
  struts-config
  form-beansform-bean name=helloForm type=HelloForm / 
  form-bean name=loginf type=LoginForm/ 
  form-bean name=HelloWorldForm type=HelloWorldForm/
  /form-beans
  action-mappings   action path=/hello 
  type=HelloAction name=helloForm input=index.jsp
  forward name=success path=/helloStruts.jsp /  /action
   action input=/login.jsp name=loginf path=/Login  
  scope=session type=LoginAction
  forward name=success path=/success.jsp /
  forward name=failure path=/failure.jsp / /action
  action input=/index2.jsp name=HelloWorldForm 
  path=/helloworldscope=session type=HelloWorldAction  
   forward name=success path=/helloWorld.jsp /
  /action   /action-mappings
  message-resources parameter=ApplicationResource/message-resources 
  parameter=Resources //struts-config
 
  ApplicationResource.properties
  error.userName.required = User Name is required.error.password.required

Re: html:errors/ error validation error

2009-05-31 Thread Dave Newton

coolsayan wrote:

 html:errors property=error.name.required /


From the docs:

Name of the property for which error messages should be displayed. If 
not specified, all error messages (regardless of property) are displayed.


You don't have a property named error.name.required--that sounds like 
the name of a message resource to me. You have password and name 
properties.


 %@ taglib uri=http://struts.apache.org/tags-html; prefix=bean %
 %@ taglib uri=http://struts.apache.org/tags-html; prefix=html %

You're using the same URI for two different taglibs. While this will 
work, it's probably not what you want. I don't see any uses of bean 
tags, so you can just delete the wrong one, or fix it.


Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: html:errors/ error validation error

2009-05-30 Thread coolsayan

please specify the taglib syntax.

newton.dave wrote:
 
 coolsayan wrote:
 what to change please be specific
 
 The taglib URIs.
 
 Dave
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23791499.html
Sent from the Struts - User mailing list archive at Nabble.com.


RE: html:errors/ error validation error

2009-05-30 Thread Martin Gainty

please view this comprehensive explanation of dojo mapped functions by Ted
http://struts.apache.org/2.1.6/docs/developing-ajax-widgets.html

hth
Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Sat, 30 May 2009 01:47:39 -0700
 From: coolsayan.2...@gmail.com
 To: user@struts.apache.org
 Subject: Re: html:errors/ error validation error
 
 
 please specify the taglib syntax.
 
 newton.dave wrote:
  
  coolsayan wrote:
  what to change please be specific
  
  The taglib URIs.
  
  Dave
  
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
  
  
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23791499.html
 Sent from the Struts - User mailing list archive at Nabble.com.

_
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009

Re: html:errors/ error validation error

2009-05-30 Thread Paul Benedict
http://wiki.apache.org/struts/StrutsUpgradeNotes11to124

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: html:errors/ error validation error

2009-05-30 Thread Dave Newton

Martin Gainty wrote:

please view this comprehensive explanation of dojo mapped functions by Ted
http://struts.apache.org/2.1.6/docs/developing-ajax-widgets.html


Wrong thread.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: html:errors/ error validation error

2009-05-30 Thread coolsayan

%...@page contentType=text/html%
%...@page pageEncoding=UTF-8%

%@ taglib uri=http://struts.apache.org/tags-html; prefix=bean %
%@ taglib uri=http://struts.apache.org/tags-html; prefix=html %

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
   http://www.w3.org/TR/html4/loose.dtd;
html
head
link rel=stylesheet type=text/css href=menu.css
meta http-equiv=Content-Type content=text/html; charset=UTF-8
titleLogin/title
/head
body
jsp:include page=head.jsp/
div id=login
 h1Login Form/h1
html:form action=/login
table  border=0 cellpadding=10px cellspacing=10px 
width=400px

tbody
tr
td register.jsp Register to login /td
/tr
tr
tdEnter Your user name:/td
tdhtml:text property=name //td
/tr
tr
tdEnter Your Password:/td
tdhtml:password property=password //td
/tr
tr

tdhtml:submit value=Login //td
tdhtml:reset value= //td
td forgetpass.jsp Forget Password /td
/tr
/tbody
/table

 html:errors property=error.name.required /


/html:form

/div

/body
/html


no error out put still it is configured...what to do?





















Paul Benedict-2 wrote:
 
 http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23796476.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: html:errors/ error validation error

2009-05-30 Thread Martin Gainty

Paul

we will need to see web.xml
struts.xml
struts-default.xml

need to determine which action class '/login' is maps to

then we'll need to see your java action class as well

thanks,
Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Sat, 30 May 2009 12:10:12 -0700
 From: coolsayan.2...@gmail.com
 To: user@struts.apache.org
 Subject: Re: html:errors/ error validation error
 
 
 %...@page contentType=text/html%
 %...@page pageEncoding=UTF-8%
 
 %@ taglib uri=http://struts.apache.org/tags-html; prefix=bean %
 %@ taglib uri=http://struts.apache.org/tags-html; prefix=html %
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/html4/loose.dtd;
 html
 head
 link rel=stylesheet type=text/css href=menu.css
 meta http-equiv=Content-Type content=text/html; charset=UTF-8
 titleLogin/title
 /head
 body
 jsp:include page=head.jsp/
 div id=login
  h1Login Form/h1
 html:form action=/login
 table  border=0 cellpadding=10px cellspacing=10px 
 width=400px
 
 tbody
 tr
 td register.jsp Register to login /td
 /tr
 tr
 tdEnter Your user name:/td
 tdhtml:text property=name //td
 /tr
 tr
 tdEnter Your Password:/td
 tdhtml:password property=password //td
 /tr
 tr
 
 tdhtml:submit value=Login //td
 tdhtml:reset value= //td
 td forgetpass.jsp Forget Password /td
 /tr
 /tbody
 /table
 
  html:errors property=error.name.required /
 
 
 /html:form
 
 /div
 
 /body
 /html
 
 
 no error out put still it is configured...what to do?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Paul Benedict-2 wrote:
  
  http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
  
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
  
  
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/%3Chtml%3Aerrors-%3E-error-validation-error-tp23765113p23796476.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 

_
Windows Live™: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_BR_life_in_synch_052009

Re: html:errors/ error validation error

2009-05-29 Thread coolsayan

what to change please be specific

coolsayan wrote:
 
 how to solve??why this html:errors / not working??
 
 
 
 code in login.jsp
 
 %...@page contentType=text/html%
 %...@page pageEncoding=UTF-8%
 
 %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean
 %
 %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html
 %
 %@ taglib uri=http://jakarta.apache.org/struts/tags-logic;
 prefix=logic %
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 http://www.w3.org/TR/html4/loose.dtd;
 html
 head
 link rel=stylesheet type=text/css href=stylesheet.css
 meta http-equiv=Content-Type content=text/html;
 charset=UTF-8
 titleJSP Page/title
 /head
 body
  h1Login Form/h1
  html:errors /
 html:form action=/login
 table border=0
 
 tbody
 tr
 td register.jsp Register to login /td
 /tr
 tr
 tdEnter Your user name:/td
 tdhtml:text property=name //td
 /tr
 tr
 tdEnter Your Password:/td
 tdhtml:password property=password //td
 /tr
 tr
 
 tdhtml:submit value=Login //td
 tdhtml:reset value= //td
 td forgetpass.jsp Forget Password /td
 /tr
 /tbody
 /table
 
 
 
 
 /html:form
 
 /body
 /html
 
 code in ActionBean:
 
 /*
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
 
 package com.myapp.struts;
 
 import javax.naming.NamingException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.*;
 import javax.servlet.*;
 //import javax.sql.DataSource;
 import org.apache.struts.action.ActionErrors;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.action.ActionMessage;
 //import sun.jdbc.odbc.JdbcOdbcDriver;
 
 /**
  *
  * @author Administrator
  */
 public class LoginForm extends org.apache.struts.action.ActionForm {
 //private JdbcOdbcDriver serviceLocator;
 
 private String name;
 //private String name;
 private String password;
 
 public String getPassword() {
 return password;
 }
 
 public void setPassword(String password) {
 this.password = password;
 }
 
 private int number;
 
 /**
  * @return
  */
 public String getName() {
 return name;
 }
 
 /**
  * @param string
  */
 public void setName(String string) {
 name = string;
 }
 
 /**
  * @return
  */
 public int getNumber() {
 return number;
 }
 
 /**
  * @param i
  */
 public void setNumber(int i) {
 number = i;
 }
 
 /**
  *
  */
 public LoginForm() {
 super();
 // TODO Auto-generated constructor stub
 }
 
 /**
  * This is the action called from the Struts framework.
  * @param mapping The ActionMapping used to select this instance.
  * @param request The HTTP Request we are processing.
  * @return
  */
  
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest
 request) {
 ActionErrors errors = new ActionErrors();
 if (getName() == null || getName().length()  1) {
 errors.add(name, new ActionMessage(error.name.required));
 // TODO: add 'error.name.required' key to your resources
 }
 return errors;
 }
 
 
 
 
 }
 
 code in Action servlet:
 
 /*
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
 package com.myapp.struts;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.*;
 import java.io.*;
 import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.action.ActionForward;
 
 /**
  *
  * @author Administrator
  */
 public class LoginAction extends org.apache.struts.action.Action {
 
 /* forward name=success path= */
 private final static String SUCCESS = success;
 private final static String FAILURE = failure;
 
 /**
  * This is the action called from the Struts framework.
  * @param mapping The ActionMapping used to select this instance.
  * @param form The optional ActionForm bean for this request.
  * @param request The HTTP Request we are processing.
  * @param response The HTTP Response we are processing.
  * @throws java.lang.Exception
  * @return
  */
 public ActionForward execute(ActionMapping mapping, ActionForm form,
 HttpServletRequest request, HttpServletResponse response)
 throws Exception {
 LoginForm formBean = (LoginForm) 

Re: html:errors/ error validation error

2009-05-29 Thread Dave Newton

coolsayan wrote:

what to change please be specific


The taglib URIs.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: html:errors/ error validation error

2009-05-28 Thread Paul Benedict
Update your taglib uris. Struts is no longer a jakarta project, unless
you're using 1.0 or 1.1

On Thu, May 28, 2009 at 11:19 AM, coolsayan coolsayan.2...@gmail.com wrote:

 how to solve??why this  not working??



 code in login.jsp

 %...@page contentType=text/html%
 %...@page pageEncoding=UTF-8%

 %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean %
 %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html %
 %@ taglib uri=http://jakarta.apache.org/struts/tags-logic; prefix=logic
 %





        JSP Page


  Login Form








                         register.jsp Register to login



                        Enter Your user name:




                        Enter Your Password:







                         forgetpass.jsp Forget Password













 code in ActionBean:

 /*
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */

 package com.myapp.struts;

 import javax.naming.NamingException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.*;
 import javax.servlet.*;
 //import javax.sql.DataSource;
 import org.apache.struts.action.ActionErrors;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.action.ActionMessage;
 //import sun.jdbc.odbc.JdbcOdbcDriver;

 /**
  *
  * @author Administrator
  */
 public class LoginForm extends org.apache.struts.action.ActionForm {
    //private JdbcOdbcDriver serviceLocator;

    private String name;
    //private String name;
    private String password;

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    private int number;

    /**
     * @return
     */
    public String getName() {
        return name;
    }

    /**
     * @param string
     */
    public void setName(String string) {
        name = string;
    }

    /**
     * @return
     */
    public int getNumber() {
        return number;
    }

    /**
     * @param i
     */
    public void setNumber(int i) {
        number = i;
    }

    /**
     *
     */
    public LoginForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest
 request) {
        ActionErrors errors = new ActionErrors();
        if (getName() == null || getName().length()  1) {
            errors.add(name, new ActionMessage(error.name.required));
            // TODO: add 'error.name.required' key to your resources
        }
        return errors;
    }




 }

 code in Action servlet:

 /*
  * To change this template, choose Tools | Templates
  * and open the template in the editor.
  */
 package com.myapp.struts;

 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.*;
 import java.io.*;
 import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.action.ActionForward;

 /**
  *
  * @author Administrator
  */
 public class LoginAction extends org.apache.struts.action.Action {

    /* forward name=success path= */
    private final static String SUCCESS = success;
    private final static String FAILURE = failure;

    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        LoginForm formBean = (LoginForm) form;
        String name = formBean.getName();
        String password = formBean.getPassword();

 // perform validation
        if ((name.isEmpty()) || // name parameter does not exist
                password == null || // email parameter does not exist
                name.equals() || // name parameter is empty
                password.isEmpty()) {   // password lacks '@'

            return mapping.findForward(FAILURE);
        }

        HttpSession mySession=request.getSession(true);
         mySession.setMaxInactiveInterval(30);
        return mapping.findForward(SUCCESS);
    }
 }




 Error

 HTTP Status 500 -

 

 type Exception report

 message

 descriptionThe server encountered an internal error () that prevented it
 from fulfilling this 

RE: HTML:errors

2009-04-27 Thread McDowell, Paula
Thanks, this works for my needs.

Paula

-Original Message-
From: Dave Newton [mailto:newton.d...@yahoo.com]
Sent: Friday, April 24, 2009 2:57 PM
To: Struts Users Mailing List
Subject: Re: HTML:errors

McDowell, Paula wrote:
 So is Globals a session bean with constant variable ERROR_KEY?

No, the value of Globals.ERROR_KEY names a session bean.

http://struts.apache.org/1.2.x/userGuide/struts-html.html#messages

Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Private and confidential as detailed here: 
http://www.sug.com/disclaimers/default.htm#Mail . If you cannot access the 
link, please e-mail sender.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: HTML:errors

2009-04-24 Thread McDowell, Paula
Thanks, for your response.

So is Globals a session bean with constant variable ERROR_KEY?

Thanks,
Paula

-Original Message-
From: Lukasz Lenart [mailto:lukasz.len...@googlemail.com]
Sent: Thursday, April 23, 2009 12:51 PM
To: Struts Users Mailing List
Subject: Re: HTML:errors

2009/4/23 McDowell, Paula paula.mcdow...@sug.com:
 Is there a way to check the html:errors/ field in the jsp for not empty?  I 
 only want to display an html group if the errors field is empty.  I'm using 
 Struts 1.1.

I've been using such structure:
logic:messagesPresent name=%=Globals.ERROR_KEY%
table width=480 id=ErrorsTableId class=ErrorsTable
  tr
td width=100% align=right
  a href=JavaScript: void(0) onclick=JavaScript: return hideErrors();
  html:image bundle=IMAGES srcKey=image.close //a
/td
  /tr
html:messages id=error name=%=Globals.ERROR_KEY%
  tr
tdbean:write name=error //td
  /tr
/html:messages
/table
/logic:messagesPresent


Regards
--
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Private and confidential as detailed here: 
http://www.sug.com/disclaimers/default.htm#Mail . If you cannot access the 
link, please e-mail sender.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: HTML:errors

2009-04-24 Thread Dave Newton

McDowell, Paula wrote:

So is Globals a session bean with constant variable ERROR_KEY?


No, the value of Globals.ERROR_KEY names a session bean.

http://struts.apache.org/1.2.x/userGuide/struts-html.html#messages

Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: HTML:errors

2009-04-23 Thread Lukasz Lenart
2009/4/23 McDowell, Paula paula.mcdow...@sug.com:
 Is there a way to check the html:errors/ field in the jsp for not empty?  I 
 only want to display an html group if the errors field is empty.  I'm using 
 Struts 1.1.

I've been using such structure:
logic:messagesPresent name=%=Globals.ERROR_KEY%
table width=480 id=ErrorsTableId class=ErrorsTable
  tr
td width=100% align=right
  a href=JavaScript: void(0) onclick=JavaScript: return hideErrors();
  html:image bundle=IMAGES srcKey=image.close //a
/td
  /tr
html:messages id=error name=%=Globals.ERROR_KEY%
  tr
tdbean:write name=error //td
  /tr
/html:messages
/table
/logic:messagesPresent


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: html:errors

2006-03-10 Thread Kalcevich, Daniel
Try using the logic:messagesPresent tag if you wish to check for the
existence of errors on a JSP page.

Or this link provides some help info regarding the errors object.

http://husted.com/struts/tips/017.html


-Original Message-
From: fea jabi [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 10, 2006 9:48 AM
To: user@struts.apache.org
Subject: html:errors

html:errors property=acctNumber


is returning an UL

how to determine the length of the list? would like to check if it has
more 
than one error for this property?

Thanks.

_
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-
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

2006-03-10 Thread fea jabi

Thankyou for your response.

yah. I know logic:messagesPresent will check if messages are present. but 
I would like to know

how many messages are present.

if just one then planning to get only the message not the UL. Now it's 
returning ULLImessage/LIUL. planning to get only message if it's one. 
is there way to do this?





From: Kalcevich, Daniel [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
To: Struts Users Mailing List user@struts.apache.org
Subject: RE: html:errors
Date: Fri, 10 Mar 2006 09:54:33 -0800

Try using the logic:messagesPresent tag if you wish to check for the
existence of errors on a JSP page.

Or this link provides some help info regarding the errors object.

http://husted.com/struts/tips/017.html


-Original Message-
From: fea jabi [mailto:[EMAIL PROTECTED]
Sent: Friday, March 10, 2006 9:48 AM
To: user@struts.apache.org
Subject: html:errors

html:errors property=acctNumber


is returning an UL

how to determine the length of the list? would like to check if it has
more
than one error for this property?

Thanks.

_
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-
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]



_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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



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]




Re: html:errors not working when sending a file to client with struts.

2005-10-13 Thread Kishore Senji
 file along with any errors in creating the csv files. I'm finding that my
 ActionErrors do not get returned to my .jsp file after calling the setHeader
 method and changing the header. Does anyone have any suggests on how to best
 to return errors to the user keeping in mind I already have a


From you action after setting the headers and I assume you also write the
Zip file contents to the OutputStream how are you going back to the JSP. I
guess you might be returning null, which indicates to Struts that the
response is taken care of by the Action and so does nothing afterwards.

I guess what you might want to do is that from a jsp, when the user clicks
on the download link go to an action, which composes the errors and takes
the user to another page which shows the errors (if any) and sends a request
for the file to be downloaded through META tags.


Re: html:errors not working when sending a file to client with struts.

2005-10-13 Thread Kishore Senji
 response.setContentType(application/zip);
 response.setHeader(Content-Disposition, attachment; filename= +
 zipFileName);
 response.setContentLength((int)tempCSVFile.length());
 BufferedInputStream bufferedInput = new BufferedInputStream(new
 FileInputStream(tempCSVFile));
 BufferedOutputStream bufferedOutput = new BufferedOutputStream(
 response.getOutputStream());

 while((leftToRead = bufferedInput.read(buffer)) != -1) {
 bufferedOutput.write(buffer, 0, leftToRead);
 }

 bufferedInput.close();
 bufferedOutput.flush();
 bufferedOutput.close ();

 if(!errors.isEmpty()) {
 saveErrors(request, errors);
 return(mapping.findForward(fail));
 }

 return (mapping.findForward(success));


I don't think it's anything to do with Struts. You just set the
content-length header, which tells the servlet container how much the
response body length would be. If you try to write more stuff into it, I'm
not sure it would get written to the response.


Re: html:errors tag

2005-08-01 Thread Laurie Harper

Kalra, Ashwani wrote:

I have a message defined like this in .properties file

2001={0} is required

I am passing for eg status for the {0}

Errors tag is printing it like this

[status] is required

Why its printing []  in the actual message ?


Because that's what you've told it to ;-) Check where you pass the status 
argument. Is it a list or some other object type besides String? You're 
seeing the toString() value of whatever it is you're passing.


L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: html:errors does not display

2005-06-13 Thread Andrew Tomaka
Song,

I was having a similar problem using WSAD 5.0.0.  Client side
validation using the Validator component worked, but server side
validation did not.  Since WSAD included Struts 1.1(beta 2), I decided
to update struts to the newest version.  This seemed to correct the
problem.  If you need further instructions on updating Struts to the
most recent version using WSAD, please refer to
http://struts.whoisandy.com/archives/2005/05/26/validator_serverside_validation.php.

~ Andrew Tomaka

On 6/13/05, Song Wang [EMAIL PROTECTED] wrote:
 Hello everyone,
 
 I cannot display html:errors property=blah/, but if I add
 
 %
 ActionErrors ae = ( ActionErrors) request.getAttribute( Action.ERROR_KEY);
 boolean err = false;
 if( ae != null) {
  Iterator iter = ae.properties();
  while(iter.hasNext()){
   System.out.println((String)iter.next());
  }
 }
 %
 
 I can see that blah is printed out. That being said, the errors does hold 
 the value. Does anyone know where I should configure? Or how to check if the 
 value is an empty string? I'm using WSAD 5.1.
 
 Thanks.
 Song
 
 
 -
 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 does not display

2005-06-13 Thread Vincent

Hi,

Does simple html:errors/ with no property specified works for you ?
Cause I get a similar problem - using same Java code in JSP display the 
fields with errors, but html:errors/ does nothing.


Thanks.

Vincent.

Song Wang wrote:

Hello everyone,

I cannot display html:errors property=blah/, but if I add

%
ActionErrors ae = ( ActionErrors) request.getAttribute( Action.ERROR_KEY);
boolean err = false;
if( ae != null) {
 Iterator iter = ae.properties();
 while(iter.hasNext()){
  System.out.println((String)iter.next());  
 }

}
%

I can see that blah is printed out. That being said, the errors does hold the 
value. Does anyone know where I should configure? Or how to check if the value is an 
empty string? I'm using WSAD 5.1.

Thanks.
Song



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



Re: html:errors and manual iterate

2004-12-12 Thread Sunny
You might need to pass  one more argument namely message to the 
html:messages tag .

If you've saved a message in struts scode with your OWN key, you should 
pass message='true'

if this message has been saved into struts scope using 
ExceptionHandler.saveException() method, you can pass message = 'false'

regards,
Sunny.

Erik Weber wrote:
For reference, it looks like this:
  %-- Display error message keyed under 'usernameError' 
if it exists --%

  html:messages id=error property=usernameError
  tr
td/td
td${error}/td
  /tr
  /html:messages
Thanks again all!


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

Re: html:errors and manual iterate

2004-12-11 Thread Laconia Data Systems
Leonard-
The Action class getErrors() method returns the contents of ActionErrors or
creates new ActionMessages object
http://struts.apache.org/api/org/apache/struts/action/Action.html
Is this what you're looking for?
Martin-
- Original Message - 
From: StrutsUser [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 8:19 AM
Subject: html:errors and manual iterate


I have a situation in which I have to add an ActionError without a message
(use it to indicate field in error on the page). If I use the generic
html:errors tag, it displays lineitems without a message. Is there a way to
iterate over html:errors to check that a message should be displayed only if
the message is not empty.
Thanks in advance for any suggestions,
Leonard


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



Re: html:errors and manual iterate

2004-12-11 Thread Erik Weber
StrutsUser, weren't you are part of this earlier Thread?
http://www.mail-archive.com/user%40struts.apache.org/msg15734.html
Maybe that was a different Struts user. Also this might help (Sorry, 
mail-archive.com doesn't go back this far. It also has a crappy search, 
but that's another thread).

Hope this helps,
Erik

Robin Mannering wrote:
Thanks for all the help received on this one..
As pointed out by Joe, the html:messages tag is conditional, and 
when supplying the parameter atribute I get exactly what I need.

For reference, it looks like this:
  %-- Display error message keyed under 'usernameError' 
if it exists --%

  html:messages id=error property=usernameError
  tr
td/td
td${error}/td
  /tr
  /html:messages
Thanks again all!

-Original Message-
From: Joe Germuska [mailto:[EMAIL PROTECTED]
Sent: 05 October 2004 14:00
To: Struts Users Mailing List
Subject: RE: ActionError and JSP display

At 1:45 PM +0100 10/5/04, Robin Mannering wrote:

Hi,



I was intending to use html:errors property=username/, 


specifying the property for display, but it still doesn't allow me 


to test for it's existence.



What I'd like to do is test if an error exists, then add a new HTML 


table row and cell into the output containing the error message, 


otherwise I do not want to create the HTML table row and cell at all.


Is there a way to do this ?


Personally, I think html:errors is the old way, although at least
one committer has expressed a preference for it.  I prefer
html:messages  It is essentially a combination conditional block
and iterator.  Here is my standard error messages JSP block:
html:messages id=msgdiv class=errorc:out value=${msg}
//div/html:messages
By default, it looks for an ActionMessages object saved using Struts'
saveErrors semantics (that is, stored in the request under
org.apache.struts.action.ERROR  You can set the message attribute
to true to get messages instead, and you can set the name
attribute to fetch any arbitrary ActionMessages.  Furthermore, you
can use the property attribute to constrain the condition to only
if the ActionMessages contains messages for the given property.  If
you're not using the JSTL, you can use bean:write instead of
c:out to display the message itself.  And, of course, you can use
table rows instead of divs to wrap each message provided by the
iterator.
http://struts.apache.org/userGuide/struts-html.html#messages
Hope this helps...
Joe

There's also the logic:messagesPresent/ tag that takes a property 
attribute: 
http://struts.apache.org/userGuide/struts-logic.html#messagesPresent


StrutsUser wrote:
Martin,
I need to manually iterate through the messages to find out if the 
message is empty or not in the JSP.
Thanks,
Leonard
- Original Message - From: Laconia Data Systems 
[EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 5:37 AM
Subject: Re: html:errors and manual iterate


Leonard-
The Action class getErrors() method returns the contents of 
ActionErrors or
creates new ActionMessages object
http://struts.apache.org/api/org/apache/struts/action/Action.html
Is this what you're looking for?
Martin-
- Original Message - From: StrutsUser [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 8:19 AM
Subject: html:errors and manual iterate

I have a situation in which I have to add an ActionError without a 
message
(use it to indicate field in error on the page). If I use the generic
html:errors tag, it displays lineitems without a message. Is there a 
way to
iterate over html:errors to check that a message should be displayed 
only if
the message is not empty.
Thanks in advance for any suggestions,
Leonard

-
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 and manual iterate

2004-12-11 Thread StrutsUser
Martin,
I need to manually iterate through the messages to find out if the message 
is empty or not in the JSP.
Thanks,
Leonard
- Original Message - 
From: Laconia Data Systems [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 5:37 AM
Subject: Re: html:errors and manual iterate


Leonard-
The Action class getErrors() method returns the contents of ActionErrors 
or
creates new ActionMessages object
http://struts.apache.org/api/org/apache/struts/action/Action.html
Is this what you're looking for?
Martin-
- Original Message - 
From: StrutsUser [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 8:19 AM
Subject: html:errors and manual iterate

I have a situation in which I have to add an ActionError without a message
(use it to indicate field in error on the page). If I use the generic
html:errors tag, it displays lineitems without a message. Is there a way 
to
iterate over html:errors to check that a message should be displayed only 
if
the message is not empty.
Thanks in advance for any suggestions,
Leonard

-
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 for indexed properties

2004-08-31 Thread Bill Siggelkow
You have to use the html:messages tag in a loop to generate the property 
values in a loop.
Here's an example --

 logic:iterate name=IndexedListForm property=orders
  id=orders indexId=ndx
tr
td
html:text name=orders property=partNumber 
indexed=true/br /nbsp;
html:messages id=error 
property='%=orders[+ndx+].partNumber%'
 		  		  font color=redbean:write name=error//font
/html:messages
/td
td
html:text name=orders property=quantity 
indexed=true/br /nbsp;
html:messages id=error 
property='%=orders[+ndx+].quantity%'
 		  		  font color=redbean:write name=error//font
/html:messages
/td
/tr
/logic:iterate

Enjoy!
Bill Siggelkow
Milind Rao wrote:
I have googled and searched the mailing list, but couldn't find an
answer to this.
I have a DynaValidatorForm containing a collection of objects
presented using the logic:iterate tag in the JSP.  The validation of
the objects in the collection is done in the validation.xml file using
something like
field property=closeHour
   indexedListProperty= regularTimingList
   depends=integer, intRange
arg0 key=error.workingHours.invalidHour /
arg1 name=intRange key=${var:min}
resource=false/
arg2 name=intRange key=${var:max}
resource=false/
   
varvar-namemin/var-namevar-value0/var-value/var
   
varvar-namemax/var-namevar-value24/var-value/var
 /field

This creates an Action error for the property
regularTiming[i].closeHour.  'i' being the index  of the collection
that fails validation.
What do I use for the property element of the html:errors tag?  I
hardcoded a property of regularTimingList[1].closeHour to see if 
the error shows up on the page if the close hour of the 2nd item in
the collection  is invalid.  It does.  But obviously, I don't want to
do this for every record in the collection.  What I need is an
equivalent of logic:iterate tag for errors.   Any pointers to doing
this would be appreciated.


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


Re: html:errors for indexed properties

2004-08-31 Thread Milind Rao
Worked well.  Thanks.  

Used html:errors instead of the message for brevity.  It would have
been nice if html:errors could have been set with indexed=true. 
Would have prevented the scriplet and been more consistent.

Regards
Milind

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



Re: html:errors for indexed properties

2004-08-31 Thread Lynn Stevens
instead of the scriptlet, I think you could use html-el and do the 
following:

html-el:messages id=error property=orders[${ndx}].partNumber
The el notation forces the ndx to evaluate
From: Bill Siggelkow [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: html:errors for indexed properties
Date: Tue, 31 Aug 2004 08:01:15 -0400
You have to use the html:messages tag in a loop to generate the property 
values in a loop.
Here's an example --

 logic:iterate name=IndexedListForm property=orders
  id=orders indexId=ndx
tr
td
html:text name=orders property=partNumber 
indexed=true/br /nbsp;
html:messages id=error 
property='%=orders[+ndx+].partNumber%'
 		  		  font color=redbean:write name=error//font
/html:messages
/td
td
html:text name=orders property=quantity 
indexed=true/br /nbsp;
html:messages id=error 
property='%=orders[+ndx+].quantity%'
 		  		  font color=redbean:write name=error//font
/html:messages
/td
/tr
/logic:iterate

Enjoy!
Bill Siggelkow
Milind Rao wrote:
I have googled and searched the mailing list, but couldn't find an
answer to this.
I have a DynaValidatorForm containing a collection of objects
presented using the logic:iterate tag in the JSP.  The validation of
the objects in the collection is done in the validation.xml file using
something like
field property=closeHour
   indexedListProperty= regularTimingList
   depends=integer, intRange
arg0 key=error.workingHours.invalidHour /
arg1 name=intRange key=${var:min}
resource=false/
arg2 name=intRange key=${var:max}
resource=false/
   
varvar-namemin/var-namevar-value0/var-value/var
   
varvar-namemax/var-namevar-value24/var-value/var
 /field

This creates an Action error for the property
regularTiming[i].closeHour.  'i' being the index  of the collection
that fails validation.
What do I use for the property element of the html:errors tag?  I
hardcoded a property of regularTimingList[1].closeHour to see if the 
error shows up on the page if the close hour of the 2nd item in
the collection  is invalid.  It does.  But obviously, I don't want to
do this for every record in the collection.  What I need is an
equivalent of logic:iterate tag for errors.   Any pointers to doing
this would be appreciated.


-
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 for indexed properties

2004-08-31 Thread dhay

Do you want to supply a patch?!


|-+
| |   Milind Rao   |
| |   [EMAIL PROTECTED]|
| |   m   |
| ||
| |   08/31/2004 09:40 |
| |   AM   |
| |   Please respond to|
| |   Struts Users|
| |   Mailing List|
| ||
|-+
  
|
  |
|
  |   To:   Struts Users Mailing List [EMAIL PROTECTED]  
   |
  |   cc:  
|
  |   Subject:  Re: html:errors for indexed properties 
|
  
|




Worked well.  Thanks.

Used html:errors instead of the message for brevity.  It would have
been nice if html:errors could have been set with indexed=true.
Would have prevented the scriplet and been more consistent.

Regards
Milind

-
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 /

2004-08-11 Thread Jim Barrows


 -Original Message-
 From: Laran Evans [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 11, 2004 10:08 AM
 To: Struts User Mailing List
 Subject: html:errors /
 
 
 When I use html:errors / I get a ClassCastException.  So I used 
 html:messages id=x / which displayed nothing, but worked.
 
 ActionErrors doesn't accept ActionError objects any longer 
 (deprecated), 
 just ActionMessage objects.
 
 What's the consensus on the correct way to display html:errors / 
 currently?

NOt sure about how common this is, but Husted has a cool tip: 
http://husted.com/struts/tips/017.html

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



RE: html:errors /

2004-08-11 Thread Tom Kane
 -Original Message-
 From: Laran Evans [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 11, 2004 10:08 AM
 To: Struts User Mailing List
 Subject: html:errors /
 
 
 When I use html:errors / I get a ClassCastException.  So I used 
 html:messages id=x / which displayed nothing, but worked.
 
 ActionErrors doesn't accept ActionError objects any longer 
 (deprecated), just ActionMessage objects.
 
 What's the consensus on the correct way to display html:errors / 
 currently?

NOt sure about how common this is, but Husted has a cool tip: 
http://husted.com/struts/tips/017.html


I found this in the struts mailing list archives which may be helpful to
you: 
http://marc.theaimsgroup.com/?l=struts-userm=108757076826525w=2

I'm also confused about the preferred method of displaying errors after the
deprecation of ActionError.  Armed with the knowledge from the archive I did
the following:

Here's the short version; code follows.  (Note: I'm using Struts 1.1)

In the action: I create an ActionMessages object called errors. For each
new error I add an ActionMessage to errors with the field as the key
(username in the following case).  I then store the ActionMessages object
as an attribute called errors in the session.  

In the .jsp page: I output each error next to its respective field in the
form.  Each error's key is the same as its field name.



Say we have a form with a 'username' field.

In SubmitFormAction.java :

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

ActionMessages errors = new ActionMessages();

...

if ( isBad(username) ) {
errors.add(username, new ActionMessage(error.bad_username));
}

...

if ( !errors.isEmpty() ) {
request.getSession().setAttribute(errors, errors);
return (mapping.findForward(error));
} 

return (mapping.findForward(success));
}

In form.jsp:

emUser Name: /emhtml:text property=username/
html-el:messages name=errors property=username
id=username
c:out value=${username}/
/html-el:messages
br/

The output is:
User Name: text box here error message here, if it exists



One main difference between the method in the archive and my method is that
I put the errors object into the session instead of the request.  The
reason is that all my actions redirect to their respective .jsp pages to
avoid the user re-running an action simply by refreshing the page (e.g. a
'create' action).  I think that anything stored in the request is lost by
the time the action is redirected.  I put errors in the session instead.
One problem with this is that the errors object remains in the session so
any subsequent visits to the page display errors.  Since an error redirects
the user right back to the same page, I think I may remove the errors
object from the session as soon as the form is submitted.

My questions are:

1) Do I need to put errors in the session so that it survives the
redirection long enough to be displayed?
2) Do I need to use c:out inside an html:messages tag to output
messages?  Is it the only way?
3) Is it considered bad form to use ActionErrors?  I don't want to build
dependencies on soon-to-be-deprecated stuff.

Laran: hope that helps
Everyone else: hope you help me

-tom


RE: html:errors /

2004-08-11 Thread Hubert Rabago

--- Tom Kane [EMAIL PROTECTED] wrote:
 My questions are:
 
 1) Do I need to put errors in the session so that it survives the
 redirection long enough to be displayed?

That's one way to do it.  In support of this, Struts 1.2.x has what's called
Session-scoped ActionMessages.  See the release notes. 
http://struts.apache.org/userGuide/release-notes.html .  
Another way is to pass the errors as a redirect parameter, which is what I
do.  I wrote some extension classes which I include in my projects for this
purpose.  If you're interested, lemme know.

 2) Do I need to use c:out inside an html:messages tag to output
 messages?  Is it the only way?

The standard code I've seen actually has bean:write because that's the tag
that comes with Struts, but c:out works, too, as you've discovered.

 3) Is it considered bad form to use ActionErrors?  I don't want to build
 dependencies on soon-to-be-deprecated stuff.
 

ActionErrors will be deprecated in 1.2 and removed in a future version.  If
you're still using 1.1, though, I don't think you have a choice since the
methods these will only work with ActionErrors.  

 Laran: hope that helps
 Everyone else: hope you help me
 
 -tom
 

- Hubert




__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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



RE: html:errors /

2004-08-11 Thread Jim Barrows
 -Original Message-
 From: Tom Kane [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 11, 2004 11:38 AM
 To: [EMAIL PROTECTED]
 Subject: RE: html:errors /
 
 
  -Original Message-
  From: Laran Evans [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, August 11, 2004 10:08 AM
  To: Struts User Mailing List
  Subject: html:errors /
  
  
 
 One main difference between the method in the archive and my 
 method is that
 I put the errors object into the session instead of the 
 request.  The
 reason is that all my actions redirect to their respective 
 .jsp pages to
 avoid the user re-running an action simply by refreshing the 
 page (e.g. a
 'create' action). 
 I think that anything stored in the 
 request is lost by
 the time the action is redirected.  I put errors in the 
 session instead.
 One problem with this is that the errors object remains in 
 the session so
 any subsequent visits to the page display errors.  Since an 
 error redirects
 the user right back to the same page, I think I may remove 
 the errors
 object from the session as soon as the form is submitted.
 
 My questions are:
 
 1) Do I need to put errors in the session so that it survives the
 redirection long enough to be displayed?

More then likely.. try it and see.  You're reasons for redirection kind of bother me.. 
I've never run into a situation where a refresh submits a form twice, but then again I 
haven't run into every situation.

 2) Do I need to use c:out inside an html:messages tag to output
 messages?  Is it the only way?

Nope, you can use bean:write 

 3) Is it considered bad form to use ActionErrors?  I don't 
 want to build
 dependencies on soon-to-be-deprecated stuff.

Depends... for struts 1.1 no, for struts 1.2 yes.  If you're planning on migrating 
soon... up to you.



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



Re: html:errors /

2004-08-11 Thread Niall Pemberton
Since ActionError extends ActionMessage then I don't think this is true.
When I converted a current app to Struts 1.2.x I'm sure it all still worked
with ActionError - I have now changed all ActionError to ActionMessage so
that I don't get all the deprecated warnings. Can you post your stack
trace with the ClassCastException?

Niall


- Original Message - 
From: Laran Evans [EMAIL PROTECTED]
To: Struts User Mailing List [EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 6:08 PM
Subject: html:errors /


 When I use html:errors / I get a ClassCastException.  So I used
 html:messages id=x / which displayed nothing, but worked.

 ActionErrors doesn't accept ActionError objects any longer (deprecated),
 just ActionMessage objects.

 What's the consensus on the correct way to display html:errors /
 currently?

 IA

 -
 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 /

2004-08-11 Thread Laran Evans
So would it be my best bet to follow http://husted.com/struts/tips/017.html?
Jim Barrows wrote:
-Original Message-
From: Tom Kane [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 11:38 AM
To: [EMAIL PROTECTED]
Subject: RE: html:errors /
   

-Original Message-
From: Laran Evans [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 10:08 AM
To: Struts User Mailing List
Subject: html:errors /
   

One main difference between the method in the archive and my 
method is that
I put the errors object into the session instead of the 
request.  The
reason is that all my actions redirect to their respective 
.jsp pages to
avoid the user re-running an action simply by refreshing the 
page (e.g. a
'create' action). 
I think that anything stored in the 
request is lost by
the time the action is redirected.  I put errors in the 
session instead.
One problem with this is that the errors object remains in 
the session so
any subsequent visits to the page display errors.  Since an 
error redirects
the user right back to the same page, I think I may remove 
the errors
object from the session as soon as the form is submitted.

My questions are:
1) Do I need to put errors in the session so that it survives the
redirection long enough to be displayed?
   

More then likely.. try it and see.  You're reasons for redirection kind of bother 
me.. I've never run into a situation where a refresh submits a form twice, but then 
again I haven't run into every situation.
 

2) Do I need to use c:out inside an html:messages tag to output
messages?  Is it the only way?
   

Nope, you can use bean:write 

 

3) Is it considered bad form to use ActionErrors?  I don't 
want to build
dependencies on soon-to-be-deprecated stuff.
   

Depends... for struts 1.1 no, for struts 1.2 yes.  If you're planning on migrating 
soon... up to you.

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



RE: html:errors /

2004-08-11 Thread Jim Barrows


 -Original Message-
 From: Laran Evans [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 11, 2004 12:15 PM
 To: Struts Users Mailing List
 Subject: Re: html:errors /
 
 
 So would it be my best bet to follow 
 http://husted.com/struts/tips/017.html?


More then likely.  If you look at the 1.2 javadocs at 
http://struts.apache.org/api/index.html you might be better able to tell what's going 
to work for you.



 
 Jim Barrows wrote:
 
 -Original Message-
 From: Tom Kane [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 11, 2004 11:38 AM
 To: [EMAIL PROTECTED]
 Subject: RE: html:errors /
 
 
 
 
 -Original Message-
 From: Laran Evans [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 11, 2004 10:08 AM
 To: Struts User Mailing List
 Subject: html:errors /
 
 
 
 
 One main difference between the method in the archive and my 
 method is that
 I put the errors object into the session instead of the 
 request.  The
 reason is that all my actions redirect to their respective 
 .jsp pages to
 avoid the user re-running an action simply by refreshing the 
 page (e.g. a
 'create' action). 
 I think that anything stored in the 
 request is lost by
 the time the action is redirected.  I put errors in the 
 session instead.
 One problem with this is that the errors object remains in 
 the session so
 any subsequent visits to the page display errors.  Since an 
 error redirects
 the user right back to the same page, I think I may remove 
 the errors
 object from the session as soon as the form is submitted.
 
 My questions are:
 
 1) Do I need to put errors in the session so that it survives the
 redirection long enough to be displayed?
 
 
 
 More then likely.. try it and see.  You're reasons for 
 redirection kind of bother me.. I've never run into a 
 situation where a refresh submits a form twice, but then 
 again I haven't run into every situation.
 
   
 
 2) Do I need to use c:out inside an html:messages tag to output
 messages?  Is it the only way?
 
 
 
 Nope, you can use bean:write 
 
   
 
 3) Is it considered bad form to use ActionErrors?  I don't 
 want to build
 dependencies on soon-to-be-deprecated stuff.
 
 
 
 Depends... for struts 1.1 no, for struts 1.2 yes.  If you're 
 planning on migrating soon... up to you.
 
 
 
 -
 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 /

2004-08-11 Thread Kishore Senji
You might be getting a ClassCastException, because, you might be using
Struts 1.1, and adding a ActionMessage to ActionErrors and using the
html:errors/ tag. The tag assumes ActionError object, so, when it
tries to cast your ActionMessage to ActionError, that's where you run
in to ClassCastException. So, instead of html:errors/ use
html:messages/ in the way shown below.


errors.add(name, new ActionMessage(user.name.empty.error));

In jsp use, 
html:messages id=error property=name 
   bean:write name=error filter=false /
/html:messages

Kishore Senji.

On Wed, 11 Aug 2004 13:08:14 -0400, Laran Evans [EMAIL PROTECTED] wrote:
 When I use html:errors / I get a ClassCastException.  So I used
 html:messages id=x / which displayed nothing, but worked.
 
 ActionErrors doesn't accept ActionError objects any longer (deprecated),
 just ActionMessage objects.
 
 What's the consensus on the correct way to display html:errors /
 currently?
 
 IA
 
 -
 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]