Struts Jar file error

2005-01-05 Thread Vijaya S
Hi,

I downloaded the struts source version. When I extracted the file, I got the
following folder structure.

--Jakarta-struts-1.2.4
--Contrib.
--Struts-el
--Lib
--Webapps
--Lib
--Webapps

Struts.jar file exist in Jakarta-struts-1.2.4\lib folder. When I execute
this jar file, I get the following error.

“Failed to load Main-Class manifest attribute from
c:\Jakarta-struts-1.2.4\lib\struts.jar”

Can anyone help me what did I do wrong or what else I need to do? I use
Windows XP.

Thanks,
Vijaya



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



RE: displaytag1.0rc2 (export) and struts problem

2005-01-05 Thread Metin Erksan
hi
it downloads myaction.do as a file .?
but in its export example , this func does not work like this
below is my code
 

  
  
  
  
  
  
  
  

   
 
 
  

  
  


  
var table = document.getElementById("XXX");
var rows = table.getElementsByTagName("td");

for (i=0; i < rows.length; i++) 
{
  rows[i].onclick = function() 
  {
  var cell = this.getElementsByTagName("td")[0];
  var link = cell.firstChild;
  var id = link.firstChild.nodeValue;
  location.href='hizAction.do?action=delete&hizNo='+id;
  
  this.style.cursor="wait";
  }
 
 }
 



Jim Barrows <[EMAIL PROTECTED]> wrote:


> -Original Message-
> From: Metin Erksan [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 04, 2005 10:59 AM
> To: Struts Users Mailing List
> Subject: RE: displaytag1.0rc2 (export) and struts problem
> 
> 
> hi
> 
> it wants to download "myAction.do" not the excell file.

Ummm... okay... that appears to be normal as well... When I set export="true" 
on my webapp it generates:
/OnlineLoans2/chooseSchool.do?6578706f7274=1&action=Continue&d-16544-e=2&stateSchoolIsIn=AZ
of which action and stateSchoolIsIn are the only two parameters I have coded. 
The rest are created by the tag. The tag is creating this file on the fly, so 
this may very well be correct.
What does it actually download?

> 
> sincerely
> 
> Jim Barrows wrote:
> 
> 
> > -Original Message-
> > From: Metin Erksan [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, January 04, 2005 1:03 AM
> > To: user@struts.apache.org
> > Subject: displaytag1.0rc2 (export) and struts problem
> > 
> > 
> > hi
> > 
> > i use jdeveloper10g and dipslaytag10rc2. i want to use export 
> > property but when i click to "excell" link it shows up a 
> > window that wants to save file ? how can i correct this?
> 
> What do you want it to do? That's the correct behavior.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -
> ALL-NEW Yahoo! Messenger - all new features - even more fun! 
> 

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



-
Do you Yahoo!?
 Read only the mail you want - Yahoo! Mail SpamGuard.

[validator] indexed properties

2005-01-05 Thread William Ferguson
Hi all,

even after scanning the doco, examples, source code and previous posts I
still can't get validation to happen for an indexed field in my Struts
(1.2.4) application working. I would really appreciate some help crafting
the appropriate validation definition.


My form is defined as

  
  


A 'quantityArray' parameter is supplied with the Request and is an array of
Integer like Strings.

The Struts ActionForm has the following methods:
  public Integer getQuantity(int index);

  /*
   * NB it is not expected that this method will ever be called,
   * but I think it is needed so that the commons-validator recognises
'quantity' as a property.
   */
  public void setQuantity(int index, Integer quantity);
  public Integer[] getQuantityArray();
  public void setQuantityArray(Integer[] quantity);

But this combination causes the following Exception to be thrown during
validation:
24734  ERROR org.apache.commons.validator.util.ValidatorUtils - Unknown
property 'quantity'
java.lang.NoSuchMethodException: Unknown property 'quantity'
at
org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.j
ava:1175)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:772)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80
1)
at
org.apache.commons.validator.util.ValidatorUtils.getValueAsString(ValidatorU
tils.java:105)
at
org.apache.struts.validator.FieldChecks.validateRequired(FieldChecks.java:87
)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.validator.ValidatorAction.executeValidationMethod(Validat
orAction.java:567)
at
org.apache.commons.validator.Field.validateForRule(Field.java:811)
at org.apache.commons.validator.Field.validate(Field.java:890)
at org.apache.commons.validator.Form.validate(Form.java:174)
at
org.apache.commons.validator.Validator.validate(Validator.java:367)
at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:112)

I tried dozens of different combos with no luck.
What do I need to do to validate a collection of properties of unknown size
using the commons-validator?

NB crossposting to both commons and struts lists.

William


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



RE: How to combine normal servlets and struts

2005-01-05 Thread Ashutosh Satyam
Hi,
 If you can tell in detail what exactly is the servlet code doing, it'll
be easier to explain how can you incorporate it within struts framework.

In a struts framework the request processing is done by the Action
classes. So eventually, whatever task is being done by your current servlet
can be implemented as an action class.

You existing web.xml will have now no entry for this servlet as it's going
to be invoked by the ActionServlet/RequestProcessor. In order that this 
ActionServlet invokes this action you need to update the struts-config file
with relevant information.

Hope this helps you.

Regards,
Ashutosh



-Original Message-
From: Manisha Sathe [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 06, 2005 9:01 AM
To: user@struts.apache.org
Subject: How to combine normal servlets and struts


I have 2 sets of programms running on Tomcat 
 
1)one set is using normal servlet program architecture.
2)another is using struts technology.
 
This together makes whole application. Eventually the whole application will be 
in struts, but currently i have half in servlet and half in struts. 
 
Currently developed separately, but now i want to combine this under one roof. 
i mainly worried about web.xml - how i can do it?
 
regards
Manisha
 
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Install Struts

2005-01-05 Thread Vijaya S
Hello,

I downloaded the source version of the Struts software. How do I start the
Struts application.

Thanks,
Vijaya



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



Switching across multiple web application

2005-01-05 Thread Ashutosh Satyam

Hi,
 I would like to know how can we switch from one web 
application to another web application in a struts 
framework. I don't mean switching between the various
application modules within a web application.

 What I intend to do is to restrict the user from
directly accessing the 2nd web application. I want
the end user to be routed to 2nd web application always
via the 1st web application.

 Any pointers on this will be appreciated.

Regards,
Ashutosh


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



Re: [OT] WinCVS problem (free beer!)

2005-01-05 Thread Frank W. Zammetti
Not stupid at all Lucas :)  Yes, I did try that, a couple of times with 
some variables (one time I installed Python first, then Python and TCL, 
etc.)  I DID however get it running on Win2K under VMWare, so I could 
always use it there.  But, one thing I didn't realize is that you can't 
actually browse a repository from WinCVS (or any CVS GUI that I found). 
 There's the two web-based browsers, but that's it.  I'd bet one of the 
built-in clients in Eclipse or some other IDE could do it though.  In 
this respect I actually perfer SourceSafe, but that's neither here nor 
there.

P.S., does anyone know, if I create a module and add content to it, will 
it show up immediately via the web browser on SourceForge?  I did so, 
and I THINK I did it right, but it's not showing up.  However, a module 
I created 3-4 hours ago does appear to be there, so I was thinking maybe 
there's a delay.  Just curious, I'll know for sure in the morning :)

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
Lucas González Pearson wrote:
This might sound stupid... but have you tried reinstalling it?
- Original Message -
From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
To: "David G. Friedman" <[EMAIL PROTECTED]>
Cc: "Struts Users Mailing List" ; "Commons User"

Sent: Wednesday, January 05, 2005 7:34 PM
Subject: Re: [OT] WinCVS problem (free beer!)

Indirectly I've thought about it... A lot of guys are using WASD at
work, which is of course Eclipse-based, but I've been resisting.  I've
used a number of IDEs over the years, and I've always found that they
get in my way far more than they help.  That's just me, but it's been my
experience.  At this point I have such a refined work style between
UltraEdit and Tomcat that I can actually work more efficiently overall
than with any IDE I've tried (and I have actually spent some time
playing with WSAD, and it doesn't seem to be any different in terms of
that).  They don't call me the Batch File King (tm) at work for nothin' :)
FYI, I'm trying to let WinCVS run it's course right now as per Glenn's
suggestion.  I also tried hitting escape as Matt suggested, but it
didn't unfreeze it, so it wouldn't appear to be that problem (plus I'm
not seeing any drive activity, which I'd expect to see if it was doing
what Glenn suggested).
It's weird, I can move the window around no problem, but I can't do
anything with any part of the interface (and large parts of the
interface get "erased" when I move any window over it, typical Windows
frozen app syndrom)
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
David G. Friedman wrote:
Frank,
Ever think of using Eclipse (v3.X) ?  I use it for Java/Struts/Tomcat
(Via
the Sysdeo plug-in) development and it includes a built-in CVS client.
Add-ons also allow for SVN.
Regards,
David Friedman / [EMAIL PROTECTED]
-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 05, 2005 5:11 PM
To: Commons User; Struts User
Subject: [OT] WinCVS problem (free beer!)
Ok, no free beer, I lied ;)  Got your attention though!
I'm just now trying to use CVS for the first time, and I'm having a
problem I haven't been able to figure out, and I'm sure at least some of
you here are using WinCVS, so I hope no one minds an OT question (FYI, I
couldn't find a WinCVS support forum)...
I've installed WinCVS 1.3 (the latest from the WinCVW.org site,
downloaded today) on Windows XP.  I haven't however installed Python or
TCL, as they are optional.  The install went fine.
But, when I try to run it, it freezes.  I see the splash screen, and the
popup mentioning Python.  I click OK, and it's just frozen, can't do
anything.  I can close it via right-clicking the taskbar item, but
nothing else.  It works on my work PC by the way, although I can't do
anything with it there because of firewall restrictions, so I really
need it working at home.
I've checked to be sure the CvsNT and CvsNT Locking services are
running, and they are (not even sure that's necassery, but still).  I've
spent 30 minutes or so Googling for an answer but haven't had any luck.
Any ideas from anyone around here?  Again, sorry for the OT post, but I
couldn't resist tapping the expertise of these lists.  Thanks a lot!
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
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: [OT] WinCVS problem (free beer!)

2005-01-05 Thread Lucas González Pearson
This might sound stupid... but have you tried reinstalling it?


- Original Message -
From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
To: "David G. Friedman" <[EMAIL PROTECTED]>
Cc: "Struts Users Mailing List" ; "Commons User"

Sent: Wednesday, January 05, 2005 7:34 PM
Subject: Re: [OT] WinCVS problem (free beer!)


> Indirectly I've thought about it... A lot of guys are using WASD at
> work, which is of course Eclipse-based, but I've been resisting.  I've
> used a number of IDEs over the years, and I've always found that they
> get in my way far more than they help.  That's just me, but it's been my
> experience.  At this point I have such a refined work style between
> UltraEdit and Tomcat that I can actually work more efficiently overall
> than with any IDE I've tried (and I have actually spent some time
> playing with WSAD, and it doesn't seem to be any different in terms of
> that).  They don't call me the Batch File King (tm) at work for nothin' :)
>
> FYI, I'm trying to let WinCVS run it's course right now as per Glenn's
> suggestion.  I also tried hitting escape as Matt suggested, but it
> didn't unfreeze it, so it wouldn't appear to be that problem (plus I'm
> not seeing any drive activity, which I'd expect to see if it was doing
> what Glenn suggested).
>
> It's weird, I can move the window around no problem, but I can't do
> anything with any part of the interface (and large parts of the
> interface get "erased" when I move any window over it, typical Windows
> frozen app syndrom)
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> David G. Friedman wrote:
> > Frank,
> >
> > Ever think of using Eclipse (v3.X) ?  I use it for Java/Struts/Tomcat
(Via
> > the Sysdeo plug-in) development and it includes a built-in CVS client.
> > Add-ons also allow for SVN.
> >
> > Regards,
> > David Friedman / [EMAIL PROTECTED]
> >
> > -Original Message-
> > From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, January 05, 2005 5:11 PM
> > To: Commons User; Struts User
> > Subject: [OT] WinCVS problem (free beer!)
> >
> >
> > Ok, no free beer, I lied ;)  Got your attention though!
> >
> > I'm just now trying to use CVS for the first time, and I'm having a
> > problem I haven't been able to figure out, and I'm sure at least some of
> > you here are using WinCVS, so I hope no one minds an OT question (FYI, I
> > couldn't find a WinCVS support forum)...
> >
> > I've installed WinCVS 1.3 (the latest from the WinCVW.org site,
> > downloaded today) on Windows XP.  I haven't however installed Python or
> > TCL, as they are optional.  The install went fine.
> >
> > But, when I try to run it, it freezes.  I see the splash screen, and the
> > popup mentioning Python.  I click OK, and it's just frozen, can't do
> > anything.  I can close it via right-clicking the taskbar item, but
> > nothing else.  It works on my work PC by the way, although I can't do
> > anything with it there because of firewall restrictions, so I really
> > need it working at home.
> >
> > I've checked to be sure the CvsNT and CvsNT Locking services are
> > running, and they are (not even sure that's necassery, but still).  I've
> > spent 30 minutes or so Googling for an answer but haven't had any luck.
> >
> > Any ideas from anyone around here?  Again, sorry for the OT post, but I
> > couldn't resist tapping the expertise of these lists.  Thanks a lot!
> >
> > --
> > Frank W. Zammetti
> > Founder and Chief Software Architect
> > Omnytex Technologies
> > http://www.omnytex.com
> >
> >
> > -
> > 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: Attributes Initialization

2005-01-05 Thread Richard Yee
It is because the action class execute method is only executed when the 
form is submitted, not when it is displayed. If you want to pre-load the 
form, you need to create an action and either forward or redirect to the 
action which then forwards to the page that displays the form.

-Richard
At 11:12 AM 1/5/2005, you wrote:
I have a form that needs some initialization.  The form is derived
from DynaValidatorForm and its properties are defined in struts-
config.xml.  I initialize an attribute in the 'execute' method of
my 'Action' class.  For some reason when the servlet container
creates the page for the first time, the Struts servlet does not call
the 'execute' method and consequently there is no attribute
initialization.  When I hit the 'submit' button, the 'execute' method
is called and the attribute is initialized correctly.  I think that
the problem is somewhere in re-direction, but I don't know where.
Can anyone suggest why the 'execute' is never called before the
initial display of the form?
---
Eli Segev


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


How to combine normal servlets and struts

2005-01-05 Thread Manisha Sathe
I have 2 sets of programms running on Tomcat 
 
1)one set is using normal servlet program architecture.
2)another is using struts technology.
 
