Disallow user to modify URL in browser address bar

2003-08-22 Thread sriram
How to identify if user has manipulated the URL in Address Bar of the browser?

For ex., the application displays a page with the following URL:

http://localhost:8080/app/str/testview_srchpost.do

Now, the user modifies the URL in the address bard. Instead of testview_srchpost.do, 
user types testtwoview_srchpost.do and clicks ENTER.

I want to restrict such types of URL modification Struts application. I should take 
the user to a default access denied page when ever user does such changes.

How to identify this action of the user? Pl. give some ideas.



Re: Telling Users to Wait

2003-08-22 Thread David Thielen
Hi;

The method I use (which gives no % update) is I forward to a page that says
please wait and has an animated gif. That page does a meta
http-equiv=refresh... to the servlet that runs the database work. This
way the please wait page is displayed until the database work completes and
it's page is displayed.

- dave



- Original Message - 
From: Mark Silva [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:02 PM
Subject: Telling Users to Wait


Hello Struts Gurus,

I am facing an issue in my application where I need to run a database
creation script, and a database import script through the web (running
bat files on the server).  I can run these files fine, but they take a
few minutes to run...

How can I tell the user when they have finished running?  This seems to
be a sort of push technology I am in need of, but maybe there is another
way?.  I can definitely tell them to wait for a few minutes, but how do
I actually tell them when the process is done (since there is not
another page request at this time.)

Has anyone done something similar to this?

Thanks,
Mark

-
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: Quick Java question..

2003-08-22 Thread Oliver Reflé
Or you simple pass in an array of arguments
public void myMethod(String[] args){}

Then you can handle as much Strings as you want
-Ursprüngliche Nachricht-
Von: Michael Thompson [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 22. August 2003 01:08
An: Struts Users Mailing List
Betreff: Re: Quick Java question..


Or wait till 1.5 ;)

http://developer.java.sun.com/developer/community/chat/JavaLive/2003/jl0
729.html

*Neal Gafter*: Then there's autoboxing/unboxing and varargs. Boxing 
allows you to use a primitive int instead of a |java.lang.Integer|, and 
unboxing does the reverse. varargs allows you to declare a method that 
takes a variable number of arguments, which are automatically packed up 
into an array before being passed to the method.


--m


Alex Shneyderman wrote:

You can make your parms Object []
This way you can pass as many params as you want.
Of course you will need to keep track of what element is what.

Maybe Java 1.5 will have the feature you are looking for :-)

Alex.

  

-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:51 PM
To: 'Struts Users Mailing List'
Subject: RE: Quick Java question..

sorry, dude, but param arguments are evaluated at compile time.  The


best
  

you could do is overload the method.

Mark

-Original Message-
From: David Erickson [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:00 PM
To: Struts Mailing List
Subject: Quick Java question..


Hey as I've been building my actions I was thinking it could be useful


for
  

me to have a method that does some database querying, but I would like


to
  

give the user the ability to narrow down that query with as many input

fields as he needs.  Is there a way to write a method that takes a


non-set
  

amount of arguments?  (Other than just passing the method a growable 
array.. which is a viable alternative)

Ie

public String myfunction(String a, String b, String c on down the


line
  

indefinitly)

?
I thought I had seen this done somewhere somehow but I may be wrong. 
Thanks!


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19.08.2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19.08.2003
 


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



RE: Horizon: a view management plugin

2003-08-22 Thread Hue Holleran
I must confess to being a bit confused!  What is the difference between your
approach and getting an instance of a Dyna, viz:

DynaActionFormClass dafc =
DynaActionFormClass.getDynaActionFormClass(Dyna-Definition-Name-In-Struts-C
onfig);
DynaActionForm myBean = (DynaActionForm) dafc.newInstance();

At least with the above approach the beans are stored in struts-config in
the usual struts syntax - it's just they're not used in the action name
parameter - but are created on-the-fly in an action (or wherever) with the
above code.

I'm concerned I may be missing some obvious advantage to your approach -
hence the reason for the question!

Hue.

 -Original Message-
 From: Pedro Emanuel de Castro Faria Salgado
 [mailto:[EMAIL PROTECTED]
 Sent: 21 August 2003 16:15
 To: [EMAIL PROTECTED]
 Subject: Re: Horizon: a view management plugin



  Pedro Emanuel de Castro Faria Salgado wrote:
 
 Hi,
 
I have built a plugin for Struts that creates view beans using
 dynabeans that are defined on a xml file and i was wondering if anyone
  in the Struts project/mailing list was interested on checking the use
  of it?
 
  When I see dynabean are you saying BeanUtils.DynaBean and what is a
  'view bean',
  do you mean a Action Form ?

 yes

  If so what is the difference between  your
  plugin and  a DynaActionForm ?

 i think, actually, there is none... the difference is for what i use
 the view beans for: transfering data from actions to
 build combobox on form and present data that isn't on a form.

 i know i can use the form itself to put a collection to
 build a combobox and use another form bean property
 to store the user input but it is less
 confusing if i define forms with only the properties the
 user can enter data and
 another bean for transmitting data (dto... in my case i call it
 view bean).

 before the plugin i had to define a new java class
 (attributes + getters/setters) for each
 new dto i wanted, now, i only need to add some lines
 to a xml file...

 
  Given that your plugin is generally useful then there are several
  options :
 
  1) Since web space can gotten for free now days you could always post it
   on a site with
  some documentation on how to use it.

 i will see what i can do...

  2) We are using the http://www.sf.net/projects/struts site as an
  incubator for projects you can post there
   to see if there is interest.

 thank you for the tip...

  3) Find someone else with a struts web site, that would host it.
 
  Most importantly having an example, that is documented is key.
 

 I have already sent the source on another email so
 you can take a look (src + javadoc + ant file)
 and i am finishing a small web app.


 thanks for the tips...

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


 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


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



Re: RE: Does Tiles supports skins???

2003-08-22 Thread [EMAIL PROTECTED]
Cal,

Thanks, it works but I have an additional question.

Creating a tiles action and using the findAttributeNames method of the 
Component Context, I get only the put attributes, but how can I get 
the path of the definition?, because I have different layouts for the 
skins.

I read in the Tiles Advanced Features how can I switch the path 
including a path with the Request Dispatcher class, but I should read 
first the path attribute to change the skin directory.

Thanks in advance.

Antonio


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



Re: How to set charset UTF-8

2003-08-22 Thread Jing Zhou
We got a similar problem. At the very beginning, it looks like the
processContent() method in the request processor would do
the job for you if the ControllerConfig is set correctly. But the
story is more complicated than I thought.

It looks to me the container has the right to override the content
type and/or the character encoding. From the JSP Specification,
we have some statements like A JSP container may use some
implementation-dependent heuristics and/or structure to
determine what the expected character encoding of a JSP page is...

The default implementations from Tomcat, OC4J, and SunOne are different.
jsp:directive.page pageEncoding=ISO-8859-1 contentType=text/html/

is used in every JSP page. The Tomcat 4.1.24 generates a statement
setContentType(text/html;charset=ISO-8859-1); // good
The OC4J 9.0.3 generates the statement
setContentType(text/html;charset=UTF-8); // something not expected
The SunOne App7 generates the statement
setContentType(text/html); // something shorter with warning message.
The Resin 2.1.10 does the same as SunOne but without warning message.

I am not sure what we are missing here. Anyway, we could not *force* them
to produce the expected content type and the character encoding
except on Tomcat.

Jing
Netspread Carrier
http://www.netspread.com