This together makes whole application. Eventually the whole application will be 
in struts, but currently i have half in servlet and half in struts. 
 
Currently developed separately, but now i want to combine this under one roof. 
i mainly worried about web.xml - how i can do it?
 
regards
Manisha
 
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Cancel button problem

2005-01-05 Thread Manisha Sathe
Hi Nicolas,
 
I tried it but I am not getting it right, pls can u explain me in detail ?
 
Thanks & regards
Manisha

Nicolas De Loof <[EMAIL PROTECTED]> wrote:

When using cancel button, validation is automatically skipped. Use 
isCanceled(request) in your action to see if cancel was clicked and 
forward to your index page.

Nico.

Manisha Sathe a écrit :

>I am using struts cancel button. But when i click on that it goes to next page 
>(w/o even validation - using validator). What i want to do is i want to 
>redirect it to index page. I tried using oncancel inside but giving me error.
> 
>How i can do this ?
> 
>Thanks and regards,
>Manisha
>
> 
>-
>Do you Yahoo!?
> Yahoo! Mail - Find what you need with new enhanced search. Learn more.
> 
>

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.


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



-
Do you Yahoo!?
 Read only the mail you want - Yahoo! Mail SpamGuard.

Re: Hmm... i will go crazy due to validation

2005-01-05 Thread Manisha Sathe
Hi all,
 
I am writing my experience in case somebody same like me (very very new to 
struts) might get hint if they face the same problem.
 
1)First thing which i was doing wrong was making use of old 
validation-rules.xml (downloaded from web while downloading example) along with 
new  jar files. The javascript validation was not working at all as function 
name ...required()... was missing "form name". This went ok once i corrected 
this version problem.
 
2)Secondly when i was testing server side validation - again it was not doing 
it and was just submitting as it is and reson was i was missing 
 
input = "...jsp file name" for action handler inside struts-config.xml file
 
After 2 days of struggle at least simple "required" condition is working for 
me. Let's see how it goes further.
 
I would also like to thank all who helped me out in my validator related issues.
 
regards
Manisha
 

Manisha Sathe <[EMAIL PROTECTED]> wrote:

Manisha Sathe wrote:

>I am testing struts validatior in one test program. Finally i could do some 
>date validation for user i/p. I could get javascript pop-up if i enter it 
>wrongly.
> 
>i wanted to test server side validation - so i switched off javascript and 
>tried to submit - it went through w/o throwing any error.
> 
>Now again pls help me, what i am missing out ? I am using something like 
>(instead of ActionForm)
> 
>public class MyForm extends ValidatorForm {
> 
>
> 
>}
> 
>inside my formbean
> 
>regards
>Manisha
>
>__
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
> 
>

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



-
Do you Yahoo!?
Meet the all-new My Yahoo! – Try it today! 


-
Do you Yahoo!?
 Meet the all-new My Yahoo! – Try it today! 

Re: isRequestedSessionIdValid is returning false for the first time

2005-01-05 Thread Craig McClanahan
On Wed, 5 Jan 2005 17:16:46 -0800 (PST), ans <[EMAIL PROTECTED]> wrote:
> Hi,
> I am in the process of converting a webapp written
> using servlets in to struts actions.
> 
> When I open the browswer and when I enter into an
> action class for the first time, then my
> 'request.isRequestedSessionIdValid' is returning false
> Before calling the
> request.isRequestedSessionIdValid(),
> I perform request.getSession();
> 
> Subsequent times, it is returning true
> 
> What is going on here with
> request.isRequestedSessionIdValid()?
> 

If you read the precise semantics of isRequestedSessionValid(), you
will see that this behavior is exactly as it should be.

Consider the following timeline:

(A) Request 1 comes in:
- With no session id (because the session did not exist yet
- Calling request.getSession() creates a new session,
  but one that the client doesn't know about yet
- request.isRequestedSessionValid() returns false
- You render the page, including the session id

(B) Request 2 comes in
- With a session id
- Therefore request.isRequestedSessionValid() will return true

Craig


> Thanks
> -Aswath
> 
> Following is some simple code I am using for testing
> purpose
> public ActionForward execute(ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request, HttpServletResponse
> response)
> throws Exception {
> 
> String redirectPage = "GLOBAL_VIEWMANAGER_PAGE";
> // After successful User Login
> HttpSession session = request.getSession();
> session.setAttribute("test", "test");
> System.out.println ("isNew = " + session.isNew());
> System.out.println ("isRequestedSessionIdValid() = "
> + request.isRequestedSessionIdValid());
> return mapping.findForward(redirectPage);
> }
> }
> 
> __
> Do you Yahoo!?
> Yahoo! Mail - 250MB free storage. Do more. Manage less.
> http://info.mail.yahoo.com/mail_250
> 
> -
> 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]



isRequestedSessionIdValid is returning false for the first time

2005-01-05 Thread ans
Hi,
I am in the process of converting a webapp written
using servlets in to struts actions.

When I open the browswer and when I enter into an
action class for the first time, then my
'request.isRequestedSessionIdValid' is returning false
Before calling the
request.isRequestedSessionIdValid(),
I perform request.getSession();

Subsequent times, it is returning true

What is going on here with
request.isRequestedSessionIdValid()?

Thanks
-Aswath

Following is some simple code I am using for testing
purpose
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request, HttpServletResponse
response)
throws Exception {

String redirectPage = "GLOBAL_VIEWMANAGER_PAGE";
// After successful User Login
HttpSession session = request.getSession();
session.setAttribute("test", "test");
System.out.println ("isNew = " + session.isNew());
System.out.println ("isRequestedSessionIdValid() = "
+ request.isRequestedSessionIdValid());
return mapping.findForward(redirectPage);
}
}




__ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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



Re: Attributes Initialization

2005-01-05 Thread Cliff
Hi,

May be you can try to use the reset() in the Form.

Good Luck
Cliff

- Original Message - 
From: "elisegev1" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, January 06, 2005 3:12 AM
Subject: Attributes Initialization


> 
> I have a form that needs some initialization.  The form is derived 
> from DynaValidatorForm and its properties are defined in struts-
> config.xml.  I initialize an attribute in the 'execute' method of 
> my 'Action' class.  For some reason when the servlet container 
> creates the page for the first time, the Struts servlet does not call 
> the 'execute' method and consequently there is no attribute 
> initialization.  When I hit the 'submit' button, the 'execute' method 
> is called and the attribute is initialized correctly.  I think that 
> the problem is somewhere in re-direction, but I don't know where.  
> Can anyone suggest why the 'execute' is never called before the 
> initial display of the form? 
> 
> ---
> Eli Segev
> 
> 
> 
> 
> 
> -
> 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: Date validation another question

2005-01-05 Thread Manisha Sathe
Thanks for the reply, do not know why the same is not working properly for me 
but will try it out again.
 
regards
Manisha

Vaclavik Radek <[EMAIL PROTECTED]> wrote:
Hi,

this works fine for me (in validation.xml file). I see no problem with using
datePattern...

depends="required,date">


datePattern
dd.MM.



Radek

> -Original Message-
> From: Manisha Sathe [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 05, 2005 9:23 AM
> To: user@struts.apache.org
> Subject: Date validation another question
> 
> 
> Currently testing text box i/p for date. I do not want to 
> make use of "datePatternStrict" so i used "datePattern" but 
> still it is validating as per "datePatternStrict" only. It is 
> not accepting 1/1/2005 as i/p
> 
> Do i need to set anything else too ?
> 
> 
> 
> 
> -
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
> 


-
Do you Yahoo!?
 Yahoo! Mail - now with 250MB free storage. Learn more.

Re: Hmm... i will go crazy due to validation

2005-01-05 Thread Manisha Sathe
Thanks a lot Erik, a very good start for me.
 
regards
Manisha

Erik Weber <[EMAIL PROTECTED]> wrote:
This is not a direct answer to any of your questions but perhaps it will 
spur your thinking.

This is an example of using a custom ("pluggable") validator that makes 
sure a date entry is not only a real date, but that the date is within a 
desired range (seemingly you are wanting to do something similar to 
this). I wrote this for Struts 1.1. I don't know if there is something 
new and improved that would be better, but it works.

>From validation.xml (you'll see the use of the "date" rule -- which 
uses the "datePattern" variable, as well as my custom "dateRange" rule 
-- which uses the "minDate" and "maxDate" variables):




datePattern
MM/dd/


minDate
01/01/1900


maxDate
12/31/2030





>From validator-rules.xml:

classname="ValidationUtil"
method="validateDateRange"
methodParams="java.lang.Object,

org.apache.commons.validator.ValidatorAction,

org.apache.commons.validator.Field,

org.apache.struts.action.ActionErrors,

javax.servlet.http.HttpServletRequest"
depends="required"
msg="errors.dateRange"/>


And finally the source of ValidationUtil:


import javax.servlet.http.HttpServletRequest;

import java.util.Date;
import java.text.SimpleDateFormat;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.validator.Resources;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.commons.validator.GenericValidator;

public class ValidationUtil {

public static final String DEFAULT_FORM_DATE_PATTERN = "M/dd/";
public static final Date DEFAULT_MIN_DATE = getDefaultMinDate();
public static final Date DEFAULT_MAX_DATE = getDefaultMaxDate();

public static boolean validateDateRange(Object bean, ValidatorAction 
va, Field field, ActionErrors errors, HttpServletRequest request) {
//if we're not properly configured to parse dates,
//all date validation will fail
if (DEFAULT_MIN_DATE == null || DEFAULT_MAX_DATE == null) return false;
try {
String value = ValidatorUtil.getValueAsString(bean, 
field.getProperty());
Date date = getDate(value, DEFAULT_FORM_DATE_PATTERN);
Date minDate = getDate(field.getVarValue("minDate"), 
DEFAULT_FORM_DATE_PATTERN);
Date maxDate = getDate(field.getVarValue("maxDate"), 
DEFAULT_FORM_DATE_PATTERN);
if (date.compareTo(minDate) < 0 || date.compareTo(maxDate) > 0) {
errors.add(field.getKey(), Resources.getActionError(request, va, 
field));
return false;
}
return true;
}
catch (Exception e) {
e.printStackTrace();
errors.add(field.getKey(), Resources.getActionError(request, va, 
field));
return false;
}
}

protected static Date getDate(String dateString, String pattern) {
Date date = null;
try {
SimpleDateFormat df = new SimpleDateFormat(pattern);
date = df.parse(dateString);
}
catch (Exception e) {
e.printStackTrace();
}
return date;
}

protected static Date getDefaultMinDate() {
return getDate("01/01/1900", DEFAULT_FORM_DATE_PATTERN);
}

protected static Date getDefaultMaxDate() {
return getDate("12/31/2030", DEFAULT_FORM_DATE_PATTERN);
}

}


Maybe you should browse the Struts wiki (wiki.apache.org/struts) for 
example links?

Hope that helps some,

Erik

P.S. I never had much luck with DatePatternStrict, always wondered if it 
was buggy . . . But I guess others are using it successfully?



Manisha Sathe wrote:

>I am testing struts validatior in one test program. Finally i could do some 
>date validation for user i/p. I could get javascript pop-up if i enter it 
>wrongly.
> 
>i wanted to test server side validation - so i switched off javascript and 
>tried to submit - it went through w/o throwing any error.
> 
>Now again pls help me, what i am missing out ? I am using something like 
>(instead of ActionForm)
> 
>public class MyForm extends ValidatorForm {
> 
>
> 
>}
> 
>inside my formbean
> 
>regards
>Manisha
>
>__
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
> 
>

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



-
Do you Yahoo!?
 Meet the all-new My Yahoo! – Try it today! 

Re: Security question

2005-01-05 Thread Sylvain Colomer
I had quite a similar problem, but I didn't wanted to put security 
related code into my actions codes. I did that way:
- I created a new Digester RuleSet (declared in web.xml: "rulesets" 
init-param of Struts servlet) to extend Struts configuration 
(struts-config.xml) file with specific security tags, my actions 
declarations looked like this:


   
  
  ...
   

- I created a new RequestProcessor (extending 
org.apache.struts.action.RequestProcessor) overriding  processRoles to 
handle the security checks.

Barnett, Brian W. wrote:
Well, I guess I'll proceed with that. Thank you.
-Original Message-
From: Chaikin, Yaakov Y. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 04, 2005 1:55 PM
To: 'Struts Users Mailing List'
Subject: RE: Security question

I don't know of any other way than to programmatically check user's role
inside your Action's method. There is no way to specify attributes in the
 of the . It just doesn't support such
pattern matching.
Yaakov.
-Original Message-
From: Jim Barrows [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 04, 2005 1:30 PM
To: Struts Users Mailing List
Subject: RE: Security question
 

-Original Message-
From: Barnett, Brian W. [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 04, 2005 11:04 AM
To: 'Struts Users Mailing List'
Subject: Security question
I'm using LookupDispatchAction and role-based security. I
want to allow
certain roles to access certain dispatches of an action. I'm
not sure what
the best way to handle this is.
Should I create separate Action classes? Is there a slick way
to specify
"dispatch level" security in web.xml?
   

The container managed security is handled by URL.  Which might include
parameters.
If not you'll have to use one of the dispatch that requires a seperate URL
to do this.
Alternatively you'll have to put the security checks inside each method.
 

Can someone point me to a good article(s) on using role-based
security in a
struts app that might address these issues?
Thanks,
Brian
-
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]
-
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]


Attributes Initialization

2005-01-05 Thread elisegev1

I have a form that needs some initialization.  The form is derived 
from DynaValidatorForm and its properties are defined in struts-
config.xml.  I initialize an attribute in the 'execute' method of 
my 'Action' class.  For some reason when the servlet container 
creates the page for the first time, the Struts servlet does not call 
the 'execute' method and consequently there is no attribute 
initialization.  When I hit the 'submit' button, the 'execute' method 
is called and the attribute is initialized correctly.  I think that 
the problem is somewhere in re-direction, but I don't know where.  
Can anyone suggest why the 'execute' is never called before the 
initial display of the form? 

---
Eli Segev





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



Re: [OT] WinCVS problem (free beer!)

2005-01-05 Thread Frank W. Zammetti
Indirectly I've thought about it... A lot of guys are using WASD at 
work, which is of course Eclipse-based, but I've been resisting.  I've 
used a number of IDEs over the years, and I've always found that they 
get in my way far more than they help.  That's just me, but it's been my 
experience.  At this point I have such a refined work style between 
UltraEdit and Tomcat that I can actually work more efficiently overall 
than with any IDE I've tried (and I have actually spent some time 
playing with WSAD, and it doesn't seem to be any different in terms of 
that).  They don't call me the Batch File King (tm) at work for nothin' :)

FYI, I'm trying to let WinCVS run it's course right now as per Glenn's 
suggestion.  I also tried hitting escape as Matt suggested, but it 
didn't unfreeze it, so it wouldn't appear to be that problem (plus I'm 
not seeing any drive activity, which I'd expect to see if it was doing 
what Glenn suggested).