- Original Message - 
From: Van Riper, Mike [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Cc: 'Billy Ng' [EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 4:30 PM
Subject: RE: How to set charset UTF-8


  I added the following to test what encoding my Struts app is using
 
  %
 response.setContentType(text/html; charset=UTF-8);
 System.out.println(response.getCharacterEncoding());
  %
 
  But it still print out the ISO-8859-1, why?  How can I set
  the contentType to text/html; charset=UTF-8

 This is just a hunch, but, I suspect you can't change the character
encoding
 after you have started writing content to the stream. In that case, your
 best bet is to do this at the very top of the JSP page:

  %@ page contentType=text/html;charset=UTF-8 language=java %

 Also, there is another consideration if you are using Tiles. Again this is
 just a hunch, but, I suspect that you would have to have that directive as
 the first line of your Tiles master layout template JSP. The concept
 mentioned above for a single page applies to a Tiles page generated
 dynamically from multiple JSPs all writing to the same response stream.

 We ran into something like this using the Struts template custom tags with
 Struts 1.0 back in 2001. We were correctly setting the character encoding
 using the page directive on individual content JSPs, but, had left it off
 our master page layout template JSP. So, it never took until we tracked
that
 down. Duh!

 Hope this helps, Van

 Mike Van Riper
 mailto:[EMAIL PROTECTED]
 http://www.baychi.org/bof/struts


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



multiple input form editing problem

2003-08-22 Thread Florent LOTHON

LO,

I have a form with multiple input as this

input type=text name=surname
input type=text name=name
input type=text name=surname
input type=text name=name
input type=text name=surname
input type=text name=name
...

i made a usersForm as this :

private String[] name = null;
private String[] surname = null;
...

I would like to show the content of a the usersForm  object preloaded from
an Action for editing datas


I tried as this :
%
int i=0;
%
html:form name=xxx.do
logic:iterate...
%
String surname = surname[+i+];
String name = name[+i+];
i++;
%
input type=text name=%= surname %
input type=text name=%= name %
/logic:iterate
/html:form

This show magically the correct values on screen but as this in HTML code :

input type=text name=surname[0] value=toto
input type=text name=name[0] value=TO

input type=text name=surname[1] value=tata
input type=text name=name[1] value=TA

So when i submit this form
The usersForm can't retrieve new values because of the bad name of property
(surname[0], name[0], surname[1], name[1],...)

I think it must exist a simpliest solution using indexed attribute or
others but i don't know what.
And the documentations on struts are so poor for this kind of problem.

sincerly

Florent





--
Ce message est protege par les regles relatives au secret des correspondances ; il 
peut en outre contenir des informations a caractere confidentiel ou protegees par 
differentes regles et notamment le secret des affaires ; il est etabli a destination 
exclusive de son destinataire. Toute divulgation, utilisation, diffusion ou 
reproduction (totale ou partielle) de ce message, ou des informations qu'il contient, 
doit etre prealablement autorisee. 
Tout message electronique est susceptible d'alteration et son integrite ne peut etre 
assuree. Les AGF declinent toute responsabilite au titre de ce message s'il a ete 
modifie ou falsifie. 
Si vous n'etes pas destinataire de ce message, merci de le detruire immediatement et 
d'avertir l'expediteur de l'erreur de distribution et de la destruction du message.
This message is protected by the secrecy of correspondence rules ; furthermore it may 
contain privileged or confidential information that is protected by law, notably by 
the secrecy of business relations rule ; it is intended solely for the attention of   
the addressee . Any disclosure, use, dissemination or reproduction (either whole or  
partial) of this message or the information contained herein is strictly prohibited 
without prior consent.
Any electronic message  is susceptible to alteration  and  its integrity can not be 
assured.  AGF declines any  responsibility for  this message in the event of  
alteration  or falsification..
If you are not the intended  recipient, please destroy it immediately and  notify the 
sender of the wrong delivery and the mail deletion. 
--


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



problems with ActionConfig

2003-08-22 Thread Geronimo Ma. Hernandez
Hello,

I use a subclass of ActionConfig for additional properties.
Now I added a map with a bean-property interface like get/setAttribute and 
getAttributeNames which returns the map.
With added log-statements I verified, that the additional parameter is put 
into the list.

When this action is called, I check the map again, with the result that it is 
empty now.

Does anybody have an idea about my error? 
Is there a special gotcha that I'm trapped into?

Thanks in advance for your help.
Gero

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



RE: problems with ActionConfig

2003-08-22 Thread Andrew Hill
Im not really clear on what your doing. Can you give some detail, and
perhaps some snippets of code?
What do you mean by added a map?

-Original Message-
From: Geronimo Ma. Hernandez [mailto:[EMAIL PROTECTED]
Sent: Friday, 22 August 2003 17:38
To: Struts Users Mailing List
Subject: problems with ActionConfig


Hello,

I use a subclass of ActionConfig for additional properties.
Now I added a map with a bean-property interface like get/setAttribute and
getAttributeNames which returns the map.
With added log-statements I verified, that the additional parameter is put
into the list.

When this action is called, I check the map again, with the result that it
is
empty now.

Does anybody have an idea about my error?
Is there a special gotcha that I'm trapped into?

Thanks in advance for your help.
Gero

-
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: problems with ActionConfig

2003-08-22 Thread Geronimo Ma. Hernandez
Andrew Hill wrote:
 Im not really clear on what your doing. Can you give some detail, and
 perhaps some snippets of code?
 What do you mean by added a map?
 
Sorry for being unprecise.

I added a map to the ActionConfig-subclass. The map is created in the default 
constructor.

In the struts-config I have a set-property ... with the value beeing a comma 
separated list.

The ActionConfig-class has a setter which splits the string and adds each 
element to the map.

Regarding to the logfile - that part works.

When the action gets called, I check the mapping argument of beeing my 
ActionConfig-subclass, do the typecast and then check the map.
At that moment the map is empty.

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



Problem with nested:submit ... and Form reset

2003-08-22 Thread Rupinder Singh Mazara
Hi all
  I have problem with one of my submit buttons on my form  ,
Each time the following submit is clicked nested:submit
property=insertDepartment  Add a new Dept /nested:submit
I need to execute the setInsertDepartment method of the Form class, however
this also results in the reset method of the Form get called
Can I prevent the reset method being called or if it is called to do a
selective reset ?

I would like to retain the reset method as it is possible that the Form may
be reset to a default state .

The Form class is
public class CompanyForm extends ActionForm {

public CompanyForm() {
dept = new Vector();
   dept.add(new org.volvic.Dept() );
name =  ;
registedOffice = yyy;
}

public void setInsertDepartment(String temp ) {
System.out.println(@@ CompanyForm  java
bean Set   );
dept.add(new org.volvic.Dept() );
}

 public void reset(org.apache.struts.action.ActionMapping actionMapping,
javax.servlet.http.HttpServletRequest httpServletRequest) {
  System.out.println(@ RESET WAS CLICKED ) ;
 dept = new Vector();
dept.add(new org.volvic.Dept() );
}
}
  The following snippet is from the jsp
nested:root name=company 
nested:form action=/showDept 
tr
nested:submit  property=insertDepartment  Add a new Dept
/nested:submit

tr td Company Name : td nested:write property=name /  /tr
tr td colspan=2  i is located at the following address /i /tr
tr td Address : nested:write property=registedOffice / /tr
tr td colspan=2  Departments  available are /tr
table bgcolor=#F0F0F0 border=1 
nested:iterate property=dept type=org.volvic.Dept  
tr  td nested:write property=DName /  td nested:write
property=DLocation /
td nested:submit  property=updateLocation   update  /nested:submit
/tr
/nested:iterate
/table
/nested:form
/nested:root


Rupinder


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



RE: problems with ActionConfig

2003-08-22 Thread Andrew Hill
Ah, ok. I understand now.

So the string that gets passed to the setter looks something like:
foo,bar,baz?
And then you split it in the setter (using a StringTokenizer or some such
similar method) and call map.put() for each token? What are you using as a
key for each token?

When you say its empty do you mean you cant find the things you put in it or
have you done an explicit test and seen that Map.isEmpty() returns true?

-Original Message-
From: Geronimo Ma. Hernandez [mailto:[EMAIL PROTECTED]
Sent: Friday, 22 August 2003 18:05
To: Struts Users Mailing List
Subject: Re: problems with ActionConfig


Andrew Hill wrote:
 Im not really clear on what your doing. Can you give some detail, and
 perhaps some snippets of code?
 What do you mean by added a map?

Sorry for being unprecise.

I added a map to the ActionConfig-subclass. The map is created in the
default
constructor.

In the struts-config I have a set-property ... with the value beeing a
comma
separated list.

The ActionConfig-class has a setter which splits the string and adds each
element to the map.

Regarding to the logfile - that part works.

When the action gets called, I check the mapping argument of beeing my
ActionConfig-subclass, do the typecast and then check the map.
At that moment the map is empty.

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



Nested tags and recursive inclusion

2003-08-22 Thread Yamini Krishnamurthi Ayyagari
Hello, 
I am trying to make recursive inclusion work with nested tags on Websphere but am 
running into some problems. This is what my code looks like. In main jsp:

  nested:nest property=tree
jsp:include page=treenode.jsp flush=true/
  /nested:nest

But I get an exception stating: Illegal to flush within a custom tag.
If I do not flush I get an invalid jsp:include tag exception. Can someone help me with 
this?

Thanks and Regards
Yamini Ayyagari

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



Struts Validator mask

2003-08-22 Thread Daniel Massie
I am trying to write a regular expression to represent a network path.
Network paths are of the form
\\path\to\folder
The regular expression which I thought would achieve this is
^\{2}([A-Za-z0-9]-_)+\{1}([A-Za-z0-9]-_\)+$
But I am having no luck. Can anyone help?

Thanks

Daniel Massie


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



Re: problems with ActionConfig

2003-08-22 Thread Geronimo Ma. Hernandez
Andrew Hill wrote:
 And then you split it in the setter (using a StringTokenizer or some such
 similar method) and call map.put() for each token? What are you using as a
 key for each token?

my value looks like user:session, userList:request, where the list is split 
by the , and the entries are split by : so that user is a key and 
session is a value.

 When you say its empty do you mean you cant find the things you put in it or
 have you done an explicit test and seen that Map.isEmpty() returns true?

well both. nearly. I didn't use Map.isEmpty(), I use Map.size() which returns 
0.

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



RE: RE: Does Tiles supports skins???

2003-08-22 Thread Holman, Cal
Antonio The trick is that the layout is actual a put attribute.  You then use that 
layout as the target of the Request Dispatcher.  I took the example class Cedric 
provided and modified it some.  This weekend I can post to the web along with the 
tiles.xml.

Cal 

http://www.calandva.com/Last update 08/01/03


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 03:58
To: Struts Users Mailing List
Subject: Re: RE: Does Tiles supports skins???

Cal,

Thanks, it works but I have an additional question.

Creating a tiles action and using the findAttributeNames method of the
Component Context, I get only the put attributes, but how can I get
the path of the definition?, because I have different layouts for the
skins.

I read in the Tiles Advanced Features how can I switch the path
including a path with the Request Dispatcher class, but I should read
first the path attribute to change the skin directory.

Thanks in advance.

Antonio


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

  
Learn more about Paymentech's payment processing services at www.paymentech.com
THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments are proprietary 
and confidential information intended only for the use of the recipient(s) named 
above.  If you are not the intended recipient, you may not print, distribute, or copy 
this message or any attachments.  If you have received this communication in error, 
please notify the sender by return e-mail and delete this message and any attachments 
from your computer.

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



Validating uploaded file as an image only

2003-08-22 Thread Brian McSweeney
Hi everyone,
 
I've managed to get the struts file upload working successfully, 
using the struts FormFile class and the upload example.
 
Cool :-)
 
However, in my app, I only want images to be uploaded.
I'm going to store the images on disk and put the path of the 
image file into the database. So I need to validate that only images
are getting uploaded, not other file-types.
 
I know nothing really about how to do this. I could just check that 
string returned by:
 
FormFile.getContentType( ) 
 
is equal to image-gif, image-bnp, or image-jpeg. But is this enough?
 
 
Also, I have noticed that when I upload an image file and the little 
Browser window pops up, if I select a gif image, but the file type 
bar says All files then the file isn't recognized as an image.
It's recognized as an octet-stream. So does the browser window 
specify the file type to the browser?
 
Anyway,
 
Hope someone can give me some advice,
As always,
Thanks very much,
Brian


Attempt to clear a buffer that's already been flushed

2003-08-22 Thread Bård Arve Evjen
I cannot figure out why I get this message when trying to export the result using the 
displaytag. I have included all the files I need using
jsp:include page=filename /
without having the flush=true

Why do I get this?

cheers,
Bard

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



Struts Action or EJB session bean

2003-08-22 Thread Erez Efrati
My EJB/Web application lets users upload files to the system and later
serve them those files when needed. My question is:
Who should or recommended to handle the saving of the uploaded file? The
EJB session bean or the struts UploadAction?

Thanks in advance,
Erez






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



RE: Disallow user to modify URL in browser address bar

2003-08-22 Thread James Mitchell
What you are wanting is not possible.  
It's YOUR job (as a developer) to handle situations where they may have
done so.

Hint: unknown=true

Good Luck!!!

--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx




 -Original Message-
 From: sriram [mailto:[EMAIL PROTECTED] 
 Sent: Friday, August 22, 2003 2:16 AM
 To: 'Struts Users Mailing List'
 Subject: Disallow user to modify URL in browser address bar
 
 
 How to identify if user has manipulated the URL in Address 
 Bar of the browser?
 
 For ex., the application displays a page with the following URL:
 
 http://localhost:8080/app/str/testview_srchpost.do
 
 Now, the user modifies the URL in the address bard. Instead 
 of testview_srchpost.do, user types testtwoview_srchpost.do 
 and clicks ENTER.
 
 I want to restrict such types of URL modification Struts 
 application. I should take the user to a default access 
 denied page when ever user does such changes.
 
 How to identify this action of the user? Pl. give some ideas.
 
 


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



RE: problems with ActionConfig

2003-08-22 Thread Andrew Hill
Hmmm.
Well that clarifies things a lot. Id had a theory that perhaps it might be
something to do with the key that you use  and that you just werent finding
them again correctly (maybe using a custom object for the key that didnt
override hashcode()) but since there is nothing in the map at all that cant
be the case.

Based on the information you have provided it *should* work! I think we will
need to see some source.

Are you able to post the code for the setter  getter methods, and a sample
action mapping from your struts-config?
Better add a snippet from an action where you try to access it too.

btw
I'll be heading home shortly (its 7:30pm here) so I might not get to see the
reply till Monday.
/btw

-Original Message-
From: Geronimo Ma. Hernandez [mailto:[EMAIL PROTECTED]
Sent: Friday, 22 August 2003 19:06
To: Struts Users Mailing List
Subject: Re: problems with ActionConfig


Andrew Hill wrote:
 And then you split it in the setter (using a StringTokenizer or some such
 similar method) and call map.put() for each token? What are you using as a
 key for each token?

my value looks like user:session, userList:request, where the list is
split
by the , and the entries are split by : so that user is a key and
session is a value.

 When you say its empty do you mean you cant find the things you put in it
or
 have you done an explicit test and seen that Map.isEmpty() returns true?

well both. nearly. I didn't use Map.isEmpty(), I use Map.size() which
returns
0.

-
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: Disallow user to modify URL in browser address bar

2003-08-22 Thread Jiri Chaloupka
Hallo,
you can, for example, add to url some hash with parameters and salt ...
Jiri

James Mitchell wrote:

What you are wanting is not possible.  
It's YOUR job (as a developer) to handle situations where they may have
done so.

Hint: unknown=true

Good Luck!!!

--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx


 

-Original Message-
From: sriram [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 2:16 AM
To: 'Struts Users Mailing List'
Subject: Disallow user to modify URL in browser address bar

How to identify if user has manipulated the URL in Address 
Bar of the browser?

For ex., the application displays a page with the following URL:

http://localhost:8080/app/str/testview_srchpost.do

Now, the user modifies the URL in the address bard. Instead 
of testview_srchpost.do, user types testtwoview_srchpost.do 
and clicks ENTER.

I want to restrict such types of URL modification Struts 
application. I should take the user to a default access 
denied page when ever user does such changes.

How to identify this action of the user? Pl. give some ideas.

   



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


RE: Validating uploaded file as an image only

2003-08-22 Thread Brian McSweeney
PS - there was a discussion recently on how to improve the 
Validator.


Validating an uploaded file based on mime type would be cool !

A quick search on the web led me to a company that does this 
With a java api

http://www.oop-reserch.com/mime_prop.html

It seems in jdk1.4 you can actually validate based on the 
binary pattern expected for a mime type. So if it is a gif, 
you can check that the bit pattern of the uploaded file 
matches that of a gif.

This is apparently to avoid users uploading say a text file
named mytextfile.gif

Now that would be nice :-)
Brian


-Original Message-
From: Brian McSweeney [mailto:[EMAIL PROTECTED] 
Sent: 22 August 2003 11:13
To: 'Struts Users Mailing List'
Subject: Validating uploaded file as an image only

Hi everyone,
 
I've managed to get the struts file upload working successfully, 
using the struts FormFile class and the upload example.
 
Cool :-)
 
However, in my app, I only want images to be uploaded.
I'm going to store the images on disk and put the path of the 
image file into the database. So I need to validate that only images
are getting uploaded, not other file-types.
 
I know nothing really about how to do this. I could just check that 
string returned by:
 
FormFile.getContentType( ) 
 
is equal to image-gif, image-bnp, or image-jpeg. But is this enough?
 
 
Also, I have noticed that when I upload an image file and the little 
Browser window pops up, if I select a gif image, but the file type 
bar says All files then the file isn't recognized as an image.
It's recognized as an octet-stream. So does the browser window 
specify the file type to the browser?
 
Anyway,
 
Hope someone can give me some advice,
As always,
Thanks very much,
Brian


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



html:html tag

2003-08-22 Thread Mohan Radhakrishnan
Hi

 html:html xhtml=true

  I found the following explanation.

  A special attribute named xml:lang may be inserted in documents to
specify the language used in the contents and attribute values of any
element in an XML document

  I know that this is related to locales.

  Can somebody give a better explanation about the exact purpose of this ?

Mohan

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

RE: [OT] Shopping cart best practices - Cookie, HttpSession or DB

2003-08-22 Thread Brian McSweeney
Thanks for the info Greg,
Another good idea :-)
I appreciate it,
Brian


-Original Message-
From: Greg Ludington [mailto:[EMAIL PROTECTED] 
Sent: 21 August 2003 16:39
To: 'Brian McSweeney'; 'Struts Users Mailing List'
Subject: RE: [OT] Shopping cart best practices - Cookie, HttpSession or
DB

1. Store your cart in session, and when that all works. For everyone. 
Gets to the checkout and funds are exchanged.

While I agree with the previous posters who said that it would make your
life easier if you can require login, if you absolutely need to save
carts of users regardless of login status, you might consider having
your Cart object impelment
javax.servlet.http.HttpSessionBindingListener.  Objects implementing
this interface are notified when they are bound to or unbound from
(either explicitly or by the session itself expiring/invalidated) a
session, and can perform tasks at these times.

In your case, when your Cart object is unbound you would save its
contents to your database.  (Conversely, when you first bind a Cart
object to a session, you can check the database and refresh its
contents, if any.)  Nothing about this approach prohibits you from
saving Cart information at other appropriate times -- user logins,
purchases, and the like -- this approach just allows you the ability to
store information, like cart contents, at the end of a client session.

-Greg



-
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] Shopping cart best practices - Cookie, HttpSession or DB

2003-08-22 Thread Brian McSweeney
Thanks Adam,
Makes sense,
Appreciate it,
Brian


-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: 21 August 2003 22:07
To: Struts Users Mailing List
Subject: Re: [OT] Shopping cart best practices - Cookie, HttpSession or
DB

I think the issue of using up server memory with lots of shopping carts 
in the session is worth thinking about. It's just a question of maths - 
how much memory have you got, what is the peak number of users 
envisaged, how much stuff are you going to store in the session? even 
then I think some app servers swap out sessions to the hard drive when 
memory is low.

You don't need more than an array of item ids and quantities, methinks, 
so it should be small.



On 08/21/2003 06:38 PM Greg Ludington wrote:
1. Store your cart in session, and when that all works. For everyone. 
Gets to the checkout and funds are exchanged.
 
 
 While I agree with the previous posters who said that it would make
your
 life easier if you can require login, if you absolutely need to save
 carts of users regardless of login status, you might consider having
 your Cart object impelment
 javax.servlet.http.HttpSessionBindingListener.  Objects implementing
 this interface are notified when they are bound to or unbound from
 (either explicitly or by the session itself expiring/invalidated) a
 session, and can perform tasks at these times.
 
 In your case, when your Cart object is unbound you would save its
 contents to your database.  (Conversely, when you first bind a Cart
 object to a session, you can check the database and refresh its
 contents, if any.)  Nothing about this approach prohibits you from
 saving Cart information at other appropriate times -- user logins,
 purchases, and the like -- this approach just allows you the ability
to
 store information, like cart contents, at the end of a client session.
 
 -Greg
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-- 
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9


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



Generating logs w/Log4J in ActionClass

2003-08-22 Thread Kapadia Mitesh-C23457
I have the appropriate configurations completed to use Log4J w/Tomcat. 
However, how would I invoke Log4J from within my action class to generate
DEBUG statements? 
I have the following package imported: 
import org.apache.log4j.*; 
Any examples would be most appreciated. 
Thanks in advance. 
- Mitesh 


RE: Disallow user to modify URL in browser address bar

2003-08-22 Thread Andrew Hill
wait wait I know!

idea type=silly today=friday drink=beer
Have only ONE url for the whole application.
Give every page a hidden field named theRealUrl and all links etc
actually fire javascript that sets this hidden field and POST to that one
acceptable url, then you have a filter (or override ActionServlet) that uses
the value in theRealUrl to redirect the request appropriately. Any request
that doesnt have a value for theRealUrl gets shunted off to the access
denied page...
/idea

hehe, or to quote James: Good Luck!!!

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED]
Sent: Friday, 22 August 2003 19:22
To: 'Struts Users Mailing List'
Subject: RE: Disallow user to modify URL in browser address bar


What you are wanting is not possible.
It's YOUR job (as a developer) to handle situations where they may have
done so.

Hint: unknown=true

Good Luck!!!

--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx




 -Original Message-
 From: sriram [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 2:16 AM
 To: 'Struts Users Mailing List'
 Subject: Disallow user to modify URL in browser address bar


 How to identify if user has manipulated the URL in Address
 Bar of the browser?

 For ex., the application displays a page with the following URL:

 http://localhost:8080/app/str/testview_srchpost.do

 Now, the user modifies the URL in the address bard. Instead
 of testview_srchpost.do, user types testtwoview_srchpost.do
 and clicks ENTER.

 I want to restrict such types of URL modification Struts
 application. I should take the user to a default access
 denied page when ever user does such changes.

 How to identify this action of the user? Pl. give some ideas.




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



struts test info

2003-08-22 Thread ronanoc
Can anyone point me in the direction of good examples and info about 
using/writing Struts tests other than the documentation that comes 
with Struts test it self...?

Thanks in advance.

Ron.
Always ready to Discotogogo
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Disallow user to modify URL in browser address bar

2003-08-22 Thread rajendra . x . yadav

If the user is allowed to view the page, then no problem. If he is not..
then you should have some sessionid authentication and user role and
privilige authentication in every page.

I think that's the only way of preventing a user to go to a restricted
page.

thanks
-raj



   

  sriram   

  [EMAIL PROTECTED]To:   'Struts Users Mailing 
List' [EMAIL PROTECTED]
  h.com   cc: 

   Subject:  Disallow user to modify URL 
in browser address bar
  22/08/2003 11:45 

  AM   

  Please respond to

  Struts Users

  Mailing List

   

   





How to identify if user has manipulated the URL in Address Bar of the
browser?

For ex., the application displays a page with the following URL:

http://localhost:8080/app/str/testview_srchpost.do

Now, the user modifies the URL in the address bard. Instead of
testview_srchpost.do, user types testtwoview_srchpost.do and clicks ENTER.

I want to restrict such types of URL modification Struts application. I
should take the user to a default access denied page when ever user does
such changes.

How to identify this action of the user? Pl. give some ideas.







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



RE: Whats the security trick for not permiting the browser back button on SignOut?

2003-08-22 Thread Edgar Dollin
Just invalidate the session when the user logs out.

Edgar

 -Original Message-
 From: Cezar Nasui [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, August 21, 2003 5:30 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Whats the security trick for not permiting the 
 browser back button on SignOut?
 
 
 Hi Brad,
 
 Isn't suggested not to use with Struts direct links to the jsp pages?
 a href=javascript:location.replace('somePageName.jsp') /a
 I don't recall exactly if this is the code needed to 
 erase/change the location but it looks just like simple 
 html link and still I think this doesn't solve my refresh 
 problem I mentioned before
 
 Cezar
 
 -Original Message-
 From: Brad Balmer [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 8:07 AM
 To: Struts Users Mailing List
 Subject: Re: Whats the security trick for not permiting the 
 browser back button on SignOut?
 
 
 I ran into a similar problem with my login application.  What 
 I did was simply replace the page name that is put in the 
 history with a page that I wanted.
 
 a href=javascript:location.replace('somePageName.jsp') /a
 
 
 
 Cezar Nasui wrote:
 
 Hi Henry,
 
 The problem I noticed is if you go Back to the first page 
 after login 
 and make a refresh on that page  you will be able to 
 navigate again in 
 your app as a  new session is created 'cause refresh re-post 
 the login 
 data. Your app does that? Do you know any solution for this one? I 
 think with some JavaScript you can erase the history of the Back 
 button.
 I
 don;t recall exaclty the code but I'll look for it. What I 
 want to know 
 is if it's a good method as we know we shouldn't rely on user's 
 settings (ex. Javascript not enabled).
 
 Cezar
 
 -Original Message-
 From: Henry Voyer [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 20, 2003 7:30 PM
 To: [EMAIL PROTECTED]
 Subject: Whats the security trick for not permiting the browser back 
 button on SignOut?
 
 
 Hi fellow Strutser
 
 I have implemented securityFilter (http://securityFilter.org) in my 
 struts app. But once i log off i can press the browsers back 
 button and 
 go back to the users content page.
 He cant do any action since the securityFilter dont let him 
 but he can
 still
 see the pages he already accessed.  i would like to know how to 
 implement the redirection to signIn page for the browser back button 
 once he SignOut.
 
 I have seen the examples of the Apache Admin site and the 
 security app 
 examples but i cant find how they do this.
 
 So guys whats the trick?
 
 Regards and thanks for all those who worked on the securityFilter and
 struts
 examples.
 
 _
 Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
 http://join.msn.com/?page=features/featuredemail
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
 
 
 -
 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]
 
 
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003
 
 

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



accessing ApplcationResources from an ExceptionHandler

2003-08-22 Thread Adolfo Miguelez
hi,

having a key of the ApplicationResources.properties in an ExceptionHandler 
subclass, how could I get its corresponding value in the 
ApplicationResources from there? Thanks in advance.

_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


RE: how many concurent users on the system

2003-08-22 Thread Alex Shneyderman
It is impossible to show how many users. What is possible is to show how
many sessions are open and what is the idle time for the session at a
given moment. If you use tomcat there is a manager (not admin) app that
comes with it. It is pretty cool to play around with it. You can do
other things with it besides displaying current sessions. If you do not
use tomcat then use manager app to see how they implemented it. It is
pretty straight forward, you can kind of guess what to do by just
browsing the JavaDoc for servlet.

Alex.

 -Original Message-
 From: Rachid Drissi [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 7:21 PM
 To: [EMAIL PROTECTED]
 Subject: how many concurent users on the system
 
 Hi All,
 
 anybody knows by chance a program(s) that  would show us (statistics)
how
 many concurent users are on the application at certain point of
time
 
 Thanks,
 Rachid.


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



RE: How to set charset UTF-8

2003-08-22 Thread David Sperling
If you want to have both the content type and the encoding set to utf-8
with just one jsp page 
tag you can use the encoding filter found in Tomcat
4.1/webapps/test/WEB-INF/classes/filters
I think it's called SetCharacterEncodingFilter.java.  

Do a google search to find more details on adding it to your web.xml.  



Cheers,

David Sperling

-Original Message-
From: struts [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 4:44 AM
To: 'Struts Users Mailing List'; 'Billy Ng'
Subject: RE: How to set charset UTF-8


Did you try % request.setCharacterEncoding(UTF-8); %  ?

-Original Message-
From: Billy Ng [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 4:14 PM
To: Struts Users Mailing List
Subject: How to set charset UTF-8


Hi folks,

I added the following to test what encoding my Struts app is using

%  
   response.setContentType(text/html; charset=UTF-8);
   System.out.println(response.getCharacterEncoding());
%

But it still print out the ISO-8859-1, why?  How can I set the
contentType to text/html; charset=UTF-8

Thanks!

Billy Ng


This mailbox protected from junk email by Matador
from MailFrontier, Inc. http://info.mailfrontier.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: problems with ActionConfig

2003-08-22 Thread Geronimo Ma. Hernandez
Sorry Andrew,

I found the bug. It was a PEBCAK - I added the property to the wrong action.
Now I the ActionConfig is the same and it works ;-))

lots of beer and a nice weekend 

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



Re: Struts Action or EJB session bean

2003-08-22 Thread rajendra . x . yadav

Struts Upload Action.

thanks
-raj



   

  Erez Efrati

  [EMAIL PROTECTED]To:   'Struts Users Mailing 
List' [EMAIL PROTECTED]
  et.il   cc: 

   Subject:  Struts Action or EJB session 
bean 
  22/08/2003 05:32 

  PM   

  Please respond to

  Struts Users

  Mailing List

   

   





My EJB/Web application lets users upload files to the system and later
serve them those files when needed. My question is:
Who should or recommended to handle the saving of the uploaded file? The
EJB session bean or the struts UploadAction?

Thanks in advance,
Erez






-
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: Disallow user to modify URL in browser address bar

2003-08-22 Thread sriram
Rajendra,

I've used the following code in my .jsp page:

%
if ((request.getHeader(referer)==) || (request.getHeader(referer)==null)) {
%
jsp:forward page=../jsp/logoff.jsp/
% 
}
%

If the user tries to manipulate the URL in the address bar, referer becomes null.

It works..but not sure how reliable is this!

Sriram

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 2:09 PM
To: Struts Users Mailing List
Subject: Re: Disallow user to modify URL in browser address bar



If the user is allowed to view the page, then no problem. If he is not.. then you 
should have some sessionid authentication and user role and privilige authentication 
in every page.

I think that's the only way of preventing a user to go to a restricted page.

thanks
-raj



   

  sriram   

  [EMAIL PROTECTED]To:   'Struts Users Mailing 
List' [EMAIL PROTECTED]
  h.com   cc: 

   Subject:  Disallow user to modify URL 
in browser address bar
  22/08/2003 11:45 

  AM   

  Please respond to

  Struts Users

  Mailing List

   

   





How to identify if user has manipulated the URL in Address Bar of the browser?

For ex., the application displays a page with the following URL:

http://localhost:8080/app/str/testview_srchpost.do

Now, the user modifies the URL in the address bard. Instead of testview_srchpost.do, 
user types testtwoview_srchpost.do and clicks ENTER.

I want to restrict such types of URL modification Struts application. I should take 
the user to a default access denied page when ever user does such changes.

How to identify this action of the user? Pl. give some ideas.







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


Re: Validating uploaded file as an image only

2003-08-22 Thread Adam L
I do it the brute force way:

 snip -
FormFile image;



java.awt.Image makeimg = null;

try
{
makeimg = Toolkit.getDefaultToolkit().createImage(
image.getFileData() );

//  wait for the image to be loaded/created

Canvas cv = new Canvas();
MediaTracker media_tracker = new MediaTracker( cv );

// add image to the tracker
int id = 0;
media_tracker.addImage(makeimg,id);

// try to wait for image to be loaded
// catch if loading was interrupted
media_tracker.waitForID(id);
// if we can't load it, it'll get tossed back from the catch()

// by now we should have a good image to deal with

// check on image dimensions
int imgw = makeimg.getWidth( cv );
int imgh = makeimg.getHeight( cv );

}
catch (..)


end snip--

I also check for file size (ie, dont' allow anything over 1M), and then
image dimensions.   The only thing I don't do is validate the mime-type.
I haven't tried uploading images from a text browser (ie lynx or links),
yet, to see what sort of mime-type it would attach.. but the ones from IE
always seem to be fine.


cheers!

-- adam


- Original Message -
From: Brian McSweeney [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 6:32 AM
Subject: RE: Validating uploaded file as an image only


 PS - there was a discussion recently on how to improve the
 Validator.


 Validating an uploaded file based on mime type would be cool !

 A quick search on the web led me to a company that does this
 With a java api

 http://www.oop-reserch.com/mime_prop.html

 It seems in jdk1.4 you can actually validate based on the
 binary pattern expected for a mime type. So if it is a gif,
 you can check that the bit pattern of the uploaded file
 matches that of a gif.

 This is apparently to avoid users uploading say a text file
 named mytextfile.gif

 Now that would be nice :-)
 Brian


 -Original Message-
 From: Brian McSweeney [mailto:[EMAIL PROTECTED]
 Sent: 22 August 2003 11:13
 To: 'Struts Users Mailing List'
 Subject: Validating uploaded file as an image only

 Hi everyone,

 I've managed to get the struts file upload working successfully,
 using the struts FormFile class and the upload example.

 Cool :-)

 However, in my app, I only want images to be uploaded.
 I'm going to store the images on disk and put the path of the
 image file into the database. So I need to validate that only images
 are getting uploaded, not other file-types.

 I know nothing really about how to do this. I could just check that
 string returned by:

 FormFile.getContentType( )

 is equal to image-gif, image-bnp, or image-jpeg. But is this enough?


 Also, I have noticed that when I upload an image file and the little
 Browser window pops up, if I select a gif image, but the file type
 bar says All files then the file isn't recognized as an image.
 It's recognized as an octet-stream. So does the browser window
 specify the file type to the browser?

 Anyway,

 Hope someone can give me some advice,
 As always,
 Thanks very much,
 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]



RE: Generating logs w/Log4J in ActionClass

2003-08-22 Thread Mike Jasnowski
In your action class, retrieve your log instance

Log LOG = LogFactory.getLog(YourAction.class);

Then wherever you need to log:

if (LOG.isDebugEnabled()) {
  LOG.debug(Log your debug msg here);
}

 Replace isDebugEnabled() with whatever level you want to use.

HTH,
Mike J

-Original Message-
From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 11:55 AM
To: [EMAIL PROTECTED]
Subject: Generating logs w/Log4J in ActionClass


I have the appropriate configurations completed to use Log4J w/Tomcat. 
However, how would I invoke Log4J from within my action class to generate
DEBUG statements? 
I have the following package imported: 
import org.apache.log4j.*; 
Any examples would be most appreciated. 
Thanks in advance. 
- Mitesh 


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



RE: Horizon: a view management plugin

2003-08-22 Thread Robert Taylor
Hue, one reason why I took this approach was because I felt that
although DynaActionForms implement the DynaBean interface, they
are meant to deal with user input where as the views described
by Pedro are simply value objects used to transport data from
the business tier to the web tier.

I guess you could define both DynaActionForms and views in the
struts-config file, but then what if you want to use these declarative
views outside of struts.

Another reason might be that although DynaActionForms could be used
in such a fashion, they are seen as part of the web tier and it is
not considered a good practice for the business tier to have knowlege
of web tier stuff.

The real advantage here is to be able to define value objects declaratively
just like you do with DynaActionForms.

Pedro, speak up if I have misinterpretted your intentions.

robert

 -Original Message-
 From: Hue Holleran [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 4:40 PM
 To: Struts Users Mailing List; [EMAIL PROTECTED]
 Subject: RE: Horizon: a view management plugin


 I must confess to being a bit confused!  What is the difference
 between your
 approach and getting an instance of a Dyna, viz:

 DynaActionFormClass dafc =
 DynaActionFormClass.getDynaActionFormClass(Dyna-Definition-Name-I
 n-Struts-C
 onfig);
 DynaActionForm myBean = (DynaActionForm) dafc.newInstance();

 At least with the above approach the beans are stored in struts-config in
 the usual struts syntax - it's just they're not used in the action name
 parameter - but are created on-the-fly in an action (or wherever) with the
 above code.

 I'm concerned I may be missing some obvious advantage to your approach -
 hence the reason for the question!

 Hue.

  -Original Message-
  From: Pedro Emanuel de Castro Faria Salgado
  [mailto:[EMAIL PROTECTED]
  Sent: 21 August 2003 16:15
  To: [EMAIL PROTECTED]
  Subject: Re: Horizon: a view management plugin
 
 
 
   Pedro Emanuel de Castro Faria Salgado wrote:
  
  Hi,
  
 I have built a plugin for Struts that creates view beans using
  dynabeans that are defined on a xml file and i was wondering if anyone
   in the Struts project/mailing list was interested on checking the use
   of it?
  
   When I see dynabean are you saying BeanUtils.DynaBean and what is a
   'view bean',
   do you mean a Action Form ?
 
  yes
 
   If so what is the difference between  your
   plugin and  a DynaActionForm ?
 
  i think, actually, there is none... the difference is for what i use
  the view beans for: transfering data from actions to
  build combobox on form and present data that isn't on a form.
 
  i know i can use the form itself to put a collection to
  build a combobox and use another form bean property
  to store the user input but it is less
  confusing if i define forms with only the properties the
  user can enter data and
  another bean for transmitting data (dto... in my case i call it
  view bean).
 
  before the plugin i had to define a new java class
  (attributes + getters/setters) for each
  new dto i wanted, now, i only need to add some lines
  to a xml file...
 
  
   Given that your plugin is generally useful then there are several
   options :
  
   1) Since web space can gotten for free now days you could
 always post it
on a site with
   some documentation on how to use it.
 
  i will see what i can do...
 
   2) We are using the http://www.sf.net/projects/struts site as an
   incubator for projects you can post there
to see if there is interest.
 
  thank you for the tip...
 
   3) Find someone else with a struts web site, that would host it.
  
   Most importantly having an example, that is documented is key.
  
 
  I have already sent the source on another email so
  you can take a look (src + javadoc + ant file)
  and i am finishing a small web app.
 
 
  thanks for the tips...
 
  Pedro Salgado
  
  
  
  
 - 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]
 
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


 -
 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] Shopping cart best practices - Cookie, HttpSession or DB

2003-08-22 Thread Mark Lowe
Storing a few bits and pieces in a session is all storing a cart will 
do anyway. While I can see why some folks would consider it a clear 
benefit to save all carts to the db , i don't. But that can be layered 
on afterwards, especially with handy packages like beanutils. Given 
that most the folks who know about these things say the biggest 
bottleneck is the DB stuff, I'd want to approach this in a manner where 
i could move stuff around.

When you get to testing you see how many sessions you can have running. 
The storage of an array of id's would be a nice solution if things 
start to look bloated, but doing this before would be stamping on 
problems that aren't there yet. If I had to walk into someone's code 
i'd prefer if carts had appropriate properties and the products in the 
cart were also product like.

Cart cart = (Cart) session.getAttribute(cart);
Product product = new Product();
BeanUtils.copyProperties( product , theForm.get(product) );
cart.addProduct(product);

If i had to pull a bunch of keys and indices from an array I'd be dummy 
spitting i think.

Cheers Mark

On Thursday, August 21, 2003, at 11:07 PM, Adam Hardy wrote:

I think the issue of using up server memory with lots of shopping 
carts in the session is worth thinking about. It's just a question of 
maths - how much memory have you got, what is the peak number of users 
envisaged, how much stuff are you going to store in the session? even 
then I think some app servers swap out sessions to the hard drive when 
memory is low.

You don't need more than an array of item ids and quantities, 
methinks, so it should be small.



On 08/21/2003 06:38 PM Greg Ludington wrote:
1. Store your cart in session, and when that all works. For 
everyone. Gets to the checkout and funds are exchanged.
While I agree with the previous posters who said that it would make 
your
life easier if you can require login, if you absolutely need to save
carts of users regardless of login status, you might consider having
your Cart object impelment
javax.servlet.http.HttpSessionBindingListener.  Objects implementing
this interface are notified when they are bound to or unbound from
(either explicitly or by the session itself expiring/invalidated) a
session, and can perform tasks at these times.
In your case, when your Cart object is unbound you would save its
contents to your database.  (Conversely, when you first bind a Cart
object to a session, you can check the database and refresh its
contents, if any.)  Nothing about this approach prohibits you from
saving Cart information at other appropriate times -- user logins,
purchases, and the like -- this approach just allows you the ability 
to
store information, like cart contents, at the end of a client session.
-Greg
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
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: Generating logs w/Log4J in ActionClass

2003-08-22 Thread Mike Jasnowski
Sorry, this is with commons logging not log4j specifically

-Original Message-
From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 9:29 AM
To: Struts Users Mailing List
Subject: RE: Generating logs w/Log4J in ActionClass


In your action class, retrieve your log instance

Log LOG = LogFactory.getLog(YourAction.class);

Then wherever you need to log:

if (LOG.isDebugEnabled()) {
  LOG.debug(Log your debug msg here);
}

 Replace isDebugEnabled() with whatever level you want to use.

HTH,
Mike J

-Original Message-
From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 11:55 AM
To: [EMAIL PROTECTED]
Subject: Generating logs w/Log4J in ActionClass


I have the appropriate configurations completed to use Log4J w/Tomcat. 
However, how would I invoke Log4J from within my action class to generate
DEBUG statements? 
I have the following package imported: 
import org.apache.log4j.*; 
Any examples would be most appreciated. 
Thanks in advance. 
- Mitesh 


-
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: Disallow user to modify URL in browser address bar

2003-08-22 Thread Syed, Nazeer

If testview_srchpost.do and  testtwoview_srchpost.do are valid action
then you cannot restrict. This means testview_srchpost.do,
esttwoview_srchpost.do are in Struts Config File 

If that testtwoview_srchpost.do not Valid action then It will go default
page or Error Page

Thanks
Nazeer


-Original Message-
From: sriram [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 2:16 AM
To: 'Struts Users Mailing List'
Subject: Disallow user to modify URL in browser address bar

How to identify if user has manipulated the URL in Address Bar of the
browser?

For ex., the application displays a page with the following URL:

http://localhost:8080/app/str/testview_srchpost.do

Now, the user modifies the URL in the address bard. Instead of
testview_srchpost.do, user types testtwoview_srchpost.do and clicks
ENTER.

I want to restrict such types of URL modification Struts application. I
should take the user to a default access denied page when ever user does
such changes.

How to identify this action of the user? Pl. give some ideas.


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



Re: Generating logs w/Log4J in ActionClass

2003-08-22 Thread David Stemm
I just create a class that wraps the log statements and would have a
function like this:

public static void debug(String message, String aCategory)
   {
  Category cat = Category.getInstance(aCategory);
  cat.debug(message);
   }

then when I need to use this I would call something like:

MyLogger.debug(Message, this.getClass().getName());

Hope that helps.

- Original Message - 
From: Mike Jasnowski [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 8:33 AM
Subject: RE: Generating logs w/Log4J in ActionClass


 Sorry, this is with commons logging not log4j specifically

 -Original Message-
 From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 9:29 AM
 To: Struts Users Mailing List
 Subject: RE: Generating logs w/Log4J in ActionClass


 In your action class, retrieve your log instance

 Log LOG = LogFactory.getLog(YourAction.class);

 Then wherever you need to log:

 if (LOG.isDebugEnabled()) {
   LOG.debug(Log your debug msg here);
 }

  Replace isDebugEnabled() with whatever level you want to use.

 HTH,
 Mike J

 -Original Message-
 From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 11:55 AM
 To: [EMAIL PROTECTED]
 Subject: Generating logs w/Log4J in ActionClass


 I have the appropriate configurations completed to use Log4J w/Tomcat.
 However, how would I invoke Log4J from within my action class to generate
 DEBUG statements?
 I have the following package imported:
 import org.apache.log4j.*;
 Any examples would be most appreciated.
 Thanks in advance.
 - Mitesh


 -
 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: Nested tags and recursive inclusion

2003-08-22 Thread PREETAM Balijepalli
Hi Yamini

I am sorry that  did not respond  imeadetly got stuck in some work

tiles:insert page=treenode.jsp flush=false/
use this instead of jsp include it has to work..

cheer up
preetam

-Original Message-
From: Yamini Krishnamurthi Ayyagari [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 4:23 PM
To: Struts Users Mailing List
Subject: Nested tags and recursive inclusion


Hello, 
I am trying to make recursive inclusion work with nested tags on Websphere but am 
running into some problems. This is what my code looks like. In main jsp:

  nested:nest property=tree
jsp:include page=treenode.jsp flush=true/
  /nested:nest

But I get an exception stating: Illegal to flush within a custom tag.
If I do not flush I get an invalid jsp:include tag exception. Can someone help me with 
this?

Thanks and Regards
Yamini Ayyagari

-
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: Disallow user to modify URL in browser address bar

2003-08-22 Thread rajendra . x . yadav

This looks reliable enough, but still i would suggest to do a role and user
chec on each page (only if the application requires it)

thanks
-raj



   

  sriram   

  [EMAIL PROTECTED]To:   'Struts Users Mailing 
List' [EMAIL PROTECTED]
  h.com   cc:   Rajendra X. 
Yadav/EMPL/India/[EMAIL PROTECTED]  
   Subject:  RE: Disallow user to modify 
URL in browser address bar
  22/08/2003 06:13 

  PM   

  Please respond to

  Struts Users

  Mailing List

   

   





Rajendra,

I've used the following code in my .jsp page:

%
if ((request.getHeader(referer)==) || (request.getHeader(referer)
==null)) {
%
 jsp:forward page=../jsp/logoff.jsp/
%
}
%

If the user tries to manipulate the URL in the address bar, referer
becomes null.

It works..but not sure how reliable is this!

Sriram

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 2:09 PM
To: Struts Users Mailing List
Subject: Re: Disallow user to modify URL in browser address bar



If the user is allowed to view the page, then no problem. If he is not..
then you should have some sessionid authentication and user role and
privilige authentication in every page.

I think that's the only way of preventing a user to go to a restricted
page.

thanks
-raj




  sriram

  [EMAIL PROTECTED]To:   'Struts Users
Mailing List' [EMAIL PROTECTED]
  h.com   cc:

   Subject:  Disallow user to
modify URL in browser address bar
  22/08/2003 11:45

  AM

  Please respond to

  Struts Users

  Mailing List







How to identify if user has manipulated the URL in Address Bar of the
browser?

For ex., the application displays a page with the following URL:

http://localhost:8080/app/str/testview_srchpost.do

Now, the user modifies the URL in the address bard. Instead of
testview_srchpost.do, user types testtwoview_srchpost.do and clicks ENTER.

I want to restrict such types of URL modification Struts application. I
should take the user to a default access denied page when ever user does
such changes.

How to identify this action of the user? Pl. give some ideas.







-
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: problems with ActionConfig

2003-08-22 Thread Geronimo Ma. Hernandez
Andrew Hill wrote:
 Based on the information you have provided it *should* work! 

Thanks ;-)

I added some more logs and it looks like the action receives another instance 
from ActonConfig, than that was created during configuration-setup.
I dumped the hashcode of the ActionConfig.
At creation #15198443 and inside the action #17370198

Hmm. Looks quite different. So do I need to implement something like clone()?
Did I mention, that I'm working with multiple modules?

 btw
 I'll be heading home shortly (its 7:30pm here) so I might not get to see
 the reply till Monday.
 /btw
 
Hey, that's a pretty nice tag! I would like it in my taglib  :-D

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



RE: Validating uploaded file as an image only

2003-08-22 Thread Brian McSweeney
Hi Adam,
Cool! I had no clue that any of this was available.
A few questions if you don't mind.

What is the purpose of using the MediaTracker?

I understand how using 

Image makeimg = Toolkit.getDefaultToolkit().createImage(
image.getFileData() );

will show you if it's a proper image, but I don't understand 
how the MediaTracker class helps? Does it just show if the 
image could be re-displayed or something?

If that assumption is correct, then the javadocs say that: 

If there is an error while loading or scaling an image, then that image
is considered to have finished loading. Use the isErrorAny and isErrorID
methods to check for errors. 

So should you perhaps use these isErrorAny or isErrorID methods too?

Any problems ever experienced?

Anyway, really appreciate this help,
Brian



-Original Message-
From: Adam L [mailto:[EMAIL PROTECTED] 
Sent: 22 August 2003 13:12
To: Struts Users Mailing List
Subject: Re: Validating uploaded file as an image only

I do it the brute force way:

 snip -
FormFile image;



java.awt.Image makeimg = null;

try
{
makeimg = Toolkit.getDefaultToolkit().createImage(
image.getFileData() );

//  wait for the image to be loaded/created

Canvas cv = new Canvas();
MediaTracker media_tracker = new MediaTracker( cv );

// add image to the tracker
int id = 0;
media_tracker.addImage(makeimg,id);

// try to wait for image to be loaded
// catch if loading was interrupted
media_tracker.waitForID(id);
// if we can't load it, it'll get tossed back from the
catch()

// by now we should have a good image to deal with

// check on image dimensions
int imgw = makeimg.getWidth( cv );
int imgh = makeimg.getHeight( cv );

}
catch (..)


end snip--

I also check for file size (ie, dont' allow anything over 1M), and then
image dimensions.   The only thing I don't do is validate the mime-type.
I haven't tried uploading images from a text browser (ie lynx or links),
yet, to see what sort of mime-type it would attach.. but the ones from
IE
always seem to be fine.


cheers!

-- adam


- Original Message -
From: Brian McSweeney [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 6:32 AM
Subject: RE: Validating uploaded file as an image only


 PS - there was a discussion recently on how to improve the
 Validator.


 Validating an uploaded file based on mime type would be cool !

 A quick search on the web led me to a company that does this
 With a java api

 http://www.oop-reserch.com/mime_prop.html

 It seems in jdk1.4 you can actually validate based on the
 binary pattern expected for a mime type. So if it is a gif,
 you can check that the bit pattern of the uploaded file
 matches that of a gif.

 This is apparently to avoid users uploading say a text file
 named mytextfile.gif

 Now that would be nice :-)
 Brian


 -Original Message-
 From: Brian McSweeney [mailto:[EMAIL PROTECTED]
 Sent: 22 August 2003 11:13
 To: 'Struts Users Mailing List'
 Subject: Validating uploaded file as an image only

 Hi everyone,

 I've managed to get the struts file upload working successfully,
 using the struts FormFile class and the upload example.

 Cool :-)

 However, in my app, I only want images to be uploaded.
 I'm going to store the images on disk and put the path of the
 image file into the database. So I need to validate that only images
 are getting uploaded, not other file-types.

 I know nothing really about how to do this. I could just check that
 string returned by:

 FormFile.getContentType( )

 is equal to image-gif, image-bnp, or image-jpeg. But is this enough?


 Also, I have noticed that when I upload an image file and the little
 Browser window pops up, if I select a gif image, but the file type
 bar says All files then the file isn't recognized as an image.
 It's recognized as an octet-stream. So does the browser window
 specify the file type to the browser?

 Anyway,

 Hope someone can give me some advice,
 As always,
 Thanks very much,
 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]



Logging to application directory

2003-08-22 Thread Louise Pryor
Is there any easy way of sending logs to somewhere in my application
directory, rather than eg Tomcat/logs? The latter is OK when I'm
developing the application on my own machine, but when I deploy onto
my shared host I don't have access to the Tomcat logs directory. And
however carefully I test on my own machine, I can't reproduce the
environment exactly and there's always something that goes wrong.

I have totally failed to get to grips with logging so far, so any help
will be appreciated.

Thanks

Louise

-- 
Louise Pryor 
http://www.louisepryor.com



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



RE: Quick Java question..

2003-08-22 Thread Chen, Gin
This question reminds me of an old virus.
You can have file IO that creates a simple java class file with a method
taking in as many parameters as you wanted to then invoke javac to rebuild
it. Performance-wise it worked great for the virus but probably not a viable
option for you ;) 

-Original Message-
From: Oliver Reflé [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 3:13 AM
To: 'Struts Users Mailing List'
Subject: AW: Quick Java question..


Or you simple pass in an array of arguments
public void myMethod(String[] args){}

Then you can handle as much Strings as you want
-Ursprüngliche Nachricht-
Von: Michael Thompson [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 22. August 2003 01:08
An: Struts Users Mailing List
Betreff: Re: Quick Java question..


Or wait till 1.5 ;)

http://developer.java.sun.com/developer/community/chat/JavaLive/2003/jl0
729.html

*Neal Gafter*: Then there's autoboxing/unboxing and varargs. Boxing 
allows you to use a primitive int instead of a |java.lang.Integer|, and 
unboxing does the reverse. varargs allows you to declare a method that 
takes a variable number of arguments, which are automatically packed up 
into an array before being passed to the method.


--m


Alex Shneyderman wrote:

You can make your parms Object []
This way you can pass as many params as you want.
Of course you will need to keep track of what element is what.

Maybe Java 1.5 will have the feature you are looking for :-)

Alex.

  

-Original Message-
From: Mark Galbreath [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:51 PM
To: 'Struts Users Mailing List'
Subject: RE: Quick Java question..

sorry, dude, but param arguments are evaluated at compile time.  The


best
  

you could do is overload the method.

Mark

-Original Message-
From: David Erickson [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:00 PM
To: Struts Mailing List
Subject: Quick Java question..


Hey as I've been building my actions I was thinking it could be useful


for
  

me to have a method that does some database querying, but I would like


to
  

give the user the ability to narrow down that query with as many input

fields as he needs.  Is there a way to write a method that takes a


non-set
  

amount of arguments?  (Other than just passing the method a growable 
array.. which is a viable alternative)

Ie

public String myfunction(String a, String b, String c on down the


line
  

indefinitly)

?
I thought I had seen this done somewhere somehow but I may be wrong. 
Thanks!


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19.08.2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19.08.2003
 


-
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: Nested tags and recursive inclusion

2003-08-22 Thread Paul McCulloch
I use this all the time with Tomcat. Maybe this is a websphere bug?

-Original Message-
From: Yamini Krishnamurthi Ayyagari [mailto:[EMAIL PROTECTED]
Sent: 22 August 2003 11:53
To: Struts Users Mailing List
Subject: Nested tags and recursive inclusion


Hello, 
I am trying to make recursive inclusion work with nested tags on Websphere
but am running into some problems. This is what my code looks like. In main
jsp:

  nested:nest property=tree
jsp:include page=treenode.jsp flush=true/
  /nested:nest

But I get an exception stating: Illegal to flush within a custom tag.
If I do not flush I get an invalid jsp:include tag exception. Can someone
help me with this?

Thanks and Regards
Yamini Ayyagari

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


**
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not 
the addressee indicated in this message (or responsible for delivery of the message to 
such person), you may not copy or deliver this message to anyone. In such case, you 
should destroy this message, and notify us immediately. If you or your employer does 
not consent to Internet email messages of this kind, please advise us immediately. 
Opinions, conclusions and other information expressed in this message are not given or 
endorsed by my Company or employer unless otherwise indicated by an authorised 
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted 
via electronic mail attachments we cannot guarantee that attachments do not contain 
computer virus code.  You are therefore strongly advised to undertake anti virus 
checks prior to accessing the attachment to this electronic mail.  Axios Systems Ltd 
grants no warranties regarding performance use or quality of any attachment and 
undertakes no liability for loss or damage howsoever caused.


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



RE: Logging to application directory

2003-08-22 Thread Navjot Singh
use log4j or jdk1.4 logging.

|-Original Message-
|From: Louise Pryor [mailto:[EMAIL PROTECTED]
|Sent: Friday, August 22, 2003 8:38 PM
|To: Struts Users Mailing List
|Subject: Logging to application directory
|
|
|Is there any easy way of sending logs to somewhere in my application
|directory, rather than eg Tomcat/logs? The latter is OK when I'm
|developing the application on my own machine, but when I deploy onto
|my shared host I don't have access to the Tomcat logs directory. And
|however carefully I test on my own machine, I can't reproduce the
|environment exactly and there's always something that goes wrong.
|
|I have totally failed to get to grips with logging so far, so any help
|will be appreciated.
|
|Thanks
|
|Louise
|
|-- 
|Louise Pryor 
|http://www.louisepryor.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: Struts Action or EJB session bean

2003-08-22 Thread Navjot Singh
file uploading is user front job and let the Struts handle it. 
Sessionbeans are bad choice!!


|-Original Message-
|From: Erez Efrati [mailto:[EMAIL PROTECTED]
|Sent: Friday, August 22, 2003 5:33 PM
|To: 'Struts Users Mailing List'
|Subject: Struts Action or EJB session bean
|
|
|My EJB/Web application lets users upload files to the system and later
|serve them those files when needed. My question is:
|Who should or recommended to handle the saving of the uploaded file? The
|EJB session bean or the struts UploadAction?
|
|Thanks in advance,
|Erez
|
|
|
|
|
|
|-
|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: Generating logs w/Log4J in ActionClass

2003-08-22 Thread Navjot Singh
i just vaguely remember
private Logger logger = Logger.getLogger(Test.class);
logger.debug(Better Check log4j docs);

and keep the log4j.properties file in classpath.

hth
navjot singh


|-Original Message-
|From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED]
|Sent: Thursday, August 21, 2003 9:25 PM
|To: [EMAIL PROTECTED]
|Subject: Generating logs w/Log4J in ActionClass
|
|
|I have the appropriate configurations completed to use Log4J w/Tomcat. 
|However, how would I invoke Log4J from within my action class to generate
|DEBUG statements? 
|I have the following package imported: 
|import org.apache.log4j.*; 
|Any examples would be most appreciated. 
|Thanks in advance. 
|- Mitesh 
|

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



RE: Whats the security trick for not permiting the browser back button on SignOut?

2003-08-22 Thread Cezar Nasui
Hi Edgar,

this is what I do but it will never diable the Back button.
By any chance did you tried to :
- do the log out then
- click browser's Back right to the first page after signup,
- do a Refresh and then
- try your links from this page.

Could you tell me the result please?
I looked at many post, I saw the token example used for not submiting
twice the data to the database on refresh but I could make it work on Login.
The token example suggest that you can control the form (you arrive to it
from an action so you can add the save(token) line) but it doesn't work for
the Login case where the form is on the first page of the app.

Brad
adding the line for replacing the browser history implies that you have to
add this line to every page that can be called from the page you want to
hide. Is it true?
And again where do you add the line? In the head of your jsp page?

Cezar

-Original Message-
From: Edgar Dollin [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 8:49 AM
To: 'Struts Users Mailing List'
Subject: RE: Whats the security trick for not permiting the browser back
button on SignOut?


Just invalidate the session when the user logs out.

Edgar

 -Original Message-
 From: Cezar Nasui [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 5:30 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Whats the security trick for not permiting the
 browser back button on SignOut?


 Hi Brad,

 Isn't suggested not to use with Struts direct links to the jsp pages?
 a href=javascript:location.replace('somePageName.jsp') /a
 I don't recall exactly if this is the code needed to
 erase/change the location but it looks just like simple
 html link and still I think this doesn't solve my refresh
 problem I mentioned before

 Cezar
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003


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



Re: struts test info

2003-08-22 Thread Dan Tran
http://strutstestcase.sourceforge.net/

-Dan
- Original Message - 
From: ronanoc [EMAIL PROTECTED]
To: Struts List [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 6:13 AM
Subject: struts test info


 Can anyone point me in the direction of good examples and info about 
 using/writing Struts tests other than the documentation that comes 
 with Struts test it self...?
 
 Thanks in advance.
 
 Ron.
 Always ready to Discotogogo
 
 
 -
 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: Validating uploaded file as an image only

2003-08-22 Thread Adam Levine
Use of the MediaTracker is way to track the status of any media.

From the MediaTracker javadoc:
  The MediaTracker class is a utility class to track the status of a number 
of media objects. Media objects could include audio clips as well as images, 
though currently only images are supported

From the Tutorial, section Loading Images:
 http://java.sun.com/docs/books/tutorial/uiswing/painting/usingImages.html

Basically, we use the mediatracker to be informed of when an image has been 
completely loaded.  The resource you're pulling could be local, could be 
remote.. thusly, the complete data load time could vary.  Since getImage() 
is non-blocking, this is how you know.

I suppose I could use those methods.. never really considered them.  I'm 
pretty sure I've tried uploading non-image files, and I recall this catching 
them as not being images.  but, it's been awhile, so ymmv.

cheers!

-- adam



I've never had any problems with this methodology.

From: Brian McSweeney [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Subject: RE: Validating uploaded file as an image only
Date: Fri, 22 Aug 2003 13:38:11 -
Hi Adam,
Cool! I had no clue that any of this was available.
A few questions if you don't mind.
What is the purpose of using the MediaTracker?

I understand how using

Image makeimg = Toolkit.getDefaultToolkit().createImage(
image.getFileData() );
will show you if it's a proper image, but I don't understand
how the MediaTracker class helps? Does it just show if the
image could be re-displayed or something?
If that assumption is correct, then the javadocs say that:

If there is an error while loading or scaling an image, then that image
is considered to have finished loading. Use the isErrorAny and isErrorID
methods to check for errors. 
So should you perhaps use these isErrorAny or isErrorID methods too?

Any problems ever experienced?

Anyway, really appreciate this help,
Brian


-Original Message-
From: Adam L [mailto:[EMAIL PROTECTED]
Sent: 22 August 2003 13:12
To: Struts Users Mailing List
Subject: Re: Validating uploaded file as an image only
I do it the brute force way:

 snip -
FormFile image;


java.awt.Image makeimg = null;

try
{
makeimg = Toolkit.getDefaultToolkit().createImage(
image.getFileData() );
//  wait for the image to be loaded/created

Canvas cv = new Canvas();
MediaTracker media_tracker = new MediaTracker( cv );
// add image to the tracker
int id = 0;
media_tracker.addImage(makeimg,id);
// try to wait for image to be loaded
// catch if loading was interrupted
media_tracker.waitForID(id);
// if we can't load it, it'll get tossed back from the
catch()
// by now we should have a good image to deal with

// check on image dimensions
int imgw = makeimg.getWidth( cv );
int imgh = makeimg.getHeight( cv );
}
catch (..)
end snip--

I also check for file size (ie, dont' allow anything over 1M), and then
image dimensions.   The only thing I don't do is validate the mime-type.
I haven't tried uploading images from a text browser (ie lynx or links),
yet, to see what sort of mime-type it would attach.. but the ones from
IE
always seem to be fine.
cheers!

-- adam

- Original Message -
From: Brian McSweeney [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 6:32 AM
Subject: RE: Validating uploaded file as an image only
 PS - there was a discussion recently on how to improve the
 Validator.


 Validating an uploaded file based on mime type would be cool !

 A quick search on the web led me to a company that does this
 With a java api

 http://www.oop-reserch.com/mime_prop.html

 It seems in jdk1.4 you can actually validate based on the
 binary pattern expected for a mime type. So if it is a gif,
 you can check that the bit pattern of the uploaded file
 matches that of a gif.

 This is apparently to avoid users uploading say a text file
 named mytextfile.gif

 Now that would be nice :-)
 Brian


 -Original Message-
 From: Brian McSweeney [mailto:[EMAIL PROTECTED]
 Sent: 22 August 2003 11:13
 To: 'Struts Users Mailing List'
 Subject: Validating uploaded file as an image only

 Hi everyone,

 I've managed to get the struts file upload working successfully,
 using the struts FormFile class and the upload example.

 Cool :-)

 However, in my app, I only want images to be uploaded.
 I'm going to store the images on disk and put the path of the
 image file into the database. So I need to validate that only images
 are getting uploaded, not other file-types.

 I know nothing really about how to do this. I could just check that
 string returned by:

 FormFile.getContentType( )

 is equal to image-gif, image-bnp, or image-jpeg. But is this 

[OT] JNDI datasource lookup to test classes

2003-08-22 Thread Leonardo Francalanci
In my DB tier I use an interface to get the connection.
When used under Tomcat, the class that implements the connection gets
the connecton through JNDI.
I want to test these classes outside of Tomcat.
Is there a simple way to put objects in the Context,
I mean a simple way to emulate Tomcat behavior?
I read the JNDI tutorial, but is the worse thing I've ever read.

At this moment I created a class that implements my interface
and that open a simple connection to the db, but in this way I need
to set the right interface (JNDI/Simple) in each class a want to test.



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



RE: Generating logs w/Log4J in ActionClass

2003-08-22 Thread Kapadia Mitesh-C23457
Thanks David.

Quick question -- do I just have the listed method you provided in my wrapper class?


-Original Message-
From: David Stemm [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 8:56 AM
To: Struts Users Mailing List
Subject: Re: Generating logs w/Log4J in ActionClass


I just create a class that wraps the log statements and would have a function like 
this:

public static void debug(String message, String aCategory)
   {
  Category cat = Category.getInstance(aCategory);
  cat.debug(message);
   }

then when I need to use this I would call something like:

MyLogger.debug(Message, this.getClass().getName());

Hope that helps.

- Original Message - 
From: Mike Jasnowski [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 8:33 AM
Subject: RE: Generating logs w/Log4J in ActionClass


 Sorry, this is with commons logging not log4j specifically

 -Original Message-
 From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 9:29 AM
 To: Struts Users Mailing List
 Subject: RE: Generating logs w/Log4J in ActionClass


 In your action class, retrieve your log instance

 Log LOG = LogFactory.getLog(YourAction.class);

 Then wherever you need to log:

 if (LOG.isDebugEnabled()) {
   LOG.debug(Log your debug msg here);
 }

  Replace isDebugEnabled() with whatever level you want to use.

 HTH,
 Mike J

 -Original Message-
 From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 11:55 AM
 To: [EMAIL PROTECTED]
 Subject: Generating logs w/Log4J in ActionClass


 I have the appropriate configurations completed to use Log4J w/Tomcat. 
 However, how would I invoke Log4J from within my action class to 
 generate DEBUG statements? I have the following package imported:
 import org.apache.log4j.*;
 Any examples would be most appreciated.
 Thanks in advance.
 - Mitesh


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



[FRIDAY] BeanUtils.populate and Booleans

2003-08-22 Thread Michael Ruppin
I know, I know, never use anything but Strings in an
ActionForm to be populated from the request.  I guess
this is the same old argument for that.

I recently thought it might be convenient to use a
Boolean, and it worked fine, until I re-used the Form
for a query jsp where this property was NOT
represented by a checkbox (Of course, I had to change
reset() to leave the property null instead of
defaulting false when mode=query is in the request).
 BeanUtils.populate does clearly specify that it only
handles setters for String, boolean, int, long, float,
and double.  Still, I was surprised to learn that when
an empty string was submitted for this property in the
request, my Boolean was set to false.

m

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: How to set charset UTF-8

2003-08-22 Thread Billy Ng
You know what, I was using the template.  As long as I added

% request.setCharacterEncoding(UTF-8); %

in the template.  It works now.

Thanks everybody

Billy Ng

This mailbox protected from junk email by Matador
from MailFrontier, Inc. http://info.mailfrontier.com

- Original Message - 
From: Jing Zhou [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 11:15 PM
Subject: Re: How to set charset UTF-8


 We got a similar problem. At the very beginning, it looks like the
 processContent() method in the request processor would do
 the job for you if the ControllerConfig is set correctly. But the
 story is more complicated than I thought.

 It looks to me the container has the right to override the content
 type and/or the character encoding. From the JSP Specification,
 we have some statements like A JSP container may use some
 implementation-dependent heuristics and/or structure to
 determine what the expected character encoding of a JSP page is...

 The default implementations from Tomcat, OC4J, and SunOne are different.
 jsp:directive.page pageEncoding=ISO-8859-1 contentType=text/html/

 is used in every JSP page. The Tomcat 4.1.24 generates a statement
 setContentType(text/html;charset=ISO-8859-1); // good
 The OC4J 9.0.3 generates the statement
 setContentType(text/html;charset=UTF-8); // something not expected
 The SunOne App7 generates the statement
 setContentType(text/html); // something shorter with warning message.
 The Resin 2.1.10 does the same as SunOne but without warning message.

 I am not sure what we are missing here. Anyway, we could not *force* them
 to produce the expected content type and the character encoding
 except on Tomcat.

 Jing
 Netspread Carrier
 http://www.netspread.com




 - Original Message - 
 From: Van Riper, Mike [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Cc: 'Billy Ng' [EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 4:30 PM
 Subject: RE: How to set charset UTF-8


   I added the following to test what encoding my Struts app is using
  
   %
  response.setContentType(text/html; charset=UTF-8);
  System.out.println(response.getCharacterEncoding());
   %
  
   But it still print out the ISO-8859-1, why?  How can I set
   the contentType to text/html; charset=UTF-8
 
  This is just a hunch, but, I suspect you can't change the character
 encoding
  after you have started writing content to the stream. In that case, your
  best bet is to do this at the very top of the JSP page:
 
   %@ page contentType=text/html;charset=UTF-8 language=java %
 
  Also, there is another consideration if you are using Tiles. Again this
is
  just a hunch, but, I suspect that you would have to have that directive
as
  the first line of your Tiles master layout template JSP. The concept
  mentioned above for a single page applies to a Tiles page generated
  dynamically from multiple JSPs all writing to the same response stream.
 
  We ran into something like this using the Struts template custom tags
with
  Struts 1.0 back in 2001. We were correctly setting the character
encoding
  using the page directive on individual content JSPs, but, had left it
off
  our master page layout template JSP. So, it never took until we tracked
 that
  down. Duh!
 
  Hope this helps, Van
 
  Mike Van Riper
  mailto:[EMAIL PROTECTED]
  http://www.baychi.org/bof/struts
 
 
  -
  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: Telling Users to Wait

2003-08-22 Thread Yee, Richard K,,DMDCWEST
Mark,
There is also another way to accomplish your goal that doesn't use the
refresh header. Basically, a servlet or JSP outputs a partial HTML page
using the flush() method. The partial page contains JavaScript that
typically writes out HTML tags that produce a table inside a span element
using the document.write(). The setTimeout JS method is then used to output
additional tags using the document.getElementById().innerHTML property to
output an image (typically animated) to the screen.

An onLoad attribute is used in the body tag to call another JavaScript
function that clears the timer and removes the animated image by setting the
innerHTML to .

Once your task is finished, your servlet outputs the rest of the page
containing the /body/html tags and possibly some JavaScript that
redirects to the completion page. I think this is the way that sites like
Expedia do their progress bars without using the refresh meta tag. It saves
the browser from having to poll the site and looks, in my opinion, slicker.

Regards,

Richard


-Original Message-
From: Mark Silva [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 5:03 PM
To: Struts Users Mailing List
Subject: Telling Users to Wait


Hello Struts Gurus,

I am facing an issue in my application where I need to run a database
creation script, and a database import script through the web (running bat
files on the server).  I can run these files fine, but they take a few
minutes to run...  

How can I tell the user when they have finished running?  This seems to be a
sort of push technology I am in need of, but maybe there is another way?.  I
can definitely tell them to wait for a few minutes, but how do I actually
tell them when the process is done (since there is not another page request
at this time.)

Has anyone done something similar to this?

Thanks,
Mark

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



GenericDataSource best practise?

2003-08-22 Thread Andy Cheng
Hi, currently I have something like the code below on every action, is
this the normal way of getting the connection?  And how would normal
people do if they want to make some data access objects, which contain
all the methods like insert, select etc, while the Action class will
purely do logic, for example only contain this kind of statements:
HashMap hmResult = dataAccess.getAllClients();  Thanks.

public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ServletContext context = servlet.getServletContext();
try {
DataSource dataSource =
(DataSource)context.getAttribute(Action.DATA_SOURCE_KEY);
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(SELECT * FROM aTable);
while(rs.next()) {
//...
}

} catch (Exception e) {
e.printStackTrace();
}
return (mapping.findForward(xxx));
}



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



Re: GenericDataSource best practise?

2003-08-22 Thread David Graham
--- Andy Cheng [EMAIL PROTECTED] wrote:
 Hi, currently I have something like the code below on every action, is
 this the normal way of getting the connection?  And how would normal
 people do if they want to make some data access objects, which contain
 all the methods like insert, select etc, while the Action class will
 purely do logic, for example only contain this kind of statements:
 HashMap hmResult = dataAccess.getAllClients();  Thanks.

Most apps lookup the DataSource from JNDI.  You configure the DataSource
in your container instead of struts-config.xml.

 
 public ActionForward perform(ActionMapping mapping, ActionForm form,
 HttpServletRequest request, HttpServletResponse response) {
 ServletContext context = servlet.getServletContext();
 try {
 DataSource dataSource =
 (DataSource)context.getAttribute(Action.DATA_SOURCE_KEY);
 Connection conn = dataSource.getConnection();
 Statement stmt = conn.createStatement();
 ResultSet rs = stmt.executeQuery(SELECT * FROM aTable);
 while(rs.next()) {
 //...
 }
 
 } catch (Exception e) {
 e.printStackTrace();
 }
 return (mapping.findForward(xxx));
   }

This is absolutely the wrong way of doing database access.  You *must*
properly cleanup JDBC resources on every access, including when exceptions
are thrown.  Doing this cleanup is tedious, boring, and error prone so I
created the Mapper project in the Jakata Commons Sandbox.  Check it out;
it significantly reduces the size of database access code as well as
isolates your app. from the persistence mechanism so you can swap it
later.

David

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


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Bypassing Form Validation

2003-08-22 Thread David Stemm
I'm having trouble trying to cancel out of a form.  I have a cancel button that looks 
like this:

html:submit title=Cancel value=Cancel property=submit tabindex='24' 
onclick=bCancel=true;/

and while the onclick event does cancel out the javascript validation it still goes 
ahead and performs the server-side validation and I get errors saying certain fields 
are required, etc.  I'm using a DynaValidatorForm and my action class inherits from 
DispatchAction.  Anybody have any ideas?


David Stemm

Re: Logging to application directory

2003-08-22 Thread Adam Hardy
In java 1.4 logging, in the java logging.properties file, it says:

# default file output is in user's home directory.
java.util.logging.FileHandler.pattern = %h/java%u.log
You can also log to the console and depending on what you have setup 
your app server scripts to do with output to the console, it might go to 
std.out somewhere or something like it.

hth
Adam
On 08/22/2003 05:14 PM Navjot Singh wrote:
use log4j or jdk1.4 logging.

|-Original Message-
|From: Louise Pryor [mailto:[EMAIL PROTECTED]
|Sent: Friday, August 22, 2003 8:38 PM
|To: Struts Users Mailing List
|Subject: Logging to application directory
|
|
|Is there any easy way of sending logs to somewhere in my application
|directory, rather than eg Tomcat/logs? The latter is OK when I'm
|developing the application on my own machine, but when I deploy onto
|my shared host I don't have access to the Tomcat logs directory. And
|however carefully I test on my own machine, I can't reproduce the
|environment exactly and there's always something that goes wrong.
|
|I have totally failed to get to grips with logging so far, so any help
|will be appreciated.
|
|Thanks
|
|Louise
|
|-- 
|Louise Pryor 
|http://www.louisepryor.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]

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [OT] JNDI datasource lookup to test classes

2003-08-22 Thread Manolo Ramirez T.
Maybe this files can help you.

Regards.


Manolo Ramirez T.
Leonardo Francalanci wrote:
In my DB tier I use an interface to get the connection.
When used under Tomcat, the class that implements the connection gets
the connecton through JNDI.
I want to test these classes outside of Tomcat.
Is there a simple way to put objects in the Context,
I mean a simple way to emulate Tomcat behavior?
I read the JNDI tutorial, but is the worse thing I've ever read.
At this moment I created a class that implements my interface
and that open a simple connection to the db, but in this way I need
to set the right interface (JNDI/Simple) in each class a want to test.


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


package com.handsoftware.utils;

import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class DBjndi {

protected static DataSource ds;

public static void init(String name) throws NamingException{
Context ctx = new InitialContext();
init(name,ctx);
}

public static void init(String name,Context context) throws NamingException {
ds = (DataSource)context.lookup(name);
}

public static Connection getConnection() throws SQLException {
if(ds == null)
throw new IllegalStateException(DBjndi was not initialized);
return ds.getConnection();
}
}
package com.handsoftware.utils.test;

import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class MockContext extends InitialContext {

Hashtable data;

public MockContext() throws NamingException{
super();
data = new Hashtable();
}

public Object add2Context(String name,Object obj) {
return data.put(name,obj);
}

public Object lookup(String name) throws NamingException {
Object obj=data.get(name);
if(obj!=null)
return obj;

return super.lookup(name);
}
}
package com.handsoftware.utils.test;

import javax.sql.DataSource;
import java.sql.*;
import java.io.PrintWriter;

public class MockDataSource implements DataSource {

protected Driver m_driver;
protected String m_url;
protected String m_user;
protected String m_passwd;

public MockDataSource(String driverClass, String url, String user, String passwd) {
try {
m_driver = (Driver)Class.forName(driverClass).newInstance();
DriverManager.registerDriver(m_driver);
} catch (Exception e) {
e.printStackTrace();
}

m_url=url;
m_user=user;
m_passwd=passwd;
}

public Connection getConnection() throws SQLException {
return DriverManager.getConnection(m_url,m_user,m_passwd);
}

public Connection getConnection(String username,String password) throws 
SQLException {
return DriverManager.getConnection(m_url,username,password);
}

public PrintWriter getLogWriter() throws SQLException {
return null;
}

public void setLogWriter(PrintWriter out) throws SQLException {
}

public void setLoginTimeout(int seconds) throws SQLException {
}

public int getLoginTimeout() throws SQLException {
return 0;
}

}
package com.handsoftware.utils;

import junit.framework.TestCase;
import com.handsoftware.utils.test.MockContext;
import com.handsoftware.utils.test.MockDataSource;
import java.sql.*;
import javax.naming.NamingException;

public class TestDBjndi extends TestCase {

public TestDBjndi () {
super();
}

public void setUp() throws NamingException {
MockContext context = new MockContext();
String jndiName=java:comp/env/jdbc/PruebasDB;
context.add2Context(jndiName,new MockDataSource(org.postgresql.Driver

,jdbc:postgresql://localhost:5432/pruebas
,manolo,)
);

DBjndi.init(jndiName,context);
}

public void testConnection() {

try {
Connection con = DBjndi.getConnection();

//insercion
PreparedStatement st =
con.prepareStatement(insert into pruebas(id,nombre,apellido) 
values(?,?,?));
st.setInt(1,666);
st.setString(2,juan);
st.setString(3,perez);
st.execute();

//select
st = con.prepareStatement(select nombre,apellido from pruebas where 
id=?);
st.setInt(1,666);
ResultSet rset = st.executeQuery();
rset.next();
assertEquals(no funciona select:nombre,rset.getString(nombre),juan);

RE: Horizon: a view management plugin

2003-08-22 Thread Pedro Emanuel de Castro Faria Salgado

  No, Richard that's it. :)

  I will be sending the example application for all who have replied
(later today - i am working now - maybe then it will be more obvious
the advantage of the framework. unfortunately, it will not make people
earn more money by just using it, but it will surely be easier and less
painful).

Pedro Salgado

 Hue, one reason why I took this approach was because I felt that
 although DynaActionForms implement the DynaBean interface, they
 are meant to deal with user input where as the views described
 by Pedro are simply value objects used to transport data from
 the business tier to the web tier.

 I guess you could define both DynaActionForms and views in the
 struts-config file, but then what if you want to use these declarative
 views outside of struts.

 Another reason might be that although DynaActionForms could be used in
 such a fashion, they are seen as part of the web tier and it is not
 considered a good practice for the business tier to have knowlege of
 web tier stuff.

 The real advantage here is to be able to define value objects
 declaratively just like you do with DynaActionForms.

 Pedro, speak up if I have misinterpretted your intentions.


 robert

 -Original Message-
 From: Hue Holleran [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 4:40 PM
 To: Struts Users Mailing List; [EMAIL PROTECTED]
 Subject: RE: Horizon: a view management plugin


 I must confess to being a bit confused!  What is the difference
 between your
 approach and getting an instance of a Dyna, viz:

 DynaActionFormClass dafc =
 DynaActionFormClass.getDynaActionFormClass(Dyna-Definition-Name-I
 n-Struts-C
 onfig);
 DynaActionForm myBean = (DynaActionForm) dafc.newInstance();

 At least with the above approach the beans are stored in struts-config
 in the usual struts syntax - it's just they're not used in the action
 name parameter - but are created on-the-fly in an action (or
 wherever) with the above code.

 I'm concerned I may be missing some obvious advantage to your approach
 - hence the reason for the question!

 Hue.

  -Original Message-
  From: Pedro Emanuel de Castro Faria Salgado
  [mailto:[EMAIL PROTECTED]
  Sent: 21 August 2003 16:15
  To: [EMAIL PROTECTED]
  Subject: Re: Horizon: a view management plugin
 
 
 
   Pedro Emanuel de Castro Faria Salgado wrote:
  
  Hi,
  
 I have built a plugin for Struts that creates view beans using
  dynabeans that are defined on a xml file and i was wondering if
 anyone
   in the Struts project/mailing list was interested on checking the
 use of it?
  
   When I see dynabean are you saying BeanUtils.DynaBean and what is
 a 'view bean',
   do you mean a Action Form ?
 
  yes
 
   If so what is the difference between  your
   plugin and  a DynaActionForm ?
 
  i think, actually, there is none... the difference is for what i use
 the view beans for: transfering data from actions to
  build combobox on form and present data that isn't on a form.
 
  i know i can use the form itself to put a collection to
  build a combobox and use another form bean property
  to store the user input but it is less
  confusing if i define forms with only the properties the
  user can enter data and
  another bean for transmitting data (dto... in my case i call it view
 bean).
 
  before the plugin i had to define a new java class
  (attributes + getters/setters) for each
  new dto i wanted, now, i only need to add some lines
  to a xml file...
 
  
   Given that your plugin is generally useful then there are several
 options :
  
   1) Since web space can gotten for free now days you could
 always post it
on a site with
   some documentation on how to use it.
 
  i will see what i can do...
 
   2) We are using the http://www.sf.net/projects/struts site as an
 incubator for projects you can post there
to see if there is interest.
 
  thank you for the tip...
 
   3) Find someone else with a struts web site, that would host it.
  
   Most importantly having an example, that is documented is key.
  
 
  I have already sent the source on another email so
  you can take a look (src + javadoc + ant file)
  and i am finishing a small web app.
 
 
  thanks for the tips...
 
  Pedro Salgado
  
  
  
  
 -
 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]
 
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


 

RE: Nested tags and recursive inclusion

2003-08-22 Thread Yamini Krishnamurthi Ayyagari
I think it is. Probably because WSAD 4.x uses JSP1.1 which requires the flush 
attribute in jsp:include. And the flush attribute cannot be used with custom tags.  I 
ran the application on Tomcat 5.0 and it worked fine.

Thanks
Yamini

-Original Message-
From: Paul McCulloch [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 8:38 PM
To: 'Struts Users Mailing List'
Subject: RE: Nested tags and recursive inclusion


I use this all the time with Tomcat. Maybe this is a websphere bug?

-Original Message-
From: Yamini Krishnamurthi Ayyagari [mailto:[EMAIL PROTECTED]
Sent: 22 August 2003 11:53
To: Struts Users Mailing List
Subject: Nested tags and recursive inclusion


Hello, 
I am trying to make recursive inclusion work with nested tags on Websphere
but am running into some problems. This is what my code looks like. In main
jsp:

  nested:nest property=tree
jsp:include page=treenode.jsp flush=true/
  /nested:nest

But I get an exception stating: Illegal to flush within a custom tag.
If I do not flush I get an invalid jsp:include tag exception. Can someone
help me with this?

Thanks and Regards
Yamini Ayyagari

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


**
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not 
the addressee indicated in this message (or responsible for delivery of the message to 
such person), you may not copy or deliver this message to anyone. In such case, you 
should destroy this message, and notify us immediately. If you or your employer does 
not consent to Internet email messages of this kind, please advise us immediately. 
Opinions, conclusions and other information expressed in this message are not given or 
endorsed by my Company or employer unless otherwise indicated by an authorised 
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted 
via electronic mail attachments we cannot guarantee that attachments do not contain 
computer virus code.  You are therefore strongly advised to undertake anti virus 
checks prior to accessing the attachment to this electronic mail.  Axios Systems Ltd 
grants no warranties regarding performance use or quality of any attachment and 
undertakes no liability for loss or damage howsoever caused.


-
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: Generating logs w/Log4J in ActionClass

2003-08-22 Thread David Stemm
I have methods for debug, info, warn and error.  Attached is a sample class
I use.

- Original Message - 
From: Kapadia Mitesh-C23457 [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 11:08 AM
Subject: RE: Generating logs w/Log4J in ActionClass


 Thanks David.

 Quick question -- do I just have the listed method you provided in my
wrapper class?


 -Original Message-
 From: David Stemm [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 8:56 AM
 To: Struts Users Mailing List
 Subject: Re: Generating logs w/Log4J in ActionClass


 I just create a class that wraps the log statements and would have a
function like this:

 public static void debug(String message, String aCategory)
{
   Category cat = Category.getInstance(aCategory);
   cat.debug(message);
}

 then when I need to use this I would call something like:

 MyLogger.debug(Message, this.getClass().getName());

 Hope that helps.

 - Original Message - 
 From: Mike Jasnowski [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 8:33 AM
 Subject: RE: Generating logs w/Log4J in ActionClass


  Sorry, this is with commons logging not log4j specifically
 
  -Original Message-
  From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
  Sent: Friday, August 22, 2003 9:29 AM
  To: Struts Users Mailing List
  Subject: RE: Generating logs w/Log4J in ActionClass
 
 
  In your action class, retrieve your log instance
 
  Log LOG = LogFactory.getLog(YourAction.class);
 
  Then wherever you need to log:
 
  if (LOG.isDebugEnabled()) {
LOG.debug(Log your debug msg here);
  }
 
   Replace isDebugEnabled() with whatever level you want to use.
 
  HTH,
  Mike J
 
  -Original Message-
  From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED]
  Sent: Thursday, August 21, 2003 11:55 AM
  To: [EMAIL PROTECTED]
  Subject: Generating logs w/Log4J in ActionClass
 
 
  I have the appropriate configurations completed to use Log4J w/Tomcat.
  However, how would I invoke Log4J from within my action class to
  generate DEBUG statements? I have the following package imported:
  import org.apache.log4j.*;
  Any examples would be most appreciated.
  Thanks in advance.
  - Mitesh
 
 
  -
  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]

data source problems

2003-08-22 Thread Fumo, Vince
Hi all. I'm sure this has been asked before but I can't seem to find it in
the archives.

I'm building a simple web app and I want to use a connection pool. I've
decided to use the commons dbcp BasicDataSource class
(org.apache.commons.dbcp.BasicDataSource). Here is the struts-config I'm
using (based on the one from the struts faq) :

data-sources
data-source type=org.apache.commons.dbcp.BasicDataSource
set-property property=autoCommit  value=true /
 set-property property=description value=MySQL datasource /
set-property property=driverClass value=com.mysql.jdbc.Driver /
set-property property=maxCount  value=10 /
set-property property=minCount  value=2 /
set-property property=username  value=username /
set-property property=password  value=password /
set-property property=url
value=jdbc:mysql://localhost:3306/databasename /
/data-source
/data-sources

I have placed the following jars in my \WEB-INF\lib folder :

commons-collections.jar
commons-dbcp.jar
commons-pool.jar
commons-logging.jar
mysql-connector-java-3.0.8-stable-bin.jar
struts.jar

From what I've read and seen, this should work fine. However, no matter what
I try, I get the following exception:

java.lang.NoClassDefFoundError: org/apache/struts/legacy/GenericDataSource

I'm aware that GenericDataSource is depreciated. However, I'm not trying to
use it. My only guess is that somehow struts/tomcat isn't finding the
commons.dbcp.BasicDataSource and it trying to default to the
GenericDataSource instead.

Does anyone have any idea how I can get this to work? I'm willing to try
anything but my main goal is to have a pooled connection to my mySQL
database.

Thanks in advance.

v



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



Re: data source problems

2003-08-22 Thread David Graham
--- Fumo, Vince [EMAIL PROTECTED] wrote:
 Hi all. I'm sure this has been asked before but I can't seem to find it
 in
 the archives.
 
 I'm building a simple web app and I want to use a connection pool. I've
 decided to use the commons dbcp BasicDataSource class
 (org.apache.commons.dbcp.BasicDataSource). Here is the struts-config I'm
 using (based on the one from the struts faq) :
 
 data-sources
 data-source type=org.apache.commons.dbcp.BasicDataSource
 set-property property=autoCommit  value=true /
  set-property property=description value=MySQL datasource /
 set-property property=driverClass value=com.mysql.jdbc.Driver
 /
 set-property property=maxCount  value=10 /
 set-property property=minCount  value=2 /
 set-property property=username  value=username /
 set-property property=password  value=password /
 set-property property=url
 value=jdbc:mysql://localhost:3306/databasename /
 /data-source
 /data-sources
 
 I have placed the following jars in my \WEB-INF\lib folder :
 
 commons-collections.jar
 commons-dbcp.jar
 commons-pool.jar
 commons-logging.jar
 mysql-connector-java-3.0.8-stable-bin.jar
 struts.jar

GenericDataSource lives in struts-legacy.jar.  Add that to your lib
directory and it should find it.

David

 
 From what I've read and seen, this should work fine. However, no matter
 what
 I try, I get the following exception:
 
 java.lang.NoClassDefFoundError:
 org/apache/struts/legacy/GenericDataSource
 
 I'm aware that GenericDataSource is depreciated. However, I'm not trying
 to
 use it. My only guess is that somehow struts/tomcat isn't finding the
 commons.dbcp.BasicDataSource and it trying to default to the
 GenericDataSource instead.
 
 Does anyone have any idea how I can get this to work? I'm willing to try
 anything but my main goal is to have a pooled connection to my mySQL
 database.
 
 Thanks in advance.
 
 v
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: Bypassing Form Validation

2003-08-22 Thread Norm Deane
Try

html:cancel onclick=bCancel=true;/


-- 
Norm Deane
MIS Consultant
Vanderbilt University
(615) 322-7855
[EMAIL PROTECTED] 

-Original Message-
From: David Stemm [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 10:39 AM
To: Struts Users Mailing List
Subject: Bypassing Form Validation


I'm having trouble trying to cancel out of a form.  I have a cancel
button that looks like this:

html:submit title=Cancel value=Cancel property=submit
tabindex='24' onclick=bCancel=true;/

and while the onclick event does cancel out the javascript validation it
still goes ahead and performs the server-side validation and I get
errors saying certain fields are required, etc.  I'm using a
DynaValidatorForm and my action class inherits from DispatchAction.
Anybody have any ideas?


David Stemm


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



Re: [OT] JNDI datasource lookup to test classes

2003-08-22 Thread David Graham
--- Leonardo Francalanci [EMAIL PROTECTED] wrote:
 In my DB tier I use an interface to get the connection.
 When used under Tomcat, the class that implements the connection gets
 the connecton through JNDI.
 I want to test these classes outside of Tomcat.
 Is there a simple way to put objects in the Context,
 I mean a simple way to emulate Tomcat behavior?
 I read the JNDI tutorial, but is the worse thing I've ever read.
 
 At this moment I created a class that implements my interface
 and that open a simple connection to the db, but in this way I need
 to set the right interface (JNDI/Simple) in each class a want to test.

The most common solution to this problem is using a Factory Method to
return the correct implementation of the interface.  Your classes should
never know which implementation is in use because they will all ask the
Factory Method for the object.  You just need to change the one line in
the method to return a different object for testing.

David


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


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Problem build war using Ant

2003-08-22 Thread deepaksawdekar
I am using Ant to build my war file. my build file is 

target name=createwar
  war destfile=${war.file.name}  webxml=WEB-INF/myapp.xml
 fileset dir=./pages  excludes=*.war, **/*.nbattrs, *.java/
   webinf  dir=./etcincludes=*.tld, ./struts-config.xml 
excludes=**/*.jar, **/*.class/
lib dir=./lib  /lib
classes dir=${build.dir} includes=**/*.properties /
  /war
  /target


When i run the build only content of pages dir is included, Can some one help me to 
debug tht build file.

Thanks and Regards
Deepak

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



Re: Generating logs w/Log4J in ActionClass

2003-08-22 Thread Pedro Emanuel de Castro Faria Salgado

 I have the appropriate configurations completed to use Log4J w/Tomcat.
 However, how would I invoke Log4J from within my action class to
 generate DEBUG statements?
 I have the following package imported:
 import org.apache.log4j.*;
 Any examples would be most appreciated.
 Thanks in advance.
 - Mitesh

 add an attribute
 private Logger log = Logger.getLogger();

 to debug use
 if (log.isDebugEnabled()) {
log.debug(message);
 }

I think that will do the trick.

Pedro Salgado



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



RE: data source problems

2003-08-22 Thread Fumo, Vince
Yes..I know that I can include the legacy jar but I don't want to. I'd
prefer to not use depreciated librarys in my app. The thing I'm confused
about is that I'm not sure how I'm even using GenericDataSource at all. I
thought that by explicitly using the BasicDataSource I would be avoiding
this problem.

-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 1:08 PM
To: Struts Users Mailing List
Subject: Re: data source problems


--- Fumo, Vince [EMAIL PROTECTED] wrote:
 Hi all. I'm sure this has been asked before but I can't seem to find it
 in
 the archives.
 
 I'm building a simple web app and I want to use a connection pool. I've
 decided to use the commons dbcp BasicDataSource class
 (org.apache.commons.dbcp.BasicDataSource). Here is the struts-config I'm
 using (based on the one from the struts faq) :
 
 data-sources
 data-source type=org.apache.commons.dbcp.BasicDataSource
 set-property property=autoCommit  value=true /
  set-property property=description value=MySQL datasource /
 set-property property=driverClass value=com.mysql.jdbc.Driver
 /
 set-property property=maxCount  value=10 /
 set-property property=minCount  value=2 /
 set-property property=username  value=username /
 set-property property=password  value=password /
 set-property property=url
 value=jdbc:mysql://localhost:3306/databasename /
 /data-source
 /data-sources
 
 I have placed the following jars in my \WEB-INF\lib folder :
 
 commons-collections.jar
 commons-dbcp.jar
 commons-pool.jar
 commons-logging.jar
 mysql-connector-java-3.0.8-stable-bin.jar
 struts.jar

GenericDataSource lives in struts-legacy.jar.  Add that to your lib
directory and it should find it.

David

 
 From what I've read and seen, this should work fine. However, no matter
 what
 I try, I get the following exception:
 
 java.lang.NoClassDefFoundError:
 org/apache/struts/legacy/GenericDataSource
 
 I'm aware that GenericDataSource is depreciated. However, I'm not trying
 to
 use it. My only guess is that somehow struts/tomcat isn't finding the
 commons.dbcp.BasicDataSource and it trying to default to the
 GenericDataSource instead.
 
 Does anyone have any idea how I can get this to work? I'm willing to try
 anything but my main goal is to have a pooled connection to my mySQL
 database.
 
 Thanks in advance.
 
 v
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.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]



Resetting of Checkbox when using logic:iterate Tag

2003-08-22 Thread Raghu.Ramakrishnan



Hi,

I have one issue, that is I have some checkboxes within my
logic:iterate, and 

1) When the user clicks on the checkbox, the property corresponding to
the checkbox is set to 'on'. 
2) When the user de-clicks the checkbox(removes the check), the checkbox
is still set to 'on', how do we reset the checkbox...


My code is as follows:

logic:iterate name=WorkQueueForm property=workQueueArrList
indexId=clmIdx id=indexBean
type=com.tgt.dist.icl.formbeans.WorkQueueBean

html:select name=indexBean property=updtClaimStatus indexed=true
 
html:option value=nbsp;/html:option
html:option value=PP/html:option 
html:option value=WW/html:option
html:option value=AA/html:option
html:option value=MM/html:option
html:option value=CC/html:option
/html:select

html:checkbox name=indexBean property=updtClaimPriority
indexed=true/html:checkbox

/logic:iterate

WorkQueueForm is the Form Bean
workQueueArrList is a property of the WorkQueue Form Bean which contains
WorkQueue Beans.


I would be obliged if you could let us know how to reset the checkbox,
when the user
Deselects the checkbox, the checkbox property in the WorkQeue Bean
should be reset to null.

Thanks,
Raghu

-Original Message-
From: Dan Tran [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 10:45 AM
To: Struts Users Mailing List
Subject: Re: struts test info


http://strutstestcase.sourceforge.net/

-Dan
- Original Message - 
From: ronanoc [EMAIL PROTECTED]
To: Struts List [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 6:13 AM
Subject: struts test info


 Can anyone point me in the direction of good examples and info about
 using/writing Struts tests other than the documentation that comes

 with Struts test it self...?
 
 Thanks in advance.
 
 Ron.
 Always ready to Discotogogo
 
 
 -
 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: Bypassing Form Validation

2003-08-22 Thread David Stemm
Tried that - it still performs the server-side validation.

- Original Message - 
From: Norm Deane [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 12:07 PM
Subject: RE: Bypassing Form Validation


 Try
 
 html:cancel onclick=bCancel=true;/
 
 
 -- 
 Norm Deane
 MIS Consultant
 Vanderbilt University
 (615) 322-7855
 [EMAIL PROTECTED] 
 
 -Original Message-
 From: David Stemm [mailto:[EMAIL PROTECTED] 
 Sent: Friday, August 22, 2003 10:39 AM
 To: Struts Users Mailing List
 Subject: Bypassing Form Validation
 
 
 I'm having trouble trying to cancel out of a form.  I have a cancel
 button that looks like this:
 
 html:submit title=Cancel value=Cancel property=submit
 tabindex='24' onclick=bCancel=true;/
 
 and while the onclick event does cancel out the javascript validation it
 still goes ahead and performs the server-side validation and I get
 errors saying certain fields are required, etc.  I'm using a
 DynaValidatorForm and my action class inherits from DispatchAction.
 Anybody have any ideas?
 
 
 David Stemm
 
 
 -
 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: Validator with property String array problem

2003-08-22 Thread David Graham
Commons Validator was recently modified to allow the required validation
in Struts to run on String[] or Collection objects.  You can download the
latest Validator nightly build to try it out.

David

--- java-dude [EMAIL PROTECTED] wrote:
 Hi,
 
 I am having problems using  Validator framework to perform client 
 side validation on a String array property declared in a 
 DynaValidatorForm.
 
 The results are that the validation does seem to work in a fashion 
 such that the user is not taken to the next page and is kept on 
 current jsp while data entered is invalid BUT no pop up alert error 
 messages are being diplayed. (For other forms in the application 
 where I am validating single properties the validation and pop up 
 error messages are working fine.)
 
 Has anybody solved/encountered this problem ?
 
 I have provided the relevant snippets from my current configuration 
 to illustrate my implementation :-
 
 struts-config.xml
 =
 .
 .
 .
 form-bean 
  name=enterReadingForm 
  type=org.apache.struts.validator.DynaValidatorForm
  form-property name=theReading type=java.lang.String[]/
 /form-bean
 .
 .
 .
 
 validation.xml
 ==
 .
 .
 .
 form name=enterReadingForm
   field property=theReading indexedListProperty=theReading
   depends=required,minlength,maxlength,mask
 arg0 key=prompt.theReading/
 arg1   key=${var:minlength} name=minlength
  resource=false/
 arg2   key=${var:maxlength} name=maxlength
  resource=false/
 var
 var-nameminlength/var-name
 var-value1/var-value
 /var
 var
 var-namemaxlength/var-name
 var-value6/var-value
 /var
 var
 var-namemask/var-name
 var-value^[0-9]*$/var-value
 /var
   /field
 /form
 .
 .
 .
 
 ApplicationResources.properties
 ===
 .
 .
 .
 prompt.theReading=The Reading
 .
 .
 .
 
 enterReading.jsp
 
 .
 .
 .
 nested:iterate id=registerDetails name=readingDetails 
 scope=page property=register
 nested:text name=registerDetails
  property=theReading size=6 maxlength=6/
 /nested:iterate
 .
 .
 .
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: Problem build war using Ant

2003-08-22 Thread Gandle, Panchasheel
thats cause you mentioned it like that
fileset dir=./pages  excludes=*.war, **/*.nbattrs, *.java/
it would take the base dir as ./pages

add multiple fileset if you want some other dir too...


Panchasheel

-Original Message-
From: deepaksawdekar [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 12:48 PM
To: Struts Users Mailing List
Subject: Problem build war using Ant


I am using Ant to build my war file. my build file is 

target name=createwar
  war destfile=${war.file.name}  webxml=WEB-INF/myapp.xml
 fileset dir=./pages  excludes=*.war, **/*.nbattrs,
*.java/
   webinf  dir=./etcincludes=*.tld, ./struts-config.xml
excludes=**/*.jar, **/*.class/
lib dir=./lib  /lib
classes dir=${build.dir} includes=**/*.properties /
  /war
  /target


When i run the build only content of pages dir is included, Can some one
help me to debug tht build file.

Thanks and Regards
Deepak

-
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: Validating uploaded file as an image only

2003-08-22 Thread Brian McSweeney
Cool,
Thanks Adam :-)

-Original Message-
From: Adam Levine [mailto:[EMAIL PROTECTED] 
Sent: 22 August 2003 15:27
To: [EMAIL PROTECTED]
Subject: RE: Validating uploaded file as an image only

Use of the MediaTracker is way to track the status of any media.

From the MediaTracker javadoc:
   The MediaTracker class is a utility class to track the status of a
number 
of media objects. Media objects could include audio clips as well as
images, 
though currently only images are supported

From the Tutorial, section Loading Images:
 
http://java.sun.com/docs/books/tutorial/uiswing/painting/usingImages.htm
l

Basically, we use the mediatracker to be informed of when an image has
been 
completely loaded.  The resource you're pulling could be local, could be

remote.. thusly, the complete data load time could vary.  Since
getImage() 
is non-blocking, this is how you know.

I suppose I could use those methods.. never really considered them.  I'm

pretty sure I've tried uploading non-image files, and I recall this
catching 
them as not being images.  but, it's been awhile, so ymmv.

cheers!

-- adam



I've never had any problems with this methodology.


From: Brian McSweeney [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Subject: RE: Validating uploaded file as an image only
Date: Fri, 22 Aug 2003 13:38:11 -

Hi Adam,
Cool! I had no clue that any of this was available.
A few questions if you don't mind.

What is the purpose of using the MediaTracker?

I understand how using

Image makeimg = Toolkit.getDefaultToolkit().createImage(
image.getFileData() );

will show you if it's a proper image, but I don't understand
how the MediaTracker class helps? Does it just show if the
image could be re-displayed or something?

If that assumption is correct, then the javadocs say that:

If there is an error while loading or scaling an image, then that image
is considered to have finished loading. Use the isErrorAny and isErrorID
methods to check for errors. 

So should you perhaps use these isErrorAny or isErrorID methods too?

Any problems ever experienced?

Anyway, really appreciate this help,
Brian



-Original Message-
From: Adam L [mailto:[EMAIL PROTECTED]
Sent: 22 August 2003 13:12
To: Struts Users Mailing List
Subject: Re: Validating uploaded file as an image only

I do it the brute force way:

 snip -
FormFile image;



java.awt.Image makeimg = null;

try
{
 makeimg = Toolkit.getDefaultToolkit().createImage(
image.getFileData() );

 //  wait for the image to be loaded/created

 Canvas cv = new Canvas();
 MediaTracker media_tracker = new MediaTracker( cv );

 // add image to the tracker
 int id = 0;
 media_tracker.addImage(makeimg,id);

 // try to wait for image to be loaded
 // catch if loading was interrupted
 media_tracker.waitForID(id);
 // if we can't load it, it'll get tossed back from the
catch()

 // by now we should have a good image to deal with

 // check on image dimensions
 int imgw = makeimg.getWidth( cv );
 int imgh = makeimg.getHeight( cv );

}
catch (..)


end snip--

I also check for file size (ie, dont' allow anything over 1M), and then
image dimensions.   The only thing I don't do is validate the mime-type.
I haven't tried uploading images from a text browser (ie lynx or links),
yet, to see what sort of mime-type it would attach.. but the ones from
IE
always seem to be fine.


cheers!

-- adam


- Original Message -
From: Brian McSweeney [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 6:32 AM
Subject: RE: Validating uploaded file as an image only


  PS - there was a discussion recently on how to improve the
  Validator.
 
 
  Validating an uploaded file based on mime type would be cool !
 
  A quick search on the web led me to a company that does this
  With a java api
 
  http://www.oop-reserch.com/mime_prop.html
 
  It seems in jdk1.4 you can actually validate based on the
  binary pattern expected for a mime type. So if it is a gif,
  you can check that the bit pattern of the uploaded file
  matches that of a gif.
 
  This is apparently to avoid users uploading say a text file
  named mytextfile.gif
 
  Now that would be nice :-)
  Brian
 
 
  -Original Message-
  From: Brian McSweeney [mailto:[EMAIL PROTECTED]
  Sent: 22 August 2003 11:13
  To: 'Struts Users Mailing List'
  Subject: Validating uploaded file as an image only
 
  Hi everyone,
 
  I've managed to get the struts file upload working successfully,
  using the struts FormFile class and the upload example.
 
  Cool :-)
 
  However, in my app, I only want images to be uploaded.
  I'm going to store the images on disk and put the path of the
  image file into the 

Formatting data for Struts form tags at the JSP layer - is thisright/possible?

2003-08-22 Thread Sasha Borodin
I would like to state a basic assumption I deduced in learning struts, then
pose a question.

Assumption:  ActionForm property getters and setters should return and take
Strings.  

My initial impulse was to try passing the actual data types (Dates, Numbers,
etc.); however, the Struts mechanism seems to pass Strings to the ActionForm
setter methods on form submission (which throws a conversion Exception of
course). Then I tried making the setters take Strings, and getters return
the actual data types, but this seemed to confuse the introspection
mechanism; plus I didn't see any way to apply formatting inside the
html:text tags (like you can in JSTL's fmt:format tags).

Question:  How does one handle formatting data (custom formatting or i18n)
for (pre/re)population of a form?

Ex.:  An update form; a user's information is loaded from the database into
classes (Strings, Dates, Numbers, etc.).  If you want to format this data,
you have to do it in the Model, as the ActionForm only takes and gives
Strings - which seems to be a Bad Practice.  Even if you had additional
special setters for the explicit purpose of populating the ActionForm from
original data types, you still don't know what Locale the client is from.

Is my assumption incorrect?  Is there a basic flaw in my understanding of
the use of ActionForm?  Or there an actual short-coming, and workaround?

In short, How Can You Format Data For Strut's Form Tags Inside The Actual
JSP :-) ?

Thank you for any input.

-Sasha


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



Re: [OT] JNDI datasource lookup to test classes

2003-08-22 Thread Adam Hardy
On 08/22/2003 04:43 PM Leonardo Francalanci wrote:
I read the JNDI tutorial, but is the worse thing I've ever read.
You've obviously never read any of my poetry.

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: login request + ActionServlet RequestProcessor Action

2003-08-22 Thread Andy Richards
Hi david

I spent a little to much allocated time on this so I had to move on, and I am 
going to come back to it at a later date. I have a quick 'hack' (a  taglib 
which checks the session in each jsp) for my prototype to present to the 
client..Anyway, when i do it i will let you know.

What i have found so far though is that by using declarative exception 
handling in my struts-config.xml the error, i think, needs to be thrown from 
a action class. If i could do it from my requestProcessor that would be 
great? I wasnt sure how to configure my app to call processRoles() on evey 
request, so i overrode the locale method as a test as this was been called 
eveytime. However because the locale method dosnt throw any exceptions i 
again ran into problems. So overall what i really would like to do would be 
to extend requestProcessor with my own custom method which throws my own 
exception which will be redirected to the appropriate page and called on 
every request. Sounds easy and probably is to someone who has a better 
understanding of stuts than i do? Anyway wont give up and will let you know 
if you are interested? Bank holiday this monday!! so a long relaxing 
weekend is due before i crack on with this one ; )

cheers

Andy


On Friday 22 Aug 2003 4:21 pm, you wrote:
 Andy,

 Did you get processRoles to work for you?
 How do you redirect to the (error) page of
 your choice in it?

 Thanks,
 David

 -Original Message-
 From: Andy Richards [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 9:55 AM
 To: Struts Users Mailing List
 Subject: Re: login request + ActionServlet RequestProcessor Action


 Hmm

 Strugling a bit with this one now.?? I have extended requestProcessor and
 tried to perform a requestDispatch and responseRedirect, however both fail
 as
 the error message informs me the reponse has already been submitted. I
 thought i may be able to use declarative exception handling with global
 exceptions in the stuts config to redirect the user to my login page (but
 no joy!). Anyone have any ideas? Also what method should i override in the
 RequestProcessor when handling my login?

 many thanks

 Andy

 On Thursday 21 Aug 2003 11:40 am, Kok Wei, Koh wrote:
  Yeah you should only need to define your custom
  AuthenticationRequestProcessor class which extends RequestProcessor in
  controller element of your struts-config.xml.
 
  Andy Richards wrote:
   Hi Kok
  
   Good point, never thought about that! One point towards extending the
   requestProcessor then, as if i am right i configure this in my
   struts-config.xml and dont need to extend it from every action class.
  
   Thanks
  
   Andy
  
   On Thursday 21 Aug 2003 10:26 am, Kok Wei, Koh wrote:
  Hi Andy,
  
  I guess the decision boils down to how your application is going to be
  written. For a project I worked on couple of weeks back, I ran into a
  problem where one of my Actions needs to extend a class to inherit some
  functionality, but I was stucked because I need to extend my
  AuthenticationAction which handles all my user login stuff.
  
  I can't extend from 2 classes, right? I then went on to research the
  RequestProcessor. I used tiles of Struts 1.1 in my project so what I
   did was I ported the AuthenticationAction code to say
  AuthenticationRequestProcessor and it extends TilesRequestProcessor
  which extends the Struts RequestProcessor.
  
  So it all depends on if you're gonna run into problems like this?
  
  My 2 cents. Hope this helps.
  
  Andy Richards wrote:
  Hi
  
  After deciding which approach to take and reading a few of my struts
  books about the controller object ; ) I am now confused as which is
   the most appropriate class to extend to perform my login
   functionality. David suggests extending the base action class,
   however i have read that the RequestProcessor class was added to
   struts1.1 to extend the ActionServlet. From what i can see this class
   handles all requests and one of its methods calls the appropriate
   action. Therefore which would be the better class to extend 
   ActionServlet, RequestProcessor or Action. Any ideas.?
  
  thanks
  
  Andy
  
  On Wednesday 20 Aug 2003 2:41 pm, David G. Friedman wrote:
  Dear Andy,
  
  I'm doing the same thing you suggest.  My approach is
  to extend the base Action (or any type of Action) class
  by adding a functon 'checkLogin'.  It takes the 'request'
  as the argument, checks the session for a User bean, and
  throws an exception if the bean is missing or if the ID
  number on the bean is zero/unset.  In my execute() method
  I make my first line 'checkLogin(request)' and it handles
  my authentication.
  
  If you try this approach, keep in mind I'm using Struts
  v1.1 final so I can use exceptions.
  
  Tonight I'm going to try switching it to an interface so
  I can use it to extend any action type by using 3 lines
  (and without sub-classing):
  
  1. import com.mycompany.auth.LoginCheck;
  2. public class 

RE: data source problems

2003-08-22 Thread David Graham
--- Fumo, Vince [EMAIL PROTECTED] wrote:
 Yes..I know that I can include the legacy jar but I don't want to. I'd
 prefer to not use depreciated librarys in my app. The thing I'm confused
 about is that I'm not sure how I'm even using GenericDataSource at all.
 I
 thought that by explicitly using the BasicDataSource I would be avoiding
 this problem.

Having the jar in your lib directory doesn't mean you're using deprecated
functionality.  Indeed, you're not even using GenericDataSource.  You must
install that jar because Struts uses it internally.  It has been removed
for 1.2.

David

 
 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 1:08 PM
 To: Struts Users Mailing List
 Subject: Re: data source problems
 
 
 --- Fumo, Vince [EMAIL PROTECTED] wrote:
  Hi all. I'm sure this has been asked before but I can't seem to find
 it
  in
  the archives.
  
  I'm building a simple web app and I want to use a connection pool.
 I've
  decided to use the commons dbcp BasicDataSource class
  (org.apache.commons.dbcp.BasicDataSource). Here is the struts-config
 I'm
  using (based on the one from the struts faq) :
  
  data-sources
  data-source type=org.apache.commons.dbcp.BasicDataSource
  set-property property=autoCommit  value=true /
   set-property property=description value=MySQL datasource /
  set-property property=driverClass value=com.mysql.jdbc.Driver
  /
  set-property property=maxCount  value=10 /
  set-property property=minCount  value=2 /
  set-property property=username  value=username /
  set-property property=password  value=password /
  set-property property=url
  value=jdbc:mysql://localhost:3306/databasename /
  /data-source
  /data-sources
  
  I have placed the following jars in my \WEB-INF\lib folder :
  
  commons-collections.jar
  commons-dbcp.jar
  commons-pool.jar
  commons-logging.jar
  mysql-connector-java-3.0.8-stable-bin.jar
  struts.jar
 
 GenericDataSource lives in struts-legacy.jar.  Add that to your lib
 directory and it should find it.
 
 David
 
  
  From what I've read and seen, this should work fine. However, no
 matter
  what
  I try, I get the following exception:
  
  java.lang.NoClassDefFoundError:
  org/apache/struts/legacy/GenericDataSource
  
  I'm aware that GenericDataSource is depreciated. However, I'm not
 trying
  to
  use it. My only guess is that somehow struts/tomcat isn't finding the
  commons.dbcp.BasicDataSource and it trying to default to the
  GenericDataSource instead.
  
  Does anyone have any idea how I can get this to work? I'm willing to
 try
  anything but my main goal is to have a pooled connection to my mySQL
  database.
  
  Thanks in advance.
  
  v
  
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 
 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.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]
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: Quick Java question

2003-08-22 Thread Marco Tedone
Well, the number of arguments is part of the method signature. In your case a dynamic 
object would be ideal, and if you don't want to use an array you could ever use a 
Collection, which offers the add(Object element), remove(Object element) methods, thus 
allowing for dynamicity. The Collection package (java.util) offers also great 
flexibility as it manage collection through the core interfaces and each 
implementation class has methods to convert one collection type to another.

If I understood your design, the user chooses incrementally the fields to add to the 
query, thus the Collection.add(Object element) and Collection.remove(Object element) 
methods could be suitable in your case.

The Collection package offers also methods to convert Collections to array with the 
Collection.toArray() (or Collection.toArray(object[] array) methods).

This way your method has to define only one argument (a Collection) and you can play 
with it from within your method.

Hope it will help,

Marco


ORIGINAL MESSAGE:

Message-ID: [EMAIL PROTECTED]
From: David Erickson [EMAIL PROTECTED]
To: Struts Mailing List [EMAIL PROTECTED]
Subject: Quick Java question..
Date: Thu, 21 Aug 2003 16:00:12 -0600
MIME-Version: 1.0
Content-Type: text/plain;
 charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Hey as I've been building my actions I was thinking it could be useful for
me to have a method that does some database querying, but I would like to
give the user the ability to narrow down that query with as many input
fields as he needs.  Is there a way to write a method that takes a non-set
amount of arguments?  (Other than just passing the method a growable array..
which is a viable alternative)

Ie

public String myfunction(String a, String b, String c on down the line
indefinitly)

?
I thought I had seen this done somewhere somehow but I may be wrong.
Thanks!

Help on pagination!!!!!!!!!!!!!!!!

2003-08-22 Thread Monajit Choudhury
Hi 
I have a question regarding pagination.
I have say 40 records, and I am displaying them as 10 per page.Now I go
to the 2nd page and delete a record, say record no 11.How do i make sure
that i remains in the 2nd page and shows the records from 12-21?
 
 
 


Re: Resetting of Checkbox when using logic:iterate Tag

2003-08-22 Thread Susan Bradeen
Are you using the reset() method of your ActionForm to set the checkbox to 
null or false?

http://jakarta.apache.org/struts/faqs/newbie.html#checkbox

Susan Bradeen

On 08/22/2003 12:32:17 PM Raghu.Ramakrishnan wrote:

 Hi,
 
 I have one issue, that is I have some checkboxes within my
 logic:iterate, and
 
 1) When the user clicks on the checkbox, the property corresponding to
 the checkbox is set to 'on'.
 2) When the user de-clicks the checkbox(removes the check), the checkbox
 is still set to 'on', how do we reset the checkbox...
 
 
 My code is as follows:
 
 logic:iterate name=WorkQueueForm property=workQueueArrList
 indexId=clmIdx id=indexBean
 type=com.tgt.dist.icl.formbeans.WorkQueueBean
 
 html:select name=indexBean property=updtClaimStatus indexed=true
 
 html:option value=nbsp;/html:option
 html:option value=PP/html:option
 html:option value=WW/html:option
 html:option value=AA/html:option
 html:option value=MM/html:option
 html:option value=CC/html:option
 /html:select
 
 html:checkbox name=indexBean property=updtClaimPriority
 indexed=true/html:checkbox
 
 /logic:iterate
 
 WorkQueueForm is the Form Bean
 workQueueArrList is a property of the WorkQueue Form Bean which contains
 WorkQueue Beans.
 
 
 I would be obliged if you could let us know how to reset the checkbox,
 when the user
 Deselects the checkbox, the checkbox property in the WorkQeue Bean
 should be reset to null.
 
 Thanks,
 Raghu
 
 -Original Message-
 From: Dan Tran [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 10:45 AM
 To: Struts Users Mailing List
 Subject: Re: struts test info
 
 
 http://strutstestcase.sourceforge.net/
 
 -Dan
 - Original Message -
 From: ronanoc [EMAIL PROTECTED]
 To: Struts List [EMAIL PROTECTED]
 Sent: Friday, August 22, 2003 6:13 AM
 Subject: struts test info
 
 
  Can anyone point me in the direction of good examples and info about
  using/writing Struts tests other than the documentation that comes
 
  with Struts test it self...?
 
  Thanks in advance.
 
  Ron.
  Always ready to Discotogogo
 
 
  -
  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]



Problem with Checkboxes using logic:iterate

2003-08-22 Thread Raghu.Ramakrishnan


Hi,

I have one issue, that is I have some checkboxes within my
logic:iterate, and 

1) When the user clicks on the checkbox, the property corresponding to
the checkbox is set to 'on'. 
2) When the user de-clicks the checkbox(removes the check), the checkbox
is still set to 'on', how do we reset the checkbox...


My code is as follows:

logic:iterate name=WorkQueueForm property=workQueueArrList
indexId=clmIdx id=indexBean
type=com.tgt.dist.icl.formbeans.WorkQueueBean

html:select name=indexBean property=updtClaimStatus indexed=true
 
html:option value=nbsp;/html:option
html:option value=PP/html:option 
html:option value=WW/html:option
html:option value=AA/html:option
html:option value=MM/html:option
html:option value=CC/html:option
/html:select

html:checkbox name=indexBean property=updtClaimPriority
indexed=true/html:checkbox

/logic:iterate

WorkQueueForm is the Form Bean
workQueueArrList is a property of the WorkQueue Form Bean which contains
WorkQueue Beans.


I would be obliged if you could let us know how to reset the checkbox,
when the user Deselects the checkbox, the checkbox property in the
WorkQeue Bean should be reset to null.

Thanks,
Raghu

-Original Message-
From: Dan Tran [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2003 10:45 AM
To: Struts Users Mailing List
Subject: Re: struts test info


http://strutstestcase.sourceforge.net/

-Dan
- Original Message - 
From: ronanoc [EMAIL PROTECTED]
To: Struts List [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 6:13 AM
Subject: struts test info


 Can anyone point me in the direction of good examples and info about 
 using/writing Struts tests other than the documentation that comes

 with Struts test it self...?
 
 Thanks in advance.
 
 Ron.
 Always ready to Discotogogo
 
 
 -
 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]


-Original Message-
From: atta-ur rehman [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2003 5:56 PM
To: Struts Users Mailing List
Subject: [OT] Tree Stucture in STRUTS


hi all,

excuse me if this sounds off topic!

can somebody please point to some references on how to incorporate a
dynamically built tree-like structure in a struts app? can struts-menu
be used for this purpose? any other suggestions?

thanks.

ATTA




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



Authentication Filter not working

2003-08-22 Thread Cezar Nasui
Hi all,

I try to use a filter for the authentication so I created a class which
implements filter with the following doFilter method (I found this in a
post)

code
public void doFilter(ServletRequest _request, ServletResponse _response,
  FilterChain _chain)
  throws IOException, ServletException
 {
String redirectFailure = /logon.jsp;

HttpSession session = ((HttpServletRequest)_request).getSession(false);
if ((session == null) || (session.getAttribute(loggedIn)== null) )
{
context.getRequestDispatcher(redirectFailure)
.forward(_request,_response);
 }
 else {
_chain.doFilter(_request, _response);
 }
}
/code

I added this in the web.xml file:
code
  filter
filter-nameSessionFilter/filter-name
filter-classdbmanager.SessionFilter/filter-class
  /filter
  filter-mapping
filter-nameSessionFilter/filter-name
url-pattern/DBManager/*/url-pattern
  /filter-mapping
/code

and I also :
- setted nocache to true for the Action servlet
- in lofgoff I invalide the session I create in login along with the
loggedIn variable

The problem : when I log out and then do a back to the last page everything
is working  !!!

I overlooked something, any ideas?

Thanks,
Cezar
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003


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



RE: Horizon: a view management plugin

2003-08-22 Thread Pedro Emanuel de Castro Faria Salgado
Hi Hue,

 I must confess to being a bit confused!  What is the difference between
 your approach and getting an instance of a Dyna, viz:

 DynaActionFormClass dafc =
 DynaActionFormClass.getDynaActionFormClass(Dyna-Definition-Name-In-Struts-C
 onfig);

  With a form bean your goal is to get/pass the data from/to the user,
validate and have an object to pass to somekind of usecase implementation
method.

  You can also use the framework to define simple DTOs to keep the
presentation layer decoupled from the business layer (pg.57 Chuck
Cavaness's book - it even says dont use the action form to
pass data to the business layer :) - you could use
more arguments on the business layer method signature and make it
decoupled...).

  I know that on the same page of the book it says that action forms
are used to transfer data back and forth to user... but for
me a think form beans are just to get user input... in other words,
to use them with a html:form.
  I tryed what you wrote above and started mixing up definitions
(and i am somewhat organized and set standards on defining labels...
but i am a human).

  If i make a new bean definition just to present data to the user
on a form bean i think all gets rather confusing... more
if you see the example on page 56, he defines the views in a
somewhat different way... one form bean, with one property that is
Java class that will hold all the information...!!! - +1 Java class
+several getter/setters +severall/2 attributes...
he doesnt use form properties at all...
  The data process is something like:

  user - form-bean - action - populate dto (or not)
- business layer - dto - action - form-bean - user

  The place where he uses the java class ItemDetailView(pg. 161,
hope you hve the book) could be replaced by
a dyna-bean (never defined on a form-bean) and some
BeanUtils methods would do the rest.

  If you want you can still define a form-bean on struts-config file
to present data to the user. Something like:
form-bean name=form2View type=...
  form-property name=view
property=org.apache.commons.beanutils.DynaBean/
/form-bean
  I usually have a superclass action method that registers a
dynabean on a request with a predefined application key attribute
for views.

  This way i save a new Java class definition and a form-bean declaration
on struts.(dont see no point in adding a lot of duplicate
definitions with the same properties just to have different names...though.
on my documentation i just point to the xml definition name and
that's it).

 DynaActionForm myBean = (DynaActionForm) dafc.newInstance();

 At least with the above approach the beans are stored in struts-config
 in the usual struts syntax - it's just they're not used in the action
 name parameter - but are created on-the-fly in an action (or wherever)
 with the above code.

 I'm concerned I may be missing some obvious advantage to your approach -
 hence the reason for the question!

  You're right, but...

  The framework doesnt bring nothing new (the powder
has already been discovered :), sorry ), it can help separate
the use of dyna beans: some are to retrieve data (form beans),
others are to present data (form-beans that i dont use)...
and others are to decouple the presentation layer from the business layer
(dto).

  I am not trying to convince anyone about anything...
i just found the framework convenient and very useful for me...

Thank you for the comments... send more like those
it is always a pleasure to discuss ideas :)

Pedro Salgado



 Hue.

 -Original Message-
 From: Pedro Emanuel de Castro Faria Salgado
 [mailto:[EMAIL PROTECTED]
 Sent: 21 August 2003 16:15
 To: [EMAIL PROTECTED]
 Subject: Re: Horizon: a view management plugin



  Pedro Emanuel de Castro Faria Salgado wrote:
 
 Hi,
 
I have built a plugin for Struts that creates view beans using
 dynabeans that are defined on a xml file and i was wondering if
 anyone
  in the Struts project/mailing list was interested on checking the
 use of it?
 
  When I see dynabean are you saying BeanUtils.DynaBean and what is a
 'view bean',
  do you mean a Action Form ?

 yes

  If so what is the difference between  your
  plugin and  a DynaActionForm ?

 i think, actually, there is none... the difference is for what i use
 the view beans for: transfering data from actions to
 build combobox on form and present data that isn't on a form.

 i know i can use the form itself to put a collection to
 build a combobox and use another form bean property
 to store the user input but it is less
 confusing if i define forms with only the properties the
 user can enter data and
 another bean for transmitting data (dto... in my case i call it
 view bean).

 before the plugin i had to define a new java class
 (attributes + getters/setters) for each
 new dto i wanted, now, i only need to add some lines
 to a xml file...

 
  Given that your plugin is generally useful then there are several
 options :
 
  1) Since web space can gotten for 

[OT] - Bread Crumb navigation

2003-08-22 Thread Steven Santiago
I'm hoping to be able to do some dynamic breadcrumb trail stuff.  I see
some vague references to them when I search, but I don't see anything
good.  Anybody have any good links?

thanks,
steve


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



Model 1 Struts

2003-08-22 Thread Michael Korolyov
Hello,

What is a way to add Struts to Model 1 App?
The App is implemented as Model 1 and I have no time to transform it to
Model 2 (and Struts).
What is a way for new functionality to be implemented with Struts?
How make possible for co-exist Model 1 and Struts in one App?
Something like a put Struts JSP under WEB-INF and use Struts controller
for those JSP, where other Model 1 JSP could be (and are) directly
call.

Any help with that are very welcome ;-)

Best Regards.
Michael.



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



RE: data source problems

2003-08-22 Thread Fumo, Vince
Thank you David, I gave that a shot and I made some headway, however, now at
Tomcat startup (and obvioulsy Struts startup) I'm getting an exception that
basicly states Cannot load JDBC driver class 'null' (full startup is
below). I'm sure I have my struts-config correct and I have the JDBC driver
in the WEB-INF/lib directory and also the tomcat common/lib directory. Any
ideas on where I'm messed up this time?

relevant struts-config

!--  Data Source Configuration --

data-sources
data-source type=org.apache.commons.dbcp.BasicDataSource
set-property property=descriptionvalue=MySQL
datasource /
set-property property=driverClass
value=com.mysql.jdbc.Driver /  
set-property property=url
value=jdbc:mysql://localhost/ed_test /  
set-property property=username   value=ed-web /
set-property property=password   value=dashboard /
set-property property=maxActive  value=10
/
set-property property=maxCount   value=10 /
set-property property=minCount   value=2 /  
set-property property=maxWaitvalue=5000
/  
set-property property=defaultAutoCommit  value=false /
set-property property=defaultReadOnlyvalue=false /
set-property property=validationQueryvalue=SELECT
COUNT(*) FROM family /
/data-source
/data-sources

the tomcat startup log

Starting service Tomcat-Standalone
Apache Tomcat/4.1.24
Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='resources.application', returnNull=true
Aug 22, 2003 3:28:47 PM org.apache.struts.action.ActionServlet
initModuleDataSources
SEVERE: Initializing application data source
org.apache.struts.action.DATA_SOURCE
java.sql.SQLException: Cannot load JDBC driver class 'null'
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav
a:529)
at
org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:38
1)
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1087)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
5)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3420)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:307)
at
org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559
)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
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 

RE: [OT] - Bread Crumb navigation

2003-08-22 Thread Holman, Cal
I created an example .war using two different techniques that I posted on my site - it 
depends on tiles to function.  Try 
http://www.calandva.com/holmansite/do/blog/blogging?date=20030701   

Cal 

http://www.calandva.com/Last update 08/01/03



-Original Message-
From: Steven Santiago [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 15:35
To: Struts Users Mailing List
Subject: [OT] - Bread Crumb navigation

I'm hoping to be able to do some dynamic breadcrumb trail stuff.  I see
some vague references to them when I search, but I don't see anything
good.  Anybody have any good links?

thanks,
steve


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

  
Learn more about Paymentech's payment processing services at www.paymentech.com
THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments are proprietary 
and confidential information intended only for the use of the recipient(s) named 
above.  If you are not the intended recipient, you may not print, distribute, or copy 
this message or any attachments.  If you have received this communication in error, 
please notify the sender by return e-mail and delete this message and any attachments 
from your computer.

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



RE: data source problems

2003-08-22 Thread Jimmy Emmanual
Try driverClassName as the property.

-Original Message-
From: Fumo, Vince [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 3:32 PM
To: 'Struts Users Mailing List'
Subject: RE: data source problems


Thank you David, I gave that a shot and I made some headway, however, now at
Tomcat startup (and obvioulsy Struts startup) I'm getting an exception that
basicly states Cannot load JDBC driver class 'null' (full startup is
below). I'm sure I have my struts-config correct and I have the JDBC driver
in the WEB-INF/lib directory and also the tomcat common/lib directory. Any
ideas on where I'm messed up this time?

relevant struts-config

!--  Data Source Configuration --

data-sources
data-source type=org.apache.commons.dbcp.BasicDataSource
set-property property=descriptionvalue=MySQL
datasource /
set-property property=driverClass
value=com.mysql.jdbc.Driver /  
set-property property=url
value=jdbc:mysql://localhost/ed_test /  
set-property property=username   value=ed-web /
set-property property=password   value=dashboard /
set-property property=maxActive  value=10
/
set-property property=maxCount   value=10 /
set-property property=minCount   value=2 /  
set-property property=maxWaitvalue=5000
/  
set-property property=defaultAutoCommit  value=false /
set-property property=defaultReadOnlyvalue=false /
set-property property=validationQueryvalue=SELECT
COUNT(*) FROM family /
/data-source
/data-sources

the tomcat startup log

Starting service Tomcat-Standalone
Apache Tomcat/4.1.24
Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='resources.application', returnNull=true
Aug 22, 2003 3:28:47 PM org.apache.struts.action.ActionServlet
initModuleDataSources
SEVERE: Initializing application data source
org.apache.struts.action.DATA_SOURCE
java.sql.SQLException: Cannot load JDBC driver class 'null'
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav
a:529)
at
org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:38
1)
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1087)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
5)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3420)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:307)
at
org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559
)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

Auto-Confirmation

2003-08-22 Thread Quest Software
Thank you for submitting your request to Quest Software Technical Support.  We are 
unable to process your request because our records indicate that you are not 
registered for Technical Support.

To register, logon to our Supportlink web site http://www.quest.com/support , and  
self-register from the web.  Or, you can phone Quest at one of the numbers below to 
register.

Once you have registered, you can submit your request within Supportlink, by email at 
[EMAIL PROTECTED], by phone at one of the numbers below.

Please do not reply to this email.

If this is an URGENT matter please contact Quest Technical Support via telephone at 
one of the numbers listed below.

Thank you,

Quest Software Technical Support
www.quest.com/support

Quest Software Technical Support - Canada   902.442.5700
Quest Software Technical Support - United Kingdom  44.1628.601007
Quest Software Technical Support - United States  949.754.8000
  Original Message
  From: Cezar Nasui [mailto:[EMAIL PROTECTED]
  Sent: Fri, 22 Aug 2003 15:15:57 -0400
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Subject: Authentication Filter not working 
  
  Hi all,
  
  I try to use a filter for the authentication so I created a class which
  implements filter with the following doFilter method (I found this in a
  post)
  
  code
  public void doFilter(ServletRequest _request, ServletResponse _response,
FilterChain _chain)
throws IOException, ServletException
   {
  String redirectFailure = /logon.jsp;
  
  HttpSession session = ((HttpServletRequest)_request).getSession(false);
  if ((session == null) || (session.getAttribute(loggedIn)== null) )
  {
   context.getRequestDispatcher(redirectFailure)
   .forward(_request,_response);
   }
   else {
   _chain.doFilter(_request, _response);
   }
  }
  /code
  
  I added this in the web.xml file:
  code
filter
  filter-nameSessionFilter/filter-name
  filter-classdbmanager.SessionFilter/filter-class
/filter
filter-mapping
  filter-nameSessionFilter/filter-name
  url-pattern/DBManager/*/url-pattern
/filter-mapping
  /code
  
  and I also :
  - setted nocache to true for the Action servlet
  - in lofgoff I invalide the session I create in login along with the
  loggedIn variable
  
  The problem : when I log out and then do a back to the last page everything
  is working  !!!
  
  I overlooked something, any ideas?
  
  Thanks,
  Cezar
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/2003
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  


Auto-Confirmation

2003-08-22 Thread Quest Software
Thank you for submitting your request to Quest Software Technical Support.  We are 
unable to process your request because our records indicate that you are not 
registered for Technical Support.

To register, logon to our Supportlink web site http://www.quest.com/support , and  
self-register from the web.  Or, you can phone Quest at one of the numbers below to 
register.

Once you have registered, you can submit your request within Supportlink, by email at 
[EMAIL PROTECTED], by phone at one of the numbers below.

Please do not reply to this email.

If this is an URGENT matter please contact Quest Technical Support via telephone at 
one of the numbers listed below.

Thank you,

Quest Software Technical Support
www.quest.com/support

Quest Software Technical Support - Canada   902.442.5700
Quest Software Technical Support - United Kingdom  44.1628.601007
Quest Software Technical Support - United States  949.754.8000
  Original Message
  From: Pedro Emanuel de Castro Faria Salgado [mailto:[EMAIL PROTECTED]
  Sent: Fri, 22 Aug 2003 11:14:49 +0100 (WEST)
  To: [EMAIL PROTECTED]
  Subject: RE: Horizon: a view management plugin
  
  Hi Hue,
  
   I must confess to being a bit confused!  What is the difference between
   your approach and getting an instance of a Dyna, viz:
  
   DynaActionFormClass dafc =
   DynaActionFormClass.getDynaActionFormClass(Dyna-Definition-Name-In-Struts-C
   onfig);
  
With a form bean your goal is to get/pass the data from/to the user,
  validate and have an object to pass to somekind of usecase implementation
  method.
  
You can also use the framework to define simple DTOs to keep the
  presentation layer decoupled from the business layer (pg.57 Chuck
  Cavaness's book - it even says dont use the action form to
  pass data to the business layer :) - you could use
  more arguments on the business layer method signature and make it
  decoupled...).
  
I know that on the same page of the book it says that action forms
  are used to transfer data back and forth to user... but for
  me a think form beans are just to get user input... in other words,
  to use them with a html:form.
I tryed what you wrote above and started mixing up definitions
  (and i am somewhat organized and set standards on defining labels...
  but i am a human).
  
If i make a new bean definition just to present data to the user
  on a form bean i think all gets rather confusing... more
  if you see the example on page 56, he defines the views in a
  somewhat different way... one form bean, with one property that is
  Java class that will hold all the information...!!! - +1 Java class
  +several getter/setters +severall/2 attributes...
  he doesnt use form properties at all...
The data process is something like:
  
user - form-bean - action - populate dto (or not)
  - business layer - dto - action - form-bean - user
  
The place where he uses the java class ItemDetailView(pg. 161,
  hope you hve the book) could be replaced by
  a dyna-bean (never defined on a form-bean) and some
  BeanUtils methods would do the rest.
  
If you want you can still define a form-bean on struts-config file
  to present data to the user. Something like:
  form-bean name=form2View type=...
form-property name=view
  property=org.apache.commons.beanutils.DynaBean/
  /form-bean
I usually have a superclass action method that registers a
  dynabean on a request with a predefined application key attribute
  for views.
  
This way i save a new Java class definition and a form-bean declaration
  on struts.(dont see no point in adding a lot of duplicate
  definitions with the same properties just to have different names...though.
  on my documentation i just point to the xml definition name and
  that's it).
  
   DynaActionForm myBean = (DynaActionForm) dafc.newInstance();
  
   At least with the above approach the beans are stored in struts-config
   in the usual struts syntax - it's just they're not used in the action
   name parameter - but are created on-the-fly in an action (or wherever)
   with the above code.
  
   I'm concerned I may be missing some obvious advantage to your approach -
   hence the reason for the question!
  
You're right, but...
  
The framework doesnt bring nothing new (the powder
  has already been discovered :), sorry ), it can help separate
  the use of dyna beans: some are to retrieve data (form beans),
  others are to present data (form-beans that i dont use)...
  and others are to decouple the presentation layer from the business layer
  (dto).
  
I am not trying to convince anyone about anything...
  i just found the framework convenient and very useful for me...
  
  Thank you for the comments... send more like those
  it is always a pleasure to discuss ideas :)
  
  Pedro Salgado
  
  
  
   Hue.
  
   -Original Message-
   From: Pedro Emanuel de Castro Faria Salgado
   

Auto-Confirmation

2003-08-22 Thread Quest Software
Thank you for submitting your request to Quest Software Technical Support.  We are 
unable to process your request because our records indicate that you are not 
registered for Technical Support.

To register, logon to our Supportlink web site http://www.quest.com/support , and  
self-register from the web.  Or, you can phone Quest at one of the numbers below to 
register.

Once you have registered, you can submit your request within Supportlink, by email at 
[EMAIL PROTECTED], by phone at one of the numbers below.

Please do not reply to this email.

If this is an URGENT matter please contact Quest Technical Support via telephone at 
one of the numbers listed below.

Thank you,

Quest Software Technical Support
www.quest.com/support

Quest Software Technical Support - Canada   902.442.5700
Quest Software Technical Support - United Kingdom  44.1628.601007
Quest Software Technical Support - United States  949.754.8000
  Original Message
  From: Steven Santiago [mailto:[EMAIL PROTECTED]
  Sent: Fri, 22 Aug 2003 15:34:45 -0400
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Subject: [OT] - Bread Crumb navigation
  
  I'm hoping to be able to do some dynamic breadcrumb trail stuff.  I see
  some vague references to them when I search, but I don't see anything
  good.  Anybody have any good links?
  
  thanks,
  steve
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  


  1   2   >