It's weird, I can move the window around no problem, but I can't do 
anything with any part of the interface (and large parts of the 
interface get "erased" when I move any window over it, typical Windows 
frozen app syndrom)

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
David G. Friedman wrote:
Frank,
Ever think of using Eclipse (v3.X) ?  I use it for Java/Struts/Tomcat (Via
the Sysdeo plug-in) development and it includes a built-in CVS client.
Add-ons also allow for SVN.
Regards,
David Friedman / [EMAIL PROTECTED]
-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 05, 2005 5:11 PM
To: Commons User; Struts User
Subject: [OT] WinCVS problem (free beer!)
Ok, no free beer, I lied ;)  Got your attention though!
I'm just now trying to use CVS for the first time, and I'm having a
problem I haven't been able to figure out, and I'm sure at least some of
you here are using WinCVS, so I hope no one minds an OT question (FYI, I
couldn't find a WinCVS support forum)...
I've installed WinCVS 1.3 (the latest from the WinCVW.org site,
downloaded today) on Windows XP.  I haven't however installed Python or
TCL, as they are optional.  The install went fine.
But, when I try to run it, it freezes.  I see the splash screen, and the
popup mentioning Python.  I click OK, and it's just frozen, can't do
anything.  I can close it via right-clicking the taskbar item, but
nothing else.  It works on my work PC by the way, although I can't do
anything with it there because of firewall restrictions, so I really
need it working at home.
I've checked to be sure the CvsNT and CvsNT Locking services are
running, and they are (not even sure that's necassery, but still).  I've
spent 30 minutes or so Googling for an answer but haven't had any luck.
Any ideas from anyone around here?  Again, sorry for the OT post, but I
couldn't resist tapping the expertise of these lists.  Thanks a lot!
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
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: [OT] struts jsp tags or jstl tags..equivalent taglibs for

2005-01-05 Thread Ashish Kulkarni
Hi
is there a equivalent tag library in jstl for  wrote:

> This document
> (http://struts.apache.org/faqs/struts-el.html) talks
> about 
> the Struts-EL tag library, that is a port of some of
> the Struts tags to 
> use the new JSP expression language.  More relevant
> to your question, it 
>   has a pretty good list of those Struts tags
> (mostly from the bean: and 
> logic: libraries) that provide the same
> functionality that is provided 
> by the JSTL.
> 
> I would use JSTL wherever you can, but the html:
> library, for one, 
> includes some pretty good Struts-specific
> functionality you won't find 
> in the JSTL.
> 
> -- Jeff
> 
> Ashish Kulkarni wrote:
> 
> > Hi
> > I am working on a project, need some suggestion on
> > using tag library
> > which do i use struts or jstl?
> > what is the difference , do jstl be to replace
> >  tag of struts
> > 
> > Ashish
> > 
> > 
> > 
> > __ 
> > Do you Yahoo!? 
> > Yahoo! Mail - now with 250MB free storage. Learn
> more.
> > http://info.mail.yahoo.com/mail_250
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 




__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

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



RE: [OT] WinCVS problem (free beer!)

2005-01-05 Thread David G. Friedman
Frank,

Ever think of using Eclipse (v3.X) ?  I use it for Java/Struts/Tomcat (Via
the Sysdeo plug-in) development and it includes a built-in CVS client.
Add-ons also allow for SVN.

Regards,
David Friedman / [EMAIL PROTECTED]

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 05, 2005 5:11 PM
To: Commons User; Struts User
Subject: [OT] WinCVS problem (free beer!)


Ok, no free beer, I lied ;)  Got your attention though!

I'm just now trying to use CVS for the first time, and I'm having a
problem I haven't been able to figure out, and I'm sure at least some of
you here are using WinCVS, so I hope no one minds an OT question (FYI, I
couldn't find a WinCVS support forum)...

I've installed WinCVS 1.3 (the latest from the WinCVW.org site,
downloaded today) on Windows XP.  I haven't however installed Python or
TCL, as they are optional.  The install went fine.

But, when I try to run it, it freezes.  I see the splash screen, and the
popup mentioning Python.  I click OK, and it's just frozen, can't do
anything.  I can close it via right-clicking the taskbar item, but
nothing else.  It works on my work PC by the way, although I can't do
anything with it there because of firewall restrictions, so I really
need it working at home.

I've checked to be sure the CvsNT and CvsNT Locking services are
running, and they are (not even sure that's necassery, but still).  I've
spent 30 minutes or so Googling for an answer but haven't had any luck.

Any ideas from anyone around here?  Again, sorry for the OT post, but I
couldn't resist tapping the expertise of these lists.  Thanks a lot!

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


-
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: [OT] WinCVS problem (free beer!)

2005-01-05 Thread Matt Bathje
Glenn Wilson wrote:
Hi Frank,
I've run into this problem before myself.  The problem I ran into was caused by 
the focus of my directory browser (that left-hand side browsing area) being on 
the root directory (C:\), and I had it set to recursively display all files in 
the file browser (that right-hand side listing) -- so it was trying to display 
my entire hard drive and its status, or lack thereof, in CVS!
You may be having a different problem, but you may want to check that your 
recursive-display (View -> Flat Mode?, i believe)  You may have to wait until 
it's done crunching to change the setting, though.
If this is the problem, hitting the ESC key will bypass the loading and 
allow you to change the settings without having to wait.

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


RE: [OT] WinCVS problem (free beer!)

2005-01-05 Thread Glenn Wilson
Hi Frank,

I've run into this problem before myself.  The problem I ran into was caused by 
the focus of my directory browser (that left-hand side browsing area) being on 
the root directory (C:\), and I had it set to recursively display all files in 
the file browser (that right-hand side listing) -- so it was trying to display 
my entire hard drive and its status, or lack thereof, in CVS!

You may be having a different problem, but you may want to check that your 
recursive-display (View -> Flat Mode?, i believe)  You may have to wait until 
it's done crunching to change the setting, though.

Regards,
Glenn

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 05, 2005 2:11 PM
To: Commons User; Struts User
Subject: [OT] WinCVS problem (free beer!)


Ok, no free beer, I lied ;)  Got your attention though!

I'm just now trying to use CVS for the first time, and I'm having a 
problem I haven't been able to figure out, and I'm sure at least some of 
you here are using WinCVS, so I hope no one minds an OT question (FYI, I 
couldn't find a WinCVS support forum)...

I've installed WinCVS 1.3 (the latest from the WinCVW.org site, 
downloaded today) on Windows XP.  I haven't however installed Python or 
TCL, as they are optional.  The install went fine.

But, when I try to run it, it freezes.  I see the splash screen, and the 
popup mentioning Python.  I click OK, and it's just frozen, can't do 
anything.  I can close it via right-clicking the taskbar item, but 
nothing else.  It works on my work PC by the way, although I can't do 
anything with it there because of firewall restrictions, so I really 
need it working at home.

I've checked to be sure the CvsNT and CvsNT Locking services are 
running, and they are (not even sure that's necassery, but still).  I've 
spent 30 minutes or so Googling for an answer but haven't had any luck.

Any ideas from anyone around here?  Again, sorry for the OT post, but I 
couldn't resist tapping the expertise of these lists.  Thanks a lot!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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


===
This email message is for the sole use of the intended recipient(s) and may 
contain confidential and privileged information. Any unauthorized review, use, 
disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message. If you are the intended recipient, please be advised that 
the content of this message is subject to access, review and disclosure by the 
sender's Email System Administrator.


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



[OT] WinCVS problem (free beer!)

2005-01-05 Thread Frank W. Zammetti
Ok, no free beer, I lied ;)  Got your attention though!
I'm just now trying to use CVS for the first time, and I'm having a 
problem I haven't been able to figure out, and I'm sure at least some of 
you here are using WinCVS, so I hope no one minds an OT question (FYI, I 
couldn't find a WinCVS support forum)...

I've installed WinCVS 1.3 (the latest from the WinCVW.org site, 
downloaded today) on Windows XP.  I haven't however installed Python or 
TCL, as they are optional.  The install went fine.

But, when I try to run it, it freezes.  I see the splash screen, and the 
popup mentioning Python.  I click OK, and it's just frozen, can't do 
anything.  I can close it via right-clicking the taskbar item, but 
nothing else.  It works on my work PC by the way, although I can't do 
anything with it there because of firewall restrictions, so I really 
need it working at home.

I've checked to be sure the CvsNT and CvsNT Locking services are 
running, and they are (not even sure that's necassery, but still).  I've 
spent 30 minutes or so Googling for an answer but haven't had any luck.

Any ideas from anyone around here?  Again, sorry for the OT post, but I 
couldn't resist tapping the expertise of these lists.  Thanks a lot!

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[OT] Approach to validation across browser versions

2005-01-05 Thread David Suarez

I may be working on a small privileged applet soon and the requirement
is to ensure that it will work across various browsers/platforms
(Mac/IE, PC/IE, Opera, etc. etc...).  Since Java is pretty standardized
I don't foresee any big issues with the testing if I use 1.3 and set the
appropriate applet parameters.  I would guess it's possible something
may come up that is not supported for one reason or another on some
platform combination though and would need to test them to be sure.  

Is there a place on the web or otherwise that will test different
versions for me?  What's the approach folks here use for this to debug
on different platforms?  I am guessing I will need to obtain access to
the necessary platforms only in the case of failure and that's probably
a whole different issue.  Does anyone have any ideas?

I'm just looking ahead right now in case the project is approved and
hoping there is already a service that does this.

Your help is greatly appreciated.

Thanks!...djsuarez  



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



Re: Does not STRUTS handle escape characters

2005-01-05 Thread Isteyaque Zahur
Hi

If u want to escape characters in JSP use  taglibs provided by
jakarta(ie http://jakarta.apache.org/taglibs/doc/string-doc/index.html#escape)
 and  if u want to escape  String in java classes use  commons-lang
package (api refeence is
http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html)

bye
Isteyaque


On Wed, 5 Jan 2005 21:42:02 +0530, Krishna Mohan Radhakrishnan
<[EMAIL PROTECTED]> wrote:
> 
> Hi all,
> This is a javascript function that is being called when a button called
> "Update" is pressed.
> 
> Now if the planTitle or verbalDescription has got any apostrophe(') then
> it is throwing up a javascrit error that ) is expected.
> 
> Does not struts handle these type of characters like ',",/ etc.
> 
> Does anybody has a solution to the problem?
> 
> Regards,
> Krishna Mohan R
> 
> -
> 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: Does not STRUTS handle escape characters

2005-01-05 Thread fzlists
To the best of my knowledge, struts does NOT handle this.  I have faced this 
issue, as I'm sure many have.  Here's the code I use to solve it... This is 
simply a static method of a Helpers class I reuse throughout most of my 
projects... I don't for a second claim it is the best answer, but it does work 
for me...


  /**
   * This method makes a string "safe" for use in JScript.  That means that
   * aspostrophes, quotes and hard linebreaks are replaced with the
   * corresponding escape sequences.  This is important because many strings
   * passed back to the GUI are inserted into JScript string.  If the text
   * that is inserted contains quotes, apostrophes or line breaks, it will
   * almost certainly break the JScript code.  This method should be called on
   * any string going back to the GUI.  This method also trims the string.
   *
   * @param   inString is the string to make "safe"
   * @return  A string with escape sequences
   */
  public static String jsSafeString(String inString) {

if (inString != null) {

  // Trivial rejection: If a quick indexOf doesn't find any quotes,
  // apostrophes or carriage return/linefeeds, no need to do the rest
  // of the work
  if (inString.indexOf("'")   == -1 && inString.indexOf("\"") == -1 &&
  inString.indexOf("\r")  == -1 && inString.indexOf("\n") == -1) {

  return inString; // Just return the string as-is in this case

  } else { // Must have found at least one of those characters...

// If there are carriage return/linefeeds in the output data, convert 
them to \r\n
// Note that the following commented line was the original, preffered 
method of doing this,
// but the replaceAll() method of String is apparently new to JDK 1.4, 
and since the
// server this was originally run on was only at JDK 1.3.1, the 
following kludge was
// used in place of the replaceAll() method.  If this is ever run on a 
server at level
// 1.4 or higher, this whole mess should probably be deleted and the 
following commented
// line should be activated instead...
// return workString.replaceAll("\r\n", "rn"));
String workString = inString.trim();
StringBuffer outString= new StringBuffer(workString.length() * 
2);
byte[]   workStringBytes  = workString.getBytes(); // Get byte 
array based on input string

// Begin scanning the byte array looking for "unsafe" data to escape
int i = 0;
while (i < workStringBytes.length) {
  if (workStringBytes[i] == '\r' && workStringBytes[i + 1] == '\n') { 
// Carriage Return + Linefeed
outString.append("\\r\\n"); // Append the correct escape sequence
i = i + 2; // Move two bytes forward in the source array
  } else if (workStringBytes[i] == '\'' && (i == 0 || (i > 0 && 
workStringBytes[i-1] != 92))) { // Apostrophe that isn't already escaped
outString.append("\\'"); // Append the correct escape sequence
i = i + 1; // Move to the next byte in the source array
  } else if (workStringBytes[i] == '\"' && (i == 0 || (i > 0 && 
workStringBytes[i-1] != 92))) { // Quotation Mark that isn't already escaped
outString.append("\\\""); // Append the correct escape sequence
i = i + 1; // Move to the next byte in the source array
  } else if (workStringBytes[i] == '\\' && (i == 0 || (i > 0 && 
workStringBytes[i-1] != 92))) { // Backslash that isn't already escaped
outString.append(""); // Append the correct escape sequence
i = i + 1; // Move to the next byte in the source array
  } else { // Any other chaacter
// Or if it's not carriage return/linefeed, just append the actual 
byte and move on...
outString.append((char)workStringBytes[i]);
i = i + 1; // Move to the next byte in the source array
  }
}

// All done, return the final string
return outString.toString().trim();

  }

} else { // inString was NULL

  return "";

}

  } // End safeString()


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, January 5, 2005 11:12 am, Krishna Mohan Radhakrishnan said:
> 
> Hi all,
> This is a javascript function that is being called when a button called
> "Update" is pressed.
> 
> Now if the planTitle or verbalDescription has got any apostrophe(') then
> it is throwing up a javascrit error that ) is expected.
> 
> Does not struts handle these type of characters like ',",/ etc.
> 
> Does anybody has a solution to the problem?
> 
> Regards,
> Krishna Mohan R
> 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To

Re: Does not STRUTS handle escape characters

2005-01-05 Thread fzlists
Wasn't sure this posted the first time, apologies if this winds up a 
double-post...

To the best of my knowledge, struts does NOT handle this.  I have faced this 
issue, as I'm sure many have.  Here's the code I use to solve it... This is 
simply a static method of a Helpers class I reuse throughout most of my 
projects... I don't for a second claim it is the best answer, but it does work 
for me...


  /**
   * This method makes a string "safe" for use in JScript.  That means that
   * aspostrophes, quotes and hard linebreaks are replaced with the
   * corresponding escape sequences.  This is important because many strings
   * passed back to the GUI are inserted into JScript string.  If the text
   * that is inserted contains quotes, apostrophes or line breaks, it will
   * almost certainly break the JScript code.  This method should be called on
   * any string going back to the GUI.  This method also trims the string.
   *
   * @param   inString is the string to make "safe"
   * @return  A string with escape sequences
   */
  public static String jsSafeString(String inString) {

if (inString != null) {

  // Trivial rejection: If a quick indexOf doesn't find any quotes,
  // apostrophes or carriage return/linefeeds, no need to do the rest
  // of the work
  if (inString.indexOf("'")   == -1 && inString.indexOf("\"") == -1 &&
  inString.indexOf("\r")  == -1 && inString.indexOf("\n") == -1) {

  return inString; // Just return the string as-is in this case

  } else { // Must have found at least one of those characters...

// If there are carriage return/linefeeds in the output data, convert 
them to \r\n
// Note that the following commented line was the original, preffered 
method of doing this,
// but the replaceAll() method of String is apparently new to JDK 1.4, 
and since the
// server this was originally run on was only at JDK 1.3.1, the 
following kludge was
// used in place of the replaceAll() method.  If this is ever run on a 
server at level
// 1.4 or higher, this whole mess should probably be deleted and the 
following commented
// line should be activated instead...
// return workString.replaceAll("\r\n", "rn"));
String workString = inString.trim();
StringBuffer outString= new StringBuffer(workString.length() * 
2);
byte[]   workStringBytes  = workString.getBytes(); // Get byte 
array based on input string

// Begin scanning the byte array looking for "unsafe" data to escape
int i = 0;
while (i < workStringBytes.length) {
  if (workStringBytes[i] == '\r' && workStringBytes[i + 1] == '\n') { 
// Carriage Return + Linefeed
outString.append("\\r\\n"); // Append the correct escape sequence
i = i + 2; // Move two bytes forward in the source array
  } else if (workStringBytes[i] == '\'' && (i == 0 || (i > 0 && 
workStringBytes[i-1] != 92))) { // Apostrophe that isn't already escaped
outString.append("\\'"); // Append the correct escape sequence
i = i + 1; // Move to the next byte in the source array
  } else if (workStringBytes[i] == '\"' && (i == 0 || (i > 0 && 
workStringBytes[i-1] != 92))) { // Quotation Mark that isn't already escaped
outString.append("\\\""); // Append the correct escape sequence
i = i + 1; // Move to the next byte in the source array
  } else if (workStringBytes[i] == '\\' && (i == 0 || (i > 0 && 
workStringBytes[i-1] != 92))) { // Backslash that isn't already escaped
outString.append(""); // Append the correct escape sequence
i = i + 1; // Move to the next byte in the source array
  } else { // Any other chaacter
// Or if it's not carriage return/linefeed, just append the actual 
byte and move on...
outString.append((char)workStringBytes[i]);
i = i + 1; // Move to the next byte in the source array
  }
}

// All done, return the final string
return outString.toString().trim();

  }

} else { // inString was NULL

  return "";

}

  } // End safeString()


-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, January 5, 2005 11:12 am, Krishna Mohan Radhakrishnan said:
> 
> Hi all,
> This is a javascript function that is being called when a button called
> "Update" is pressed.
> 
> Now if the planTitle or verbalDescription has got any apostrophe(') then
> it is throwing up a javascrit error that ) is expected.
> 
> Does not struts handle these type of characters like ',",/ etc.
> 
> Does anybody has a solution to the problem?
> 
> Regards,
> Krishna Mohan R
> 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROT

RE: ActionForm automatic type conversion

2005-01-05 Thread Joe Germuska
Population of an ActionForm is done using Commons BeanUtils, which 
has a method for registering converter classes which convert strings 
to objects and back.

http://jakarta.apache.org/commons/beanutils/api/index.html
Specifically, the work is done by 
o.a.struts.util.RequestUtils.populate(...), which makes a call to the 
static form of o.a.c.beanutils.BeanUtils.populate:
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/BeanUtils.html#populate(java.lang.Object,%20java.util.Map)

The static form relies on Converter classes statically registered 
using o.a.c.beanutils.ConvertUtils.register(...):

http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/ConvertUtils.html#register(org.apache.commons.beanutils.Converter,%20java.lang.Class)
So basically, assuming that there's exactly one conversion path from 
string to your object, you need to register a converter at app 
startup using a ServletContextListener or Plugin class.

BeanUtils has since evolved to provide more nuanced conversions 
(particularly not requiring that converters be registered statically) 
but there hasn't been call to upgrade Struts to use this.  Date 
conversions are about the only place where I can see the need for 
multiple conversions from string to date in a single app.  Meanwhile, 
managing temporary or limited-scope converters might be pretty clumsy 
to implement.

Hope this helps
Joe

At 11:36 AM -0500 1/5/05, [EMAIL PROTECTED] wrote:
ActionForm attributes are defined as Strings. In your case, a good solution
would be to define an adapter class that will do the conversion from String
to the appropriate type. Your business objects will use the converted data
types to execute the business logic. This approach is discussed in detail in
the book Struts in Action.
Bala
-Original Message-
From: dsarris [mailto:[EMAIL PROTECTED]
Sent: Monday, January 03, 2005 4:16 AM
To: Struts Users Mailing List
Subject: ActionForm automatic type conversion
Hi all and happy new year,
I am trying to fill an ActionForm with values that are neither Strings
or primitives. The specified values are selected using the
 tag. This a sample of my JSP code:
   



   

   
   
The "controlPanelValues" Bean contains a collection (list) named
"athletes" containing Beans of type "Pair". The "Pair" object contains
2 attributes: The "name" which is a String and the value which is an
"Athlete" object.
My ActionForm contains an attribute named "selectedAthlete" of the
type "Athlete".
However, whenever I submit this form the "selectedAthlete"  is filled
with the string representation of the "Athlete" type.
I used both simple and map-backed actionform with no success.
Is Struts capable for doing assignment of non String or primitive fields?
Chipix
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Note:  The information contained in this email and in any attachments is
intended only for the person or entity to which it is addressed and may
contain confidential and/or privileged material.  Any review,
retransmission, dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other than the
intended recipient is prohibited.  The recipient should check this email and
any attachments for the presence of viruses.  Sender accepts no liability
for any damages caused by any virus transmitted by this email. If you have
received this email in error, please notify us immediately by replying to
the message and delete the email from your computer.  This e-mail is and any
response to it will be unencrypted and, therefore, potentially unsecure.
Thank you.  NOVA Information Systems, Inc.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Re: [OT] struts jsp tags or jstl tags

2005-01-05 Thread Jeff Beal
This document (http://struts.apache.org/faqs/struts-el.html) talks about 
the Struts-EL tag library, that is a port of some of the Struts tags to 
use the new JSP expression language.  More relevant to your question, it 
 has a pretty good list of those Struts tags (mostly from the bean: and 
logic: libraries) that provide the same functionality that is provided 
by the JSTL.

I would use JSTL wherever you can, but the html: library, for one, 
includes some pretty good Struts-specific functionality you won't find 
in the JSTL.

-- Jeff
Ashish Kulkarni wrote:
Hi
I am working on a project, need some suggestion on
using tag library
which do i use struts or jstl?
what is the difference , do jstl be to replace
 tag of struts
Ashish
		
__ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

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


[OT] struts jsp tags or jstl tags

2005-01-05 Thread Ashish Kulkarni
Hi
I am working on a project, need some suggestion on
using tag library
which do i use struts or jstl?
what is the difference , do jstl be to replace
 tag of struts

Ashish



__ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

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



Re: Does not STRUTS handle escape characters

2005-01-05 Thread Jeff Beal
To my knowledge, the escape mechanisms in the Struts custom tags only 
handle characters that have special significance in HTML textual 
content, not JavaScript.  It may only escape '&','<', and '>'.  If it 
does escape "'" and '"' (I think it does), it escapes them as ''' 
and '"' respectively, rather than "\'" and '\"' as JavaScript requires.

-- Jeff
Krishna Mohan Radhakrishnan wrote:
Hi all,
This is a javascript function that is being called when a button called
"Update" is pressed.
Now if the planTitle or verbalDescription has got any apostrophe(') then
it is throwing up a javascrit error that ) is expected.
Does not struts handle these type of characters like ',",/ etc.
Does anybody has a solution to the problem?
Regards,
Krishna Mohan R

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


RE: ActionForm automatic type conversion

2005-01-05 Thread Bala . Paranj
ActionForm attributes are defined as Strings. In your case, a good solution
would be to define an adapter class that will do the conversion from String
to the appropriate type. Your business objects will use the converted data
types to execute the business logic. This approach is discussed in detail in
the book Struts in Action.

Bala

-Original Message-
From: dsarris [mailto:[EMAIL PROTECTED]
Sent: Monday, January 03, 2005 4:16 AM
To: Struts Users Mailing List
Subject: ActionForm automatic type conversion


Hi all and happy new year,

I am trying to fill an ActionForm with values that are neither Strings
or primitives. The specified values are selected using the
 tag. This a sample of my JSP code:

   




   

   
   

The "controlPanelValues" Bean contains a collection (list) named
"athletes" containing Beans of type "Pair". The "Pair" object contains
2 attributes: The "name" which is a String and the value which is an
"Athlete" object.

My ActionForm contains an attribute named "selectedAthlete" of the
type "Athlete".

However, whenever I submit this form the "selectedAthlete"  is filled
with the string representation of the "Athlete" type.

I used both simple and map-backed actionform with no success. 

Is Struts capable for doing assignment of non String or primitive fields?

Chipix

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

Note:  The information contained in this email and in any attachments is
intended only for the person or entity to which it is addressed and may
contain confidential and/or privileged material.  Any review,
retransmission, dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other than the
intended recipient is prohibited.  The recipient should check this email and
any attachments for the presence of viruses.  Sender accepts no liability
for any damages caused by any virus transmitted by this email. If you have
received this email in error, please notify us immediately by replying to
the message and delete the email from your computer.  This e-mail is and any
response to it will be unencrypted and, therefore, potentially unsecure.
Thank you.  NOVA Information Systems, Inc.

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



Re: New to Struts & seeking advice

2005-01-05 Thread Derek Broughton
On Tuesday 04 January 2005 12:55, Jim Barrows wrote:
> > From: Mark McWiggins [mailto:[EMAIL PROTECTED]
>
> > *Is AppFuse worth using as a basis for a real app? I tried
> > working through the tutorial and got it going,
> >   but it is based on Hibernate and I was told that
> > Hibernate may not be mature enough for deployment?
>
> I don't know who told you either of those, but both statement are wrong. 
> AppFuse can use Hibernate, iBatis or JDBC.  Says so right on the box. 
> Hibernate is more then mature enough for deploymnet.  Matt Raible uses both
> appfuse and Hibernate for his production projects.

Matt Raible _is_ AppFuse, isn't he?  I started out a week ago with Matt's 
SpringLive tutorial and think I have Hibernate jumping through the hoops now.  
It works great.
>
> > *   Any other tools or techniques that you fervently recommend or
> > recommend avoiding?
>
> Appfuse is nice if you want something that is IDE agnostic. 

Yeah, I plugged it right into JDeveloper.

> Spring is massively cool for wiring everything together.

It is!  It took me quite some time to figure out why I would want to use it, 
because it's so "behind the scenes" you can't see what it's doing.

> Avoid Java on the AS400 in general.

Come on, Jim, you know you really wanted to say  "Avoid the AS400 in 
general." :-)
-- 
derek

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



Re: [STRUTS] Another n00b Q - Selecting from dropdown & show view

2005-01-05 Thread fzlists
Depends... Do you want this all to happen on the client only, or do you want a 
round-trip to the server?

If client-only, just wrap the optional elements in a  tag, then use the 
onChange event of the  element to show the appropriate group (you'll 
need to hide eerything else of course... I usually just hide everything and 
then show the appropriate ).  So, for instance:

test

  function showOptionals(obj) {
div1.style.display = "none";
div2.style.display = "none";
obj = eval(obj.value);
obj.style.display = "block";
  }




  
User
Admin
  
  
  

  
  

  




If you don't want to do it via scripting, then you submit the form as a result 
of onChange of the select, and in your JSP code you change the style of the 
appropriate  based on the option selected, something like:

<%
  String div1Style = "display:none;";
  String div2Style = "display:none;";
  String whatGroup = (String)request.getParameter("theSelect");
  if (whatGroup.equalsIgnoreCase("div1")) {
div1Style = "display:block;";
  }
  if (whatGroup.equalsIgnoreCase("div2")) {
div2Style = "display:block;";
  }
%>
test



  
User
Admin
  
  
  ">

  
  

  




Roughly anyway... I haven't tested this, might be some minor problems, but you 
get the general idea.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, January 5, 2005 11:04 am, Ritchie Warsito said:
> hi there.
> If I were to have a dropdown select (which I don't know yet also how to
> populate from database), and I select an option say User.
> I want something (part of a form or such) to show.
> 
> Example:
> Adding useraccounts. There are 3 roles, User, Admin & Office.
> Field Username, Password, Re-Enter Password and Role are common.
> Based on what I choose in the Role select dropdown, below that there
> will come another field or fields.
> So for User, another field (or table of fields) will show where to add
> his different Customer ID's.
> For Office, another field will show for let's say his Office ID.
> 
> How can I accomplish this? I'm sorry if I ask stupid questions, but
> because of my experience with PHP only where these things are possible I
> really would like to have them in jsp/struts too.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, January 5, 2005 11:04 am, Ritchie Warsito said:
> hi there.
> If I were to have a dropdown select (which I don't know yet also how to
> populate from database), and I select an option say User.
> I want something (part of a form or such) to show.
> 
> Example:
> Adding useraccounts. There are 3 roles, User, Admin & Office.
> Field Username, Password, Re-Enter Password and Role are common.
> Based on what I choose in the Role select dropdown, below that there
> will come another field or fields.
> So for User, another field (or table of fields) will show where to add
> his different Customer ID's.
> For Office, another field will show for let's say his Office ID.
> 
> How can I accomplish this? I'm sorry if I ask stupid questions, but
> because of my experience with PHP only where these things are possible I
> really would like to have them in jsp/struts too.
> 
> -
> 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]

Does not STRUTS handle escape characters

2005-01-05 Thread Krishna Mohan Radhakrishnan

Hi all,
This is a javascript function that is being called when a button called
"Update" is pressed.

Now if the planTitle or verbalDescription has got any apostrophe(') then
it is throwing up a javascrit error that ) is expected.

Does not struts handle these type of characters like ',",/ etc.

Does anybody has a solution to the problem?

Regards,
Krishna Mohan R





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



Re: New to Struts & seeking advice

2005-01-05 Thread bryan
Hibernate is mature because it works, unlike "mature" EJB,

--b


On Tue, 4 Jan 2005 09:55:34 -0700, Jim Barrows <[EMAIL PROTECTED]> wrote:
> 
> 
> > -Original Message-
> > From: Mark McWiggins [mailto:[EMAIL PROTECTED]
> > Sent: Monday, January 03, 2005 6:19 PM
> > To: user@struts.apache.org
> > Subject: New to Struts & seeking advice
> >
> >
> > Hi All,
> >
> > I've developed several web applications over the last 10
> > years, mostly
> > based on Perl CGI. The 2003 project I did
> > made me swear off CGI and look for something that does a
> > better job of
> > maintaining session and data across pages,
> > among other things. Struts seems to fit the bill.
> >
> > But: what's a recommended set of tools to use? I've been
> > working a bit
> > with Netbeans 4.0 on sample applications and
> > it does a fine job building a .WAR file for deployment. But
> > it doesn't
> > seem to have enough smarts to see when something
> > is broken enough that Tomcat (v 5.0.28) chokes on it with an
> > unhelpful
> > error message. Also, I tried installing the Struts Console
> > into this version of Netbeans and got:
> >
> > Warning - could not install some modules:
> >Struts Console - No module providing the capability
> > org.openide.compiler.CompilationEngine could be found.
> >Struts Console - No module providing the capability
> > org.openide.TopManager could be found.
> >Struts Console - The module named org.openide.deprecated was
> > needed and not found.
> >Struts Console - The module named org.openide.compiler
> > was needed
> > and not found.
> >Struts Console - The module named
> > org.openide.execution.deprecated was needed and not found.
> >
> > So:
> >
> > *Is Eclipse or something else clearly better and more
> > Struts-capable?
> 
> I like Eclipse with the MyEclipse plug-ins for struts.  I also use the spring 
> plugin, and I forget which of the hibernate plugins as well.  Commonclipse is 
> one of those plugins in you thinks you'll never use until you install it, 
> hten you wonder why it wasn't made part of Eclipse.
> 
> 
> > *Is AppFuse worth using as a basis for a real app? I tried
> > working through the tutorial and got it going,
> >   but it is based on Hibernate and I was told that
> > Hibernate may
> > not be mature enough for deployment?
> 
> I don't know who told you either of those, but both statement are wrong.  
> AppFuse can use Hibernate, iBatis or JDBC.  Says so right on the box.  
> Hibernate is more then mature enough for deploymnet.  Matt Raible uses both 
> appfuse and Hibernate for his production projects.
> 
> > *   Any other tools or techniques that you fervently recommend or
> > recommend avoiding?
> 
> Appfuse is nice if you want something that is IDE agnostic.  Spring is 
> massively cool for wiring everything together.
> Avoid Websphere on the AS400 (can't tell you about Websphere on any other 
> platform).  Avoid Java on the AS400 in general.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
http://www.revoltingdigits.com
https://jestate.dev.java.net

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



[STRUTS] Another n00b Q - Selecting from dropdown & show view

2005-01-05 Thread Ritchie Warsito
hi there.
If I were to have a dropdown select (which I don't know yet also how to 
populate from database), and I select an option say User.
I want something (part of a form or such) to show.

Example:
Adding useraccounts. There are 3 roles, User, Admin & Office.
Field Username, Password, Re-Enter Password and Role are common.
Based on what I choose in the Role select dropdown, below that there 
will come another field or fields.
So for User, another field (or table of fields) will show where to add 
his different Customer ID's.
For Office, another field will show for let's say his Office ID.

How can I accomplish this? I'm sorry if I ask stupid questions, but 
because of my experience with PHP only where these things are possible I 
really would like to have them in jsp/struts too.

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


Re: I8N - Locale switch on any page

2005-01-05 Thread Ritchie Warsito
Jim Barrows wrote:
 

-Original Message-
From: Ritchie Warsito [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 04, 2005 4:36 AM
To: Struts Users Mailing List
Subject: I8N - Locale switch on any page
Hey there,
I'm studying the struts-mailreader example and as some of you 
might know 
(I hope), you have the option to switch languages (different 
ApplicationResources).
The thing is, and I've read this on many other sites that this is the 
common way to do it, is that the locale options are only on the first 
(welcome) page, and from there on the selected locale will be used.

I want these options on every page throughout my application and when 
selecting, it will return to the page where you selected it 
from. With 
PHP i know how to do this, but this whole JSP/Struts is new for me.
So is this possible and more importantly how?
   

Of course it's possible. JSP/Struts is more capable then PHP.  Question is why?  Most browsers provide locale, which struts uses to do the i18n for you.  Much easier.  See Java's I18N tutorial, and Struts/JSTL I18N tutorial for details.
In answer to your question.. how did you do it in PHP?  probably some sort of link and back to the page.  You could create a link with the current page as a parameter.  The action would set the locale chosen, and return to the parameter.  

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

About the php way, you're right, my url would look something like 
xxx.php?language=en&pageid=2 or something.
The strutsmailreader has a page parameter in its action class, but it's 
not really clear to me how it's used. Looking at the struts config it 
just says when doing the Locale action (with a global forward as a 
parameter), it just returns to that global forward which is the welcome 
page where the locale options are.
So in this example you HAVE to choose the language at the first page.

So does anyone have an example maybe on how to accomplish what I want?
Tnx
Ritchie
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Character encoding problems after 1.1 to 1.2.4 upgrade

2005-01-05 Thread J. Patterson Waltz III
in article [EMAIL PROTECTED], Josh Cronemeyer at [EMAIL PROTECTED] wrote
on 4/01/05 18:02:

> J. Patterson Waltz III wrote:
> 
>> Merci Guillaume,
>> 
>> I had actually seen the references to the Filter solution in the comments of
>> Struts bug 16191 in Bugzilla:
>> http://issues.apache.org/bugzilla/show_bug.cgi?id=16191
>> 
>> I will try that out and see if it improves my results.
>> 
>> I remain perplexed at what changes between versions 1.1 and 1.2.4 of Struts
>> caused it to become susceptible to this problem. Any ideas on that?
>> 
>> Patterson
>> 
>> P.S. - I know how to view the headers of replies sent from the server to the
>> browser, but am not sure how to get at those sent from the browser to the
>> server, to make sure that they are indeed UTF-8. Any suggestions?
>> 
>> in article [EMAIL PROTECTED], Guillaume Cottenceau at [EMAIL PROTECTED]
>> wrote on 4/01/05 16:40:
>> 
>>> Most probably the browser is sending data in UTF-8 but doesn't say so with
>>> charset= in the Content-Type header. If you're confident enough that the
>>> browsers will send UTF-8 (which should be the case if they are encoded in
>>> UTF-8 and you use accept-charset in the forms), you can use a filter which
>>> forces the HTTP request to be seen as UTF-8 in input (for example
>>> filters/SetCharacterEncodingFilter which is bundled with tomcat)[1].
>>> 
>>> 
>> 
> One way woulb be to set up a proxy that your browser uses to connect to the
> web.  I used to use web scarab.  http://www.owasp.org/software/webscarab.html
> 
> -josh
> 
I still haven't figured out the solution to my problem, but I have figured
out one *cause* of it.

After using web scarab at Josh's suggestion to eavesdrop on the
conversations between my browser and app server, I've figured out what has
changed between Struts 1.1 and 1.2.4:

Struts 1.1 in spite of the the <%@ page pageEncoding="UTF-8"
contentType="text/html;charset=UTF-8" language="java" %> directive, Struts
was in fact sending back pages encoded in ISO-8859-1, and the resulting form
submissions were URL-encoded (and decoded) in the same format.

Struts 1.2.4 the directive is now being followed, and pages are sent out in
UTF-8 encoding. However, for some reason, the form data is not being decoded
as UTF-8, but still as ISO-8859-1.

This suggests to me that if I were to remove the contentType directive in
Struts 1.2.4, it would fall back to the default ISO-8859-1 encoding, and all
would work as before: except that my web application would then be
constrained to using only characters representable in that encoding.



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



Re: Validate a field only if a checkbox is checked

2005-01-05 Thread jecrotea
This is simply to enable and disable filters. The users don't want to write
something to search with a criteria, then erase it, search something else
and then rewrite the first thing he entered.

-

Jean-Francois Croteau
Services Informatiques
IBM Canada Ltée (Bromont)




   
 Wendy Smoak   
 <[EMAIL PROTECTED] 
 com>   To
   Struts Users Mailing List   
 2005-01-04 16:53  
cc
   
 Please respond to Subject
   "Struts Users   Re: Validate a field only if a  
   Mailing List"   checkbox is checked 
   
   
   
   
   
   




From: <[EMAIL PROTECTED]>
> The validation is more axed around the date format... I want to validate
> the date format ONLY if the user checked the checkbox to active the
filter
> on that date.

>From a user interface perspective, the checkbox is redundant.  If they want
to give you a date, they fill in the date field.  If not, they don't.  Why
make them check a box AND fill in a date?

--
Wendy Smoak


-
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: Help : Thanks Joe : execute a equation in String format

2005-01-05 Thread sachin
hi Joe , 

Jakarta commons JEXL works perfectly with expressions ..
and this saved me from creating an 'expression builder' and saved a lot of 
time ...

Thanks a lot .

cheers ,
Sachin Hegde
Software Developer
Paradyne Infotech Limited , Mumbai
09324546711

"The believer is happy. The doubter is wise." -Benjamin Disraeli

-- Original Message ---
From: Joe Germuska <[EMAIL PROTECTED]>
To: "Apurva Goswami" <[EMAIL PROTECTED]>, "Struts Users 
Mailing List" 
Sent: Tue, 4 Jan 2005 16:34:15 -0600
Subject: [OT] RE: Help : execute a equation in String format

> Have a look at commons-jexl:
> http://jakarta.apache.org/commons/jexl/
> 
> import org.apache.commons.jexl.*;
> 
> public class JexlExample {
> 
>  public static void main(String[] args)  throws Exception {
>  String expr = "((123*123+567-7899*340)/1234)*1000";
>  Expression e = ExpressionFactory.createExpression(expr);
>  JexlContext context = JexlHelper.createContext();
>  // here you'd populate your context if you had any variables...
>  Object result = e.evaluate(context);
>  System.out.println("result: " + result);
>  }
> }
> 
> At 9:11 AM +1100 1/5/05, Apurva Goswami wrote:
> >Hi Sachin,
> >
> >Haven't tried but have a look at these links:
> >
> >http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/model/FormulaP
> >arser.html
> >
> >
> >http://maplenet.maplesoft.com/doc/com/maplesoft/maplenet/client/MapleSta
> >tement.html
> >
> >
> >Cheers
> >Apurva
> >
> >
> >-Original Message-
> >From: sachin [mailto:[EMAIL PROTECTED]
> >Sent: Tuesday, January 04, 2005 6:14 PM
> >To: Struts Users Mailing List
> >Subject: RE: Help : execute a equation in String format
> >
> >hi apurva ,
> >
> >>  To be precise you can java.math.BigDecimal and then convert your
> >result
> >>  into string object.
> >
> >Thanks for ur reply . The equation builder can be achieved this way.
> >But if the query is complex it takes a long way ... like looking for the
> >
> >innermost brackets, aplying square roots , squares , * , / , + , -  etc
> >..and
> >more .
> >
> >So i was looking for some library class which can take an arithmetic
> >equation
> >and deliver its result .. but if this sort of thing is not available  ..
> >then
> >i will have to develope it.
> >
> >Regards,
> >Sachin Hegde
> >Software Developer
> >Paradyne Infotech Limited , Mumbai
> >09324546711
> >
> >"The believer is happy. The doubter is wise." -Benjamin Disraeli
> >
> >-- Original Message ---
> >From: "Apurva Goswami" <[EMAIL PROTECTED]>
> >To: "Struts Users Mailing List" 
> >Sent: Tue, 4 Jan 2005 17:28:43 +1100
> >Subject: RE: Help : execute a equation in String format
> >
> >>  Hi Sachin,
> >>
> >>  You can use java.math class to achieve what you want.
> >>  To be precise you can java.math.BigDecimal and then convert your
> >result
> >>  into string object.
> >>
> >>  Hope this helps.
> >>
> >>  Cheers
> >>  Apurva
> >>
> >>  -Original Message-
> >>  From: sachin [mailto:[EMAIL PROTECTED]
> >>  Sent: Tuesday, January 04, 2005 5:34 PM
> >>  To: Struts Users Mailing List
> >>  Subject: Help : execute a equation in String format
> >>
> >>  hi ,
> >>
> >>  I have equation in String format
> >>  like
> >>
> >  > String equ = "((123*123+567-7899*340)/1234)*1000";
> >>
> >>  now i want to execute this equation and get the result ..
> >>  How can i achieve this in java ?
> >>
> >>  note : This is not a struts -related issue ... yet i need help so i
> >>  posted ..
> >>  hope nobody minds much 
> >>
> >>  Regards,
> >>  Sachin Hegde
> >>  Software Developer
> >>  Paradyne Infotech Limited , Mumbai
> >>  09324546711
> >>
> >>  "There are three kinds of lies: lies, damn lies, and statistics."
> >>  -Benjamin Disraeli
> >>
> >>  -
> >>  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]
> >--- End of Original Message ---
> >
> >
> >-
> >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]
> 
> -- 
> Joe Germuska
> [EMAIL PROTECTED]  
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction"  -The Ex
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--- End of Original Message ---


-
To 

Re: Hmm... i will go crazy due to validation

2005-01-05 Thread Erik Weber
This is not a direct answer to any of your questions but perhaps it will 
spur your thinking.

This is an example of using a custom ("pluggable") validator that makes 
sure a date entry is not only a real date, but that the date is within a 
desired range (seemingly you are wanting to do something similar to 
this). I wrote this for Struts 1.1. I don't know if there is something 
new and improved that would be better, but it works.

From validation.xml (you'll see the use of the "date" rule -- which 
uses the "datePattern" variable, as well as my custom "dateRange" rule 
-- which uses the "minDate" and "maxDate" variables):


 
   
 datePattern
   MM/dd/
   
   
 minDate
   01/01/1900
   
   
 maxDate
   12/31/2030
   
   

From validator-rules.xml:
   
   classname="ValidationUtil"
method="validateDateRange"
methodParams="java.lang.Object,
   
org.apache.commons.validator.ValidatorAction,
   
org.apache.commons.validator.Field,
   
org.apache.struts.action.ActionErrors,
   
javax.servlet.http.HttpServletRequest"
   depends="required"
   msg="errors.dateRange"/>

And finally the source of ValidationUtil:
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.text.SimpleDateFormat;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.validator.Resources;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.commons.validator.GenericValidator;
public class ValidationUtil {
 public static final String DEFAULT_FORM_DATE_PATTERN = "M/dd/";
 public static final Date DEFAULT_MIN_DATE = getDefaultMinDate();
 public static final Date DEFAULT_MAX_DATE = getDefaultMaxDate();
 public static boolean validateDateRange(Object bean, ValidatorAction 
va, Field field, ActionErrors errors, HttpServletRequest request) {
   //if we're not properly configured to parse dates,
   //all date validation will fail
   if (DEFAULT_MIN_DATE == null || DEFAULT_MAX_DATE == null) return false;
   try {
 String value = ValidatorUtil.getValueAsString(bean, 
field.getProperty());
 Date date = getDate(value, DEFAULT_FORM_DATE_PATTERN);
 Date minDate = getDate(field.getVarValue("minDate"), 
DEFAULT_FORM_DATE_PATTERN);
 Date maxDate = getDate(field.getVarValue("maxDate"), 
DEFAULT_FORM_DATE_PATTERN);
 if (date.compareTo(minDate) < 0 || date.compareTo(maxDate) > 0) {
   errors.add(field.getKey(), Resources.getActionError(request, va, 
field));
   return false;
 }
 return true;
   }
   catch (Exception e) {
 e.printStackTrace();
 errors.add(field.getKey(), Resources.getActionError(request, va, 
field));
 return false;
   }
 }

 protected static Date getDate(String dateString, String pattern) {
   Date date = null;
   try {
 SimpleDateFormat df = new SimpleDateFormat(pattern);
 date = df.parse(dateString);
   }
   catch (Exception e) {
 e.printStackTrace();
   }
   return date;
 }
 protected static Date getDefaultMinDate() {
   return getDate("01/01/1900", DEFAULT_FORM_DATE_PATTERN);
 }
 protected static Date getDefaultMaxDate() {
   return getDate("12/31/2030", DEFAULT_FORM_DATE_PATTERN);
 }
}
Maybe you should browse the Struts wiki (wiki.apache.org/struts) for 
example links?

Hope that helps some,
Erik
P.S. I never had much luck with DatePatternStrict, always wondered if it 
was buggy . . . But I guess others are using it successfully?


Manisha Sathe wrote:
I am testing struts validatior in one test program. Finally i could do some 
date validation for user i/p. I could get javascript pop-up if i enter it 
wrongly.
i wanted to test server side validation - so i switched off javascript and 
tried to submit - it went through w/o throwing any error.
Now again pls help me, what i am missing out ? I am using something like 
(instead of ActionForm)
public class MyForm extends  ValidatorForm  {

}
inside my formbean
regards
Manisha
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
 

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


Re: How to implement OR functionality in STRUTS

2005-01-05 Thread Neil Erdwien
I agree that if the "..." is long, or if there are lots of them, then 
simply repeating the code is less than ideal.

On the other hand, if there are only, say, three conditions, and the 
code is three lines, then duplication isn't horrendous.  We've all done 
uglier things in the push to get the job done.

Assuming JSTL is available, it provides a better solution.
Guillaume Cottenceau wrote:
Neil Erdwien  writes:

How about:
   
  ...
   
   
  ...
   

Are you serious? When "..." is longer than say 1 or 2 lines, this
leads to duplicated source-code, one of the thing I think
programmers should avoid with the most energy.
--
Neil Erdwien, [EMAIL PROTECTED], Web Technologies Manager
Computing and Network Services, Kansas State University
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Date validation another question

2005-01-05 Thread Vaclavik Radek
Hi,

this works fine for me (in validation.xml file). I see no problem with using
datePattern...




  datePattern
  dd.MM.
  


Radek

> -Original Message-
> From: Manisha Sathe [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 05, 2005 9:23 AM
> To: user@struts.apache.org
> Subject: Date validation another question
> 
> 
> Currently testing text box i/p for date. I do not want to 
> make use of "datePatternStrict" so i used "datePattern" but 
> still it is validating as per "datePatternStrict" only. It is 
> not accepting 1/1/2005 as i/p
>  
> Do i need to set anything else too ?
>  
>  
> 
>   
> -
> Do you Yahoo!?
>  Take Yahoo! Mail with you! Get it on your mobile phone.
> 


Re: How to implement OR functionality in STRUTS

2005-01-05 Thread Pavel Kolesnikov
On 05 Jan 2005 10:47:40 +0100, Guillaume Cottenceau <[EMAIL PROTECTED]> wrote:
> Neil Erdwien  writes:
> 
> > How about:
> >
> > 
> >...
> > 
> > 
> >...
> > 
> 
> Are you serious? When "..." is longer than say 1 or 2 lines, this

Neil's answer was as well serious as the original question was ;)

Pavel

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



org.xmlmiddleware.schemas.dtds.DTDParser

2005-01-05 Thread Richard Jason R. Raquepo
i don't know if this question applies to struts...
but im using this org.xmlmiddleware.schemas.dtds.DTDParser on my 
console-based java application and works ok.

now i need to use it on a web application but during development i noticed 
that it does not run properly. i did some debugging

and found out that my codes stop at this line:
dtdParser = new DTDParser();
any other codes after that line after that code does not run, the odd thing 
is it throws no error or anything?

does anyone experience this kind of error?
appreciate any help on this.
thanks guys...

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


AW: How to implement OR functionality in STRUTS

2005-01-05 Thread Leon Rosenberg
The "..." is exactly one line, because it's only a flag:


  


  



  ... do the things you need to do.



But I fully agree that this is ugly, and should be done by a property of the
bean instead:

...


Alternatively feel free to make a nested "or" tag.


> -Ursprüngliche Nachricht-
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 5. Januar 2005 10:48
> An: Struts Users Mailing List
> Betreff: Re: How to implement OR functionality in STRUTS
> 
> Neil Erdwien  writes:
> 
> > How about:
> >
> > 
> >...
> > 
> > 
> >...
> > 
> 
> Are you serious? When "..." is longer than say 1 or 2 lines, this
> leads to duplicated source-code, one of the thing I think
> programmers should avoid with the most energy.
> 
> --
> Guillaume Cottenceau
> 
> -
> 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]



AW: How to implement OR functionality in STRUTS

2005-01-05 Thread Leon Rosenberg
The "..." is exactly one line, because it's only a flag:


  


  



  ... do the things you need to do.



But I fully agree that this is ugly, and should be done by a property of the
bean instead:

...


Alternatively feel free to make a nested "or" tag.


> -Ursprüngliche Nachricht-
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 5. Januar 2005 10:48
> An: Struts Users Mailing List
> Betreff: Re: How to implement OR functionality in STRUTS
> 
> Neil Erdwien  writes:
> 
> > How about:
> >
> > 
> >...
> > 
> > 
> >...
> > 
> 
> Are you serious? When "..." is longer than say 1 or 2 lines, this
> leads to duplicated source-code, one of the thing I think
> programmers should avoid with the most energy.
> 
> --
> Guillaume Cottenceau
> 
> -
> 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: How to implement OR functionality in STRUTS

2005-01-05 Thread Guillaume Cottenceau
Neil Erdwien  writes:

> How about:
> 
> 
>...
> 
> 
>...
> 

Are you serious? When "..." is longer than say 1 or 2 lines, this
leads to duplicated source-code, one of the thing I think
programmers should avoid with the most energy.

-- 
Guillaume Cottenceau

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



Re: Character encoding problems after 1.1 to 1.2.4 upgrade

2005-01-05 Thread Guillaume Cottenceau
"J. Patterson Waltz III"  writes:

> P.S. - I know how to view the headers of replies sent from the server to the
> browser, but am not sure how to get at those sent from the browser to the
> server, to make sure that they are indeed UTF-8. Any suggestions?

I usually temporarily modify the URL where to post the form to
something like http://localhost:/ then a simple `nc -l -p ' 
in a console listens to the connection and dumps received data.

-- 
Guillaume Cottenceau

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



Multiple Email Validation

2005-01-05 Thread hemant sharma


Hi 
 
I was facing problem in validating multiple Email Addresses given in a form field. As the validator-rules.xml in Validator Framework contains validation for only single Email Address. I tried to modify the code of the existing Email Validator in validator-rules.xml, but it didn't work.
 
So, I created my own java class which validates single/multiple Email Addresses and made the corresponding entry in validator-rules.xml and consequently in validation.xml. Now its working as per requirement.
 
I am giving the java code for that class(CustomValidatorRules.java attached with this mail). Currently in my code the email addresses should be separated by either , or ;. You can modify it for any separator.
 
Pls suggest any modifications in the code given by me, as well as if there is any way to modify the existing code of the Email Validator in validator-rules.xml so that it can validate multiple email addresses.
 
Thanks 
Hemant





Hemant Kumar Sharma 
accenture
High Performance.Delivered
Accenture Services Pvt. Ltd.
India Delivery Centre - Mumbai
Direct   : + 91 2255003890 Mobile  : + 91 9820238651 e-mail   : [EMAIL PROTECTED] , [EMAIL PROTECTED]AOL IM : hemant2913 , YahooMsngr : hemant2911
		Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we./**
 * author hemant.sharma   [EMAIL PROTECTED]
 * Created on Jan 3, 2005
 */

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.regex.*;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.validator.Field;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.validator.Resources;


public class CustomValidatorRules {

public static boolean validateEmailAddresses(
Object bean,
ValidatorAction va,
Field field,
ActionErrors errors,
HttpServletRequest request) {

//Email Addresses obtained from the input form 
String emailAddresses =
ValidatorUtil.getValueAsString(bean, 
field.getProperty());

List emailAddressList = new ArrayList();
char[] eAdd = emailAddresses.toCharArray();
char c;
int flag = 0;
int i = 0;
int count1 = 0, count2 = 0;

//Check to see if either a semicolon or comma is used between 
email addresses. 
for (i = 0; i < eAdd.length; i++) {
c = eAdd[i];
if (c == ',') {
count1++;
}
if (c == ';') {
count2++;
}

if (count1 > 0 && count2 > 0) {
errors.add(
field.getKey(),
Resources.getActionError(request, va, 
field));
return false;
}

}

//Check to see if there are either more than one semicolon or 
more than one comma used between email addresses.  
for (i = 0; i < eAdd.length; i++) {
c = eAdd[i];
if (c == ',' || c == ';') {
if ((i + 1) < eAdd.length
&& (eAdd[i + 1] == ',' || eAdd[i + 1] 
== ';')) {

errors.add(
field.getKey(),

Resources.getActionError(request, va, field));
return false;
}
}
}

//The whole Email Addresses String is tokenized as list of 
email addresses.
if (flag != 1) {
StringTokenizer st = new 
StringTokenizer(emailAddresses, ",;");
while (st.hasMoreTokens()) {
emailAddressList.add(st.nextToken().trim());
}

for (int j = 0; j < emailAddressList.size(); j++) {
if ((String) emailAddressList.get(j) != null) {
//Each Email Address is checked for 
validity
if (!isValidEmail((CharSequence) 
emailAddressList
.get(j))) {
//Invalid Email

Hmm... i will go crazy due to validation

2005-01-05 Thread Manisha Sathe
I am testing struts validatior in one test program. Finally i could do some 
date validation for user i/p. I could get javascript pop-up if i enter it 
wrongly.
 
i wanted to test server side validation - so i switched off javascript and 
tried to submit - it went through w/o throwing any error.
 
Now again pls help me, what i am missing out ? I am using something like 
(instead of ActionForm)
 
public class MyForm extends  ValidatorForm  {
 

 
}
 
inside my formbean
 
regards
Manisha

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: How to implement OR functionality in STRUTS

2005-01-05 Thread dsarris
Hi, 
use JSTL. Do not spend time with the Struts tags. 

here is an example:




   Error 1 has occurred.


Error 2 has occurred.




Chipix

On Wed, 05 Jan 2005 01:05:30 -0500, Erik Weber <[EMAIL PROTECTED]> wrote:
> Look into the expression language's Logical OR ("||") operator and the
> JSTL core tags (such as c:if). Possibly the OR operator would work
> within an EL expression using the logic:equal tag as well, but I just
> can't think of an example.
> 
> Erik
> 
> 
> Krishna Mohan Radhakrishnan wrote:
> 
> >
> >Hi all,
> >A very simple question.
> >
> >
> >   
> >   ...
> >.
> >
> >
> >   
> >
> >
> >The above code is just like an AND function.
> >Only if both the conditions are equal it will go inside the loop.
> >
> >Similarly How will we do it for an OR  condition.
> >If any condition satisfies it should go inside the loop.
> >
> >May be this sounds a very silly question. I am a fresher to struts.
> >That's Y?
> >
> >Regards,
> >Krishna Mohan R
> >
> >

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



RE: Two Qs re: authentication servlet filter

2005-01-05 Thread Marco Mistroni
Hello,
^/LoginAction.do
  
could this be the problem? Shouldn't u use * instead?

Regards
Marco



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



Re: Cancel button problem

2005-01-05 Thread Nicolas De Loof
When using cancel button, validation is automatically skipped. Use 
isCanceled(request) in your action to see if cancel was clicked and 
forward to your index page.

Nico.
Manisha Sathe a écrit :
I am using struts cancel button. But when i click on that it goes to next page (w/o 
even  validation - using validator). What i want to do is i want to redirect it to 
index page. I tried using oncancel inside  but giving me error.
How i can do this ?
Thanks and regards,
Manisha
		
-
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search. Learn more.
 

This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the person 
to whom it is addressed. If you are not the intended recipient,  you are not 
authorized to read, print, retain, copy, disseminate,  distribute, or use this 
message or any part thereof. If you receive this  message in error, please 
notify the sender immediately and delete all  copies of this message.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Two Qs re: authentication servlet filter

2005-01-05 Thread Nicolas De Loof
You should have a look at securityFilter that does such a job. It tries 
to "look like" j2ee FORM security check, but allow you to use your own 
authentication rules.

Nico.
Jim Barrows a écrit :
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 04, 2005 11:17 AM
To: user@struts.apache.org
Subject: Two Qs re: authentication servlet filter


Can anyone help a newbie out?  I have a couple of questions:
1)  I am implementing a servlet filter for authentication.  
In my web app,
a class reunion web site, I want people to be able to login with their
first and last names and a password, instead of a single ID 
and password,
so I am NOT configuring form-based security and letting 
TomCat do the work.
Instead, I am checking authorization myself in this filter.  
Is this sound
reasoning or does anyone have better ideas?
   

I know of one other person whose name is James Barrows.  No relation to me 
at all.  Firstname/lastname is probably not unique enough.
 

2)  In web.xml, in the filter-mapping tag, is there a way to 
say "execute
this filter to all servlets except /LoginAction.do"  I tried 
the following,
using the regular expression carat, but get an "invalid 
expression" error.
I'd hate to list all servlets and JSPs that should get the 
filter applied.
   

All actions that need to have a login should be of the form 
"/secure/actionName.do", then set your filter to the secure actions.
 

More importantly, sounds like an opportunity for errors as new
actions/servlets are created but maybe not added to the list of
filter-mappings.  Here's the attempt at mapping that failed:
 
 AuthenticationFilter
 schs82.AuthenticationFilter
 
 
 AuthenticationFilter
 ^/LoginAction.do
 
   

I wish that would have worked too :)
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

This message contains information that may be privileged or confidential 
and is the property of the Capgemini Group. It is intended only for the person 
to whom it is addressed. If you are not the intended recipient,  you are not 
authorized to read, print, retain, copy, disseminate,  distribute, or use this 
message or any part thereof. If you receive this  message in error, please 
notify the sender immediately and delete all  copies of this message.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Cancel button problem

2005-01-05 Thread Manisha Sathe
I am using struts cancel button. But when i click on that it goes to next page 
(w/o even  validation - using validator). What i want to do is i want to 
redirect it to index page. I tried using oncancel inside  but 
giving me error.
 
How i can do this ?
 
Thanks and regards,
Manisha


-
Do you Yahoo!?
 Yahoo! Mail - Find what you need with new enhanced search. Learn more.

Re: Set request parameters in servlet through action

2005-01-05 Thread dsarris
OK, 

Thanks everyone for your help.

The correct approach is:

Java:
request.setAttribute("myThing", myThing);

JSP:


Thanks again

On Tue, 04 Jan 2005 18:22:32 -0800, Curtis Taylor <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> You *cannot* directly add parameters to an http request inside an Action
> class. You *can* add attributes  to the request context (that's what
> HttpServletRequest was designed for).
> 
> So, in your JSTL-aware page, access your request *attribute*:
> 
>  or
> 
> 
> 
> HTH,
> 
> Curtis
> 
> dsarris wrote:
> > 
> >
> > I do not thing that Hollaway solution is the correct one. I do not
> > pass it to the request parameter list. As brenmcguire stated, I can
> > only set an attribute in the Request (not the parameters).
> >
> > Thus, what is the equivalent for retrieving the attribute in my JSP page?
> >
> > 
> > OR
> > 
>

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



Date validation another question

2005-01-05 Thread Manisha Sathe
Currently testing text box i/p for date. I do not want to make use of 
"datePatternStrict" so i used "datePattern" but still it is validating as per 
"datePatternStrict" only. It is not accepting 1/1/2005 as i/p
 
Do i need to set anything else too ?
 
 


-
Do you Yahoo!?
 Take Yahoo! Mail with you! Get it on your mobile phone.