Back Button Problem

2004-09-12 Thread venkat raju
Hi All,

  I have got a strange problem.  I am using Struts 1.1
and tiles.  When I click on the back button, I want
the page to be loaded from cache.  But to my surprise,
its behaving strange.

  For instance, I open a new browser instance and I
open Page1. Then I submit this page to get Page2.  Now
if I click back button I am getting Page1(all the form
fields are empty here).  Now if I click back button
again, I am getting Page1 again(all the form fields
are pre populated here).  I am running out of the ways
to investigate this issue.

  Can anyone help please

A Million Thanks,
Vraj



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: Back Button Problem

2004-09-12 Thread venkat raju
Hope the following helps to get to the root of the
problem;

I am using post method to submit the form.  And
sometimes when I click on back button, it says
Handler parameter not found.  Is it some known bug
in Struts or Tiles?


--- venkat raju [EMAIL PROTECTED] wrote:

 Hi All,
 
   I have got a strange problem.  I am using Struts
 1.1
 and tiles.  When I click on the back button, I want
 the page to be loaded from cache.  But to my
 surprise,
 its behaving strange.
 
   For instance, I open a new browser instance and I
 open Page1. Then I submit this page to get Page2. 
 Now
 if I click back button I am getting Page1(all the
 form
 fields are empty here).  Now if I click back button
 again, I am getting Page1 again(all the form fields
 are pre populated here).  I am running out of the
 ways
 to investigate this issue.
 
   Can anyone help please
 
 A Million Thanks,
 Vraj
 
 
   
 __
 Do you Yahoo!?
 New and Improved Yahoo! Mail - Send 10MB messages!
 http://promotions.yahoo.com/new_mail 
 

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




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

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



RE: html:checkbox default value

2004-09-12 Thread Erez Efrati
If I put it in the form bean constructor wouldn't it cause the field
value to be always true no matter if the user unchecks it and submit
the form. As far as I can recall a checkbox field should be reset to
false before the form population.

Erez

-Original Message-
From: Craig McClanahan [mailto:[EMAIL PROTECTED] 
Sent: Sunday, September 12, 2004 1:38 AM
To: Struts Users Mailing List
Subject: Re: html:checkbox default value

The values displayed on the page are copied from the form bean, so the
right answer is to set the value of the schedule property in your
form bean to true.  This can be done in the form bean constructor (if
you want this initial value all the time), or -- more typical for an
update scenario -- you can execute a setup action that pre-fills the
form bean (perhaps from information loaded from a database) before
forwarding to the page.

Craig


On Sat, 11 Sep 2004 21:53:36 +0200, Erez Efrati [EMAIL PROTECTED]
wrote:
 I am trying to set the default value of a checkbox to 'checked' by
 putting:
 html:checkbox property=schedule value=true/
 
 but somehow it does not check it. The produced HTML gives me
 
 input type=checkbox .. value=on 
 
 What am I missing here?
 
 Thanks,
 
 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]



no default struts config - NullPointerException

2004-09-12 Thread Nathan Coast
Hi, if this is the only module defined in the web.xml I get a NullPointerException
init-param
  param-nameconfig/upload/param-name
  param-value/WEB-INF/upload/struts-config.xml/param-value
/init-param
if I add this, the problem goes away
init-param
  param-nameconfig/param-name
  param-value/WEB-INF/upload/struts-config.xml/param-value
/init-param
is this correct?  Is it mandatory to have the default 'config' element?
cheers
Nathan

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


XDoclet + Struts validator question

2004-09-12 Thread Eric Chow
Hello,

How can I define the xdoclet tag for struts validator that the
validated field muct depends to another field ??

For example,

if the action is new then all the fields(name, sex) must be required.
if the action is edit then only the name is required !!!

Please give me a hand.

Best regards,
Eric

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



OT: Cure for Mac Envy is ...

2004-09-12 Thread Vic
Linux:
http://www.bytebot.net/talks/FC3-t2rawhide-whatsnew.pdf
Fast, stable and good looking.
.V
--
Please post on Rich Internet Applications User Interface (RiA/SoA)
http://www.portalvu.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Seeking master detail hello world

2004-09-12 Thread Victor Grazi
Can you point me to a small but complete master detail struts program? I am 
having trouble understanding how to set this up, especially with buttons on 
each row.

For example if the page is displaying a collection of beans as an html 
table, and there is an update and delete button on each row, how do you 
pass the id of the record to those buttons and how does the Action capture 
the button (update or delete, and record id) that was pressed.
Thanks
Victor

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



Re: Question on calling .do's directly

2004-09-12 Thread Tom Holmes Jr.
Rick Reumann wrote:
Tom Holmes Jr. wrote the following on 9/11/2004 7:02 PM:
So, I guess the only question I have is:
Is there a problem with a web-site that contains a bunch of links to 
various '.do' pages as opposed to '.jsp' pages?  Are there any 
security concerns?  Do I really want to have direct links to '.do' pages?

Remember when you are setting up a global forward and going, as you say, 
directly to a page from a .do link you are really still using a default 
FowardAction provided by Struts. You DEFINTELY want to do this (as you 
have) vs going directly to a jsp page. If you decided later you need to 
do something before you forwarded to your jsp you could easily set you 
same .do link as a mapping to go to one of your own custom actions. If 
you had bypassed this step by providing just a basic link to the jsp you 
would end up having to change your link. Bottom line is you always want 
to go through a controller (an Action class) even if it's just the 
simple ForwardAction.

If you had to call a page that needed to display data immediately, is 
this how you would do it?

What do you mean by display data immediately? You still always want to 
have your links use a struts mapping (.do or whatever you are using).
I mean back in the day when I used to do ASP pages, I could call an ASP 
page, the ASP page would open up to the database, do a select statement, 
 and build a list of results.  Then I would iterate through the 
recordset and display the data within the HTML.  Hence, everytime this 
URL was called, the data was immediately collected and displayed from 
the database.  This is something I know we can do with the sql tags 
within JSP pages, but it isn't a very good way to do things and breaks 
the whole MVC architecture.

In my case, by calling the .do directly, as you said I am calling the 
Forward Action which is using a ListBean in order to do the database 
work and get my recordset back into a collection. Then when I go to my 
View, the JSP page can display my data immediately.

And, there are going to be times when I want to call a .jsp file first, 
when I have to collect data, I just want to go that .jsp page first with 
the form and enter my data, then I can submit to the .do file for 
validation.  If I were to call the action first, since there is no data 
in any of the fields, then I would get all these errors on the first 
round.  Shouldn't that be the case?


Oh, and I was think the ApplicationResources to put in the links to
my navigation menu ... now that I see global forwards. Could I use
this to define my list of main pages for various parts of my web-site?

I usually don't put the actual links(ie. /employeeAction.do) in the 
ApplicationResources file, but I will put their names in there sometimes 
(ie link.update.employee=Update Employee). For your navigation you 
*should* only have to maintain one page for these links so maintenance 
is easy so I don't see much reason to put the links in the App resources 
file. (If you are having to copy your navigation links on to different 
pages consider using Sitemesh or Tiles. Your navigation should just be 
one page).

I agree, I did not put the action link in the ApplicationResources file, 
but as you suggested just had the name of the link.  I am taking 
advantage of the global-forwards for the navigation side-bar, and that 
lets me keep those links maintained in the struts-config.xml file.

I do have a navigation menu in each one of my folders which is a 
different part of my web-application/site.  Because of the way I display 
my images and because of the changing paths, I did it that way.  Tiles 
is a whole another API, and I do want to learn it, but I have to learn 
to walk before I can run.  So, for right now, I'll keep all my 
navigation pages, though I agree, it is difficult to maintain.

Once I get my hands around, a few more forms to Create, Retrieve, 
Update, and Delete data, then I'm going to tackle creating my own 
taglibs, then dig into Tiles, and then maybe Java Server Faces, then 
EJB's, then maybe PHP, then maybe VB.NET/ASP.NET and C#.  The .NET and 
C# sharp technologies are always at the bottom of my list.

Anyway, thanks for all the help and suggestions.  It seems the best way 
to go.  My web-site has already undergone 4-5 revisions as I learn more 
and become more saavy with Struts.

Thanks again.
  Tom
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: html:checkbox default value

2004-09-12 Thread Rick Reumann
Erez Efrati wrote the following on 9/12/2004 7:03 AM:
If I put it in the form bean constructor wouldn't it cause the field
value to be always true no matter if the user unchecks it and submit
the form.  As far as I can recall a checkbox field should be reset to
false before the form population.
I believe you would be correct in that if you do set a boolean checkbox 
property to true in your formBean (either in constructor or by 
declaration), you will end up with it remaining true if the user 
'unchecks' the box on the form. This is because http does not send over 
the checkbox property if is not checked.

This is why I use a setUp method in my Action (like Craig mentioned) and 
usually I also make sure my boolean properties are reset to false in the 
reset method of my ActionForm. In the setUp method you could set up your 
initial ActionForm boolean property to be whatever you wanted (if it's 
false by default you wouldn't need to do this, but you would still want 
to make sure you used the reset method to set your boolean back to false 
if you plan on using Struts form validation).

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


Sequence of events for Action.execute(), ActionForm.reset(), ActionForm.validate()?

2004-09-12 Thread struts Dude
Hi,

I just want to clear up the sequence of events for calling
an Action from action mapping specified in struts-config.xml.

Is it ActionForm.reset(), ActionForm.validate(), Action.execute()?

And implication of these, any objects set to request scope within
ActionForm.reset() or ActionForm.validate() will be passed to
the next request right?? 

So if ActionForm.validate() fails and forward to a new JSP, that new JSP will 
have access to objects set to request scope from ActionForm.reset(), 
or ActionForm.validate(), right???



Thanks

Advantages of J2EE w. Struts vs .NET ASP.NET

2004-09-12 Thread Anders Jacobsen
Hi

I think this place would be a good place to good some colored ;) comments on 
and Web applications implemented with J2EE w./ Struts and the same 
implemented with ASP.NET.

Microsoft people tends to have just one point-of-view so I hope I could find 
some people who preferable had experience with both frameworks.

I know it´s hard to find a winnner, but some con/pros from real developers 
would be of great value. The main functionality of the web application is 
edit/upate/delete operations and the like.

Thanks in regards
Anders 




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



Re: Specifying validation field per Form, only way????

2004-09-12 Thread João Vieira da Luz
Hi,

yes for the first question.

no for the second. 
Probably, you can implement a base class for that forms that contain
name field and implement the validation for that field on validate
method.

Hope this help you,
João

On Sat, 11 Sep 2004 15:01:23 -0300 (ART), Leandro Melo
[EMAIL PROTECTED] wrote:
 Hi,
 do i need to specify validation fields per form in
 validation.xml???
 
 Suppose the field name, for example, many form beans
 may use this field. Is there a way i can specify a
 global validation for name, instead of specifying it
 for all form beans that have the field name???
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Problem using Database utils From Scaffold,

2004-09-12 Thread Ruben Cepeda
Hey All,
I am trying to use the Scallfold AccessBase Class and find myself getting 
the following error:

ResourceException e:  No value specified for parameter 2
This is my sql Statement:
sql:  SELECT firstname,lastname,affiliation,username,password FROM users 
WHERE username=? AND password=?;

This is my code:
public static final SessionUser findUser(User user)
   {
   SessionUser session_user = new SessionUser();
   Object[] par = new Object[2];
   par[0] = user.getUsername();
   par[1] = user.getPassword();
   System.out.println(username:  + user.getUsername());
   System.out.println(password:  + user.getPassword());
   try
   {
   System.out.println(sql:   + 
AccessBase.getCommand(USER_SELECT_KEY));

   if(findElement(session_user,par, USER_SELECT_KEY))
   {
   System.out.println(SessionUser:  
+session_user.toString());
   return(session_user);
   }
   else
   {
   return(null);
   }
   }
   catch(ResourceException e)
   {

   System.out.println(ResourceException e:   + 
e.getCauseMessage());
   //e.printStackTrace();
   }

..
Can anyone help out with this I have really hit a wall.

*
Ruben Cepeda
[EMAIL PROTECTED]
*
_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

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


RE: Validation error,

2004-09-12 Thread Ruben Cepeda
David,
It is saying that the class is not found.  I have stop working with it right 
know because I am just using the server-side validation.

*
Ruben Cepeda
[EMAIL PROTECTED]
*

Original Message Follows
From: David G. Friedman [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: Validation error,
Date: Sat, 11 Sep 2004 17:14:06 -0400
Ruben,
Please include the full error.
Regards,
David
-Original Message-
From: Ruben Cepeda [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 11, 2004 4:46 PM
To: [EMAIL PROTECTED]
Subject: Validation error,
Hey Guys,
I get the following error when tring to use the struts-validator.tld
org.apache.struts.validator.taglib.html.ErrorsTei'
Can anyone help me with this problem.
*
Ruben Cepeda
[EMAIL PROTECTED]
*
_
Check out Election 2004 for up-to-date election news, plus voter tools and
more! http://special.msn.com/msn/election2004.armx
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Protecting files question

2004-09-12 Thread Joe Hertz
This has probably been asked before. Apologies if so, I didn't see anything
close enough.

This exact scenario is a bit different and more complicated than this, but
if this problem can be solved, I can work out the rest.

Say I want people to upload images using html:file, and have implemented
that successfully.

Now people get to view images (login role and other things determines what
images they get to see).

But how to protect those files from unauthorized viewing?

I could store the images in BLOB's in the database. That would achieve
security...But If I do that, how do they get to the user using the img tag?
Utter guess: This how the action attribute on the tag works, and I'd write
the file to the output stream in an action??? I can't imagine that this
would be the right answer (html source would then look like...I have
absolutely no idea)

Alternatively, say I don't want to store them as BLOB's, and just use the
file system. How do I keep people from potentially pointing their browsers
at the right URL and viewing files they aren't entitled to see?

How does one build security onto this type of app?

TIA

-Joe



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



RE: Protecting files question

2004-09-12 Thread Joe Hertz
Okay, the action attribute was actually the obvious choice (matching the
same attribute on the link tag).

So how does one do this?

 -Original Message-
 From: Joe Hertz [mailto:[EMAIL PROTECTED]
 Sent: Sunday, September 12, 2004 6:56 PM
 To: 'Struts Users Mailing List'
 Subject: Protecting files question


 This has probably been asked before. Apologies if so, I
 didn't see anything
 close enough.

 This exact scenario is a bit different and more complicated
 than this, but
 if this problem can be solved, I can work out the rest.

 Say I want people to upload images using html:file, and have
 implemented
 that successfully.

 Now people get to view images (login role and other things
 determines what
 images they get to see).

 But how to protect those files from unauthorized viewing?

 I could store the images in BLOB's in the database. That would achieve
 security...But If I do that, how do they get to the user
 using the img tag?
 Utter guess: This how the action attribute on the tag works,
 and I'd write
 the file to the output stream in an action??? I can't imagine
 that this
 would be the right answer (html source would then look like...I have
 absolutely no idea)

 Alternatively, say I don't want to store them as BLOB's, and
 just use the
 file system. How do I keep people from potentially pointing
 their browsers
 at the right URL and viewing files they aren't entitled to see?

 How does one build security onto this type of app?

 TIA

 -Joe



 -
 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: Protecting files question

2004-09-12 Thread João Vieira da Luz
Hi,

The Blob or file system are very similar in what concerns security.

In the first one you have to do an action that writes the file into
the output stream. Suppose that your files have and action is called
/showFile.

Html should look like this;
img src=/showFile.do?id=file id/img

About security:

IMO you have two choices. The first one is to create a HttpFilter that
filters the requests for your files and decide if the remote user has
the privileges to read the file requested.

The second is to implement the preprocess method on Struts RequestProcessor.

Hope this help you,
   João





On Sun, 12 Sep 2004 18:56:13 -0400, Joe Hertz [EMAIL PROTECTED] wrote:
 This has probably been asked before. Apologies if so, I didn't see anything
 close enough.
 
 This exact scenario is a bit different and more complicated than this, but
 if this problem can be solved, I can work out the rest.
 
 Say I want people to upload images using html:file, and have implemented
 that successfully.
 
 Now people get to view images (login role and other things determines what
 images they get to see).
 
 But how to protect those files from unauthorized viewing?
 
 I could store the images in BLOB's in the database. That would achieve
 security...But If I do that, how do they get to the user using the img tag?
 Utter guess: This how the action attribute on the tag works, and I'd write
 the file to the output stream in an action??? I can't imagine that this
 would be the right answer (html source would then look like...I have
 absolutely no idea)
 
 Alternatively, say I don't want to store them as BLOB's, and just use the
 file system. How do I keep people from potentially pointing their browsers
 at the right URL and viewing files they aren't entitled to see?
 
 How does one build security onto this type of app?
 
 TIA
 
 -Joe
 
 -
 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: Protecting files question

2004-09-12 Thread Joe Hertz
Okay, so I do write the image out. Whew. Very helpful. tx.

I'm writing the files above my app's directory, so as long as tomcat doesn't
let people use .. in their URL's, I don't see a problem here.

If the Action itself checks for user validity, and the files aren't
accessible any other way, would that be enough?

Problem is, I'm keenly aware that it's what I am NOT anticipating that will
bite me in the arse.

tx again

-J

 -Original Message-
 From: João Vieira da Luz [mailto:[EMAIL PROTECTED]
 Sent: Sunday, September 12, 2004 7:09 PM
 To: Struts Users Mailing List
 Subject: Re: Protecting files question


 Hi,

 The Blob or file system are very similar in what concerns security.

 In the first one you have to do an action that writes the file into
 the output stream. Suppose that your files have and action is called
 /showFile.

 Html should look like this;
 img src=/showFile.do?id=file id/img

 About security:

 IMO you have two choices. The first one is to create a HttpFilter that
 filters the requests for your files and decide if the remote user has
 the privileges to read the file requested.

 The second is to implement the preprocess method on Struts
 RequestProcessor.

 Hope this help you,
João





 On Sun, 12 Sep 2004 18:56:13 -0400, Joe Hertz
 [EMAIL PROTECTED] wrote:
  This has probably been asked before. Apologies if so, I
 didn't see anything
  close enough.
 
  This exact scenario is a bit different and more complicated
 than this, but
  if this problem can be solved, I can work out the rest.
 
  Say I want people to upload images using html:file, and
 have implemented
  that successfully.
 
  Now people get to view images (login role and other things
 determines what
  images they get to see).
 
  But how to protect those files from unauthorized viewing?
 
  I could store the images in BLOB's in the database. That
 would achieve
  security...But If I do that, how do they get to the user
 using the img tag?
  Utter guess: This how the action attribute on the tag
 works, and I'd write
  the file to the output stream in an action??? I can't
 imagine that this
  would be the right answer (html source would then look like...I have
  absolutely no idea)
 
  Alternatively, say I don't want to store them as BLOB's,
 and just use the
  file system. How do I keep people from potentially pointing
 their browsers
  at the right URL and viewing files they aren't entitled to see?
 
  How does one build security onto this type of app?
 
  TIA
 
  -Joe
 
 
 -
  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: Protecting files question

2004-09-12 Thread mail
A better choice, at least in my mini brainiverse ;-) would be a servlet.
You then map an url pattern and have a 100% transparent solution.
One major benefit is the possibility to exchange the, for eg., file system
based servlet with a DB based one without needing to change even one
line of code in your application. Just modify your web.xml servlet entry
and add the necessary .jar or .class files ...
Only my 2 cents,
Chris

Joe Hertz wrote:
Okay, so I do write the image out. Whew. Very helpful. tx.
I'm writing the files above my app's directory, so as long as tomcat doesn't
let people use .. in their URL's, I don't see a problem here.
If the Action itself checks for user validity, and the files aren't
accessible any other way, would that be enough?
Problem is, I'm keenly aware that it's what I am NOT anticipating that will
bite me in the arse.
tx again
-J
 

-Original Message-
From: João Vieira da Luz [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 12, 2004 7:09 PM
To: Struts Users Mailing List
Subject: Re: Protecting files question
Hi,
The Blob or file system are very similar in what concerns security.
In the first one you have to do an action that writes the file into
the output stream. Suppose that your files have and action is called
/showFile.
Html should look like this;
img src=/showFile.do?id=file id/img
About security:
IMO you have two choices. The first one is to create a HttpFilter that
filters the requests for your files and decide if the remote user has
the privileges to read the file requested.
The second is to implement the preprocess method on Struts
RequestProcessor.
Hope this help you,
  João


On Sun, 12 Sep 2004 18:56:13 -0400, Joe Hertz
[EMAIL PROTECTED] wrote:
   

This has probably been asked before. Apologies if so, I
 

didn't see anything
   

close enough.
This exact scenario is a bit different and more complicated
 

than this, but
   

if this problem can be solved, I can work out the rest.
Say I want people to upload images using html:file, and
 

have implemented
   

that successfully.
Now people get to view images (login role and other things
 

determines what
   

images they get to see).
But how to protect those files from unauthorized viewing?
I could store the images in BLOB's in the database. That
 

would achieve
   

security...But If I do that, how do they get to the user
 

using the img tag?
   

Utter guess: This how the action attribute on the tag
 

works, and I'd write
   

the file to the output stream in an action??? I can't
 

imagine that this
   

would be the right answer (html source would then look like...I have
absolutely no idea)
Alternatively, say I don't want to store them as BLOB's,
 

and just use the
   

file system. How do I keep people from potentially pointing
 

their browsers
   

at the right URL and viewing files they aren't entitled to see?
How does one build security onto this type of app?
TIA
-Joe
 

-
   

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]
 



Struts, Tiles and CSS

2004-09-12 Thread Giuseppe Di Guglielmo
I'm using Struts and Tiles; please, I want to know which is the most
simple way to import more css for a specific page, without charging all
css files (only the files I need). Which is the best practice?
I need putting some test in the servlet or testing on the jsp?
If I put tests in the servlet, I assume that servlets know the view.
Thanks,
GDG
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Advantages of J2EE w. Struts vs .NET ASP.NET

2004-09-12 Thread Leandro Melo
I guess it depends about what you really want for your
app. Is it just a project? Is it a product? Will it
need maintance? Do you care about best software
engineering? How much time do you have? 

My opinion is:
--- please answer this questions (just came up on
my mind at the moment).
Want a nice archictutred software? Want a maintanable
software? Want to make real use of design patterns?
Want a portable application? Want to work with tons of
best of breed techonologies (free)? Want to be able to
make choices among hundreds of frameworks (web,
validation, testing, persistence, code generation,
etc...)?
If you said YES to all of my last questions = Go for
J2EE!!! Better, go to a java enviroment!



 --- Anders Jacobsen [EMAIL PROTECTED] escreveu: 
 Hi
 
 I think this place would be a good place to good
 some colored ;) comments on 
 and Web applications implemented with J2EE w./
 Struts and the same 
 implemented with ASP.NET.
 
 Microsoft people tends to have just one
 point-of-view so I hope I could find 
 some people who preferable had experience with both
 frameworks.
 
 I know it´s hard to find a winnner, but some
 con/pros from real developers 
 would be of great value. The main functionality of
 the web application is 
 edit/upate/delete operations and the like.
 
 Thanks in regards
 Anders 
 
 
 
 

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





___
Yahoo! Messenger 6.0 - jogos, emoticons sonoros e muita diversão. Instale agora!
http://br.download.yahoo.com/messenger/

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



Re: Simple log4j.properties HELP

2004-09-12 Thread struts Dude
Hi David,

I don't have this file, no idea where that is supposed to be. I just
drop a log4j.properties file in /WEB-INF/classes of my web app.

Thanks

- Original Message - 
From: David G. Friedman [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, September 07, 2004 2:42 PM
Subject: RE: Simple log4j.properties HELP


 Can you show us your commons-logging.properties file, which should set up
 the sending of log messages to log4j?

 Regards,
 David

 -Original Message-
 From: struts Dude [mailto:[EMAIL PROTECTED]
 Sent: Monday, September 06, 2004 7:31 AM
 To: Struts Users Mailing List
 Subject: Simple log4j.properties HELP


 Hi guys
 I can't seem to get the following simple log4j.properties file
 to work. I have log4j-1.2.8.jar and commons-logging-1-0-3.jar
 in WEB-INF/lib of my web app.

 Also the following log4j.properties in class folder of web app.

 -

 log4j.rootCategory=info, stdout
 log4j.logger.com.template=debug, rolling

 log4j.additivity.com.template=false

 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

 log4j.appender.stdout.layout.ConversionPattern=%-5p [%t] %c %M- %m%n

 log4j.appender.rolling=org.apache.log4j.RollingFileAppender
 log4j.appender.rolling.File=${catalina.home}/logs/webcontact.log
 log4j.appender.rolling.MaxFileSize=300kb
 log4j.appender.rolling.MaxBackupIndex=9
 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
 log4j.appender.rolling.layout.ConversionPattern=%d{MM/dd/yy hh:mm:ss a}
%-5p
 %C %M- %m%n

 

 stdout logger seems to work fine but I can't output anything
 to rolling logger. I did create an empty webcontact.log file
 in ${catalina.home}/logs though.

 I use tomcat-5.0.27.

 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]



RE: Simple log4j.properties HELP

2004-09-12 Thread David G. Friedman
From your log4j.properties file, you should
find more information in the log file 
named under the rolling appender which
your .properties file listed as being at:
${catalina.home}/logs/webcontact.log

Regards,
David

-Original Message-
From: struts Dude [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 12, 2004 10:34 PM
To: Struts Users Mailing List
Subject: Re: Simple log4j.properties HELP


Hi David,

I don't have this file, no idea where that is supposed to be. I just
drop a log4j.properties file in /WEB-INF/classes of my web app.

Thanks

- Original Message - 
From: David G. Friedman [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, September 07, 2004 2:42 PM
Subject: RE: Simple log4j.properties HELP


 Can you show us your commons-logging.properties file, which should set up
 the sending of log messages to log4j?

 Regards,
 David

 -Original Message-
 From: struts Dude [mailto:[EMAIL PROTECTED]
 Sent: Monday, September 06, 2004 7:31 AM
 To: Struts Users Mailing List
 Subject: Simple log4j.properties HELP


 Hi guys
 I can't seem to get the following simple log4j.properties file
 to work. I have log4j-1.2.8.jar and commons-logging-1-0-3.jar
 in WEB-INF/lib of my web app.

 Also the following log4j.properties in class folder of web app.

 -

 log4j.rootCategory=info, stdout
 log4j.logger.com.template=debug, rolling

 log4j.additivity.com.template=false

 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

 log4j.appender.stdout.layout.ConversionPattern=%-5p [%t] %c %M- %m%n

 log4j.appender.rolling=org.apache.log4j.RollingFileAppender
 log4j.appender.rolling.File=${catalina.home}/logs/webcontact.log
 log4j.appender.rolling.MaxFileSize=300kb
 log4j.appender.rolling.MaxBackupIndex=9
 log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
 log4j.appender.rolling.layout.ConversionPattern=%d{MM/dd/yy hh:mm:ss a}
%-5p
 %C %M- %m%n

 

 stdout logger seems to work fine but I can't output anything
 to rolling logger. I did create an empty webcontact.log file
 in ${catalina.home}/logs though.

 I use tomcat-5.0.27.

 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]



[ANNOUNCE] Struts 1.2.4 Test Build Available

2004-09-12 Thread Martin Cooper
The Struts 1.2.4 Test Build is now available here:
http://cvs.apache.org/dist/struts/v1.2.4/
This build fixes some problems with the 1.2.3 Test Build, and fixes some 
additional outstanding issues.

Once feedback has been collected on the stability and quality of this 
release, a determination will be made as to whether it should be promoted 
to General Availability (GA) status, and replace the recently withdrawn 
1.2.2 release.

You are encouraged to download and test this build at your earliest 
convenience, and provide your feedback via the lists or via the bug 
database.

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


Need example of using DynaActionForm with ArrayList (1.1)

2004-09-12 Thread Antony Paul
Hi all,
Using Struts 1.1.
I have an ActionForm in which displays an array of items. I want to use
DynaValidatorForm here which uses ArrayList as property holders. I am able
to pre-populate the form. I have trouble in displaying the values and on
submission nothing is populated. If somebody can give an example it will be
very useful to me.

Struts-config.xml
--
form-bean name=PriceForm
type=org.apache.struts.validator.DynaValidatorForm
   form-property name=productid type=java.util.ArrayList/
   form-property name=productdesc type=java.util.ArrayList/
/form-bean

JSP
---
logic:iterate name=PriceForm property=productid id=pid
indexId=index
   tr
//html:hidden property='%=productid[+index+]%'/
tdhtml:text property=productdesc indexed=true/

td//html:text property='%=productdesc[+index+]%'/

   /tr
   /logic:iterate

I  tried using indexed attribute. Then HTML generated is

input type=text name=org.apache.struts.taglib.html.BEAN[0].productdesc
value=[product desc 0]

See the value is in braces.

If I use html:text property=productdesc indexed=true/ I get

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

What is wrong ?.

rgds
Antony Paul




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



Re: Not happy with approaches.. looking for better/other suggestions

2004-09-12 Thread struts Dude
Just a silly question.

Where did ListUtils come from?? I can't find this
in my JDK1.4.2.

Thanks


- Original Message - 
From: Hubert Rabago [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, September 03, 2004 7:40 AM
Subject: Re: Not happy with approaches.. looking for better/other
suggestions


 Have you tried using ListUtils.lazyList() for this?  I just tried it
 on a sample app and it works in cases like this.

 - Hubert

 On Thu, 02 Sep 2004 14:27:32 -0400, Rick Reumann [EMAIL PROTECTED]
wrote:
  One of the most frustrating things I run into when developing Struts
  applications is the problem of when you want to use a request scoped
  ActionForm but you need to populate a collection that is one of your
  ActionForm properties. The problem is the classic index out of bounds
  exception if you do not have your collection populated with enough
objects.
 
  For example imagine the case where you might want to edit a bunch of
  Access definitions on one form.
 
  So in an ActionForm property you have:
 
  Collection accessDefinitions;
 
  In your Action before you get to the form you populate your form:
 
  ((AccessForm)form).setAccessDefinitions( aCollectionOfDefs );
 
  Your JSP then displays the access definition properties for the user to
  edit:
 
  (condensed and table formatting removed:)
 
  c:forEach items=${accessForm.accessDefinitions} var=access
  varStatus=status
html:text property=accessDefinitions[${status.index}].name/
html:text property=accessDefinitions[${status.index}].description/
  /c:forEach
 
  Now the problem will be when you submit this form. If this form was
  given request scope in the action mapping, you'll end up with errors
  since BeanUtils can not populate the Collection. You need to have the
  correct size in place for 'accessDefinitions' to allow for population.
 
  There are several solutions that have been proposed by searching the
  list archives.
 
  The easiest alternative is of course to just put your form in Session
  scope, but that is such a waste in my opinion.
 
  Another approach would be something like:
 
  In reset() of ActionForm:
 
  public void reset(ActionMapping actionMapping, HttpServletRequest
request) {
  if ( request.getParameter(accessDefinitionsSize) != null ) {
  int accessDefinitionsSize = new
  Integer(request.getParameter(accessDefinitionsSize)).intValue();
  accessDefinitions = new ArrayList(accessDefinitionsSize);
  for (int i=0;iaccessDefinitionsSize;i++) {
  accessDefinitions.add(new AccessDefinitionVO());
  }
  }
  }
 
  Then in your JSP (code snipped just showing releveant portion):
 
  c:forEach items=${accessForm.accessDefinitions} var=access
  varStatus=status

c:set var=accessDefinitionsSize value=${status.count}/
  /c:forEach
  input type=hidden name=accessDefinitionsSize
  value=${accessDefinitionsSize}/
 
  The above works 'ok' but it's so much extra code. I've thought of just
  adding the accessDefinitionsSize attribute to the Session in the Action
  that is called right be the form is set up. Then the reset method can
  pull it right from there. An int in the session won't be too much
  overhead. But I'm not sure if I like that approach that much either
  (although I'm leaning towards just doing it that way).
 
  Of course I don't like the approaches that call a business class from
  the reset to get the size.
 
  Any suggestions welcome.
 
  --
  Rick
 
  -
  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: Not happy with approaches.. looking for better/other suggestions

2004-09-12 Thread Yves Sy
Dude all you have to do is do something as simple as entering
ListUtils in Google and you'll find out.

-Yves-

On Mon, 13 Sep 2004 17:04:18 +1200, struts Dude [EMAIL PROTECTED] wrote:
 Just a silly question.
 
 Where did ListUtils come from?? I can't find this
 in my JDK1.4.2.
 
 Thanks
 
 
 
 
 - Original Message -
 From: Hubert Rabago [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Friday, September 03, 2004 7:40 AM
 Subject: Re: Not happy with approaches.. looking for better/other
 suggestions
 
  Have you tried using ListUtils.lazyList() for this?  I just tried it
  on a sample app and it works in cases like this.
 
  - Hubert
 
  On Thu, 02 Sep 2004 14:27:32 -0400, Rick Reumann [EMAIL PROTECTED]
 wrote:
   One of the most frustrating things I run into when developing Struts
   applications is the problem of when you want to use a request scoped
   ActionForm but you need to populate a collection that is one of your
   ActionForm properties. The problem is the classic index out of bounds
   exception if you do not have your collection populated with enough
 objects.
  
   For example imagine the case where you might want to edit a bunch of
   Access definitions on one form.
  
   So in an ActionForm property you have:
  
   Collection accessDefinitions;
  
   In your Action before you get to the form you populate your form:
  
   ((AccessForm)form).setAccessDefinitions( aCollectionOfDefs );
  
   Your JSP then displays the access definition properties for the user to
   edit:
  
   (condensed and table formatting removed:)
  
   c:forEach items=${accessForm.accessDefinitions} var=access
   varStatus=status
 html:text property=accessDefinitions[${status.index}].name/
 html:text property=accessDefinitions[${status.index}].description/
   /c:forEach
  
   Now the problem will be when you submit this form. If this form was
   given request scope in the action mapping, you'll end up with errors
   since BeanUtils can not populate the Collection. You need to have the
   correct size in place for 'accessDefinitions' to allow for population.
  
   There are several solutions that have been proposed by searching the
   list archives.
  
   The easiest alternative is of course to just put your form in Session
   scope, but that is such a waste in my opinion.
  
   Another approach would be something like:
  
   In reset() of ActionForm:
  
   public void reset(ActionMapping actionMapping, HttpServletRequest
 request) {
   if ( request.getParameter(accessDefinitionsSize) != null ) {
   int accessDefinitionsSize = new
   Integer(request.getParameter(accessDefinitionsSize)).intValue();
   accessDefinitions = new ArrayList(accessDefinitionsSize);
   for (int i=0;iaccessDefinitionsSize;i++) {
   accessDefinitions.add(new AccessDefinitionVO());
   }
   }
   }
  
   Then in your JSP (code snipped just showing releveant portion):
  
   c:forEach items=${accessForm.accessDefinitions} var=access
   varStatus=status
 
 c:set var=accessDefinitionsSize value=${status.count}/
   /c:forEach
   input type=hidden name=accessDefinitionsSize
   value=${accessDefinitionsSize}/
  
   The above works 'ok' but it's so much extra code. I've thought of just
   adding the accessDefinitionsSize attribute to the Session in the Action
   that is called right be the form is set up. Then the reset method can
   pull it right from there. An int in the session won't be too much
   overhead. But I'm not sure if I like that approach that much either
   (although I'm leaning towards just doing it that way).
  
   Of course I don't like the approaches that call a business class from
   the reset to get the size.
  
   Any suggestions welcome.
  
   --
   Rick
  
   -
   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]
 
 



-- 
For me to poop on!
http://www.formetopoopon.com
http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml

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



Trying to come up with a Mapping-Dispatch combo Action

2004-09-12 Thread Rick Reumann
Not sure which list this question/topic really belongs on so posting to 
both. (I'm bringing it up on the dev list because I'm thinking maybe the 
base MappingDispatchAction could/should be modified).

Some design background. I like to keep related tasks belonging in one 
Dispatch Action class (flavor to be discussed). This is a typical 
approach, yet one of the problems is desided on the type of 
DispatchAction ... keep it DispatchAction or use one of the subclasses 
LookupDispatch or MappingDispatch.

First off I really don't like the LookupDispatchAction. I've used it 
extensively in a large application and it becomes a real pain. It 
becomes really ugly to use when you start having some generic button 
names that you reuse for different things. For example a changing 
requirment was that we ended up having to use a button called Ok a lot 
(I know stupid). So sometimes Ok would submit to the same 
LookupDispatchAction but would need to access different methods. You 
end up then having to create 'fake' button names in your resources file 
just so the LookupDispatchAction can work correctly. Maintenance of the 
LookupDispatch can be a pain also. Anyway...

Until the MappingDispatchAction, I've been relatively content with using 
a standard DispathAction. What I like about the MappingDispatchAction is 
that it works really nicely for links - you don't have to append a 
dispatch parameter name to the URL. It's also nice for typical forms 
since you don't have to provide a hidden dispatch parameter on the page.

The only problem I'm running into it is when you have a form with more 
than one button and each button should call a different dispatch method. 
I haven't really figured out a good way to work this out with the 
MappingDispatchAction.  I think trying to change the form's action 
attribute using JavaScript will be ugly (assuming it can even be done, 
I've never tried it). The only solution I can think of at the moment 
would be to override the getMethodName method of MappingDispatch and 
provide an extra mapping in your config where the parameter would change 
to something like parameter=dispatchMethod

The overridden getMethodName might look like
protected String getMethodName(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
String parameter)
throws Exception {

if( dispatchMethod.equals( parameter ) {
parameter = request.getParameter(parameter);
}
return parameter
}
This would allow you to use the MappingDispatchAction like a 
DispatchActoin when needed. The only caveat is you would have to make 
sure the if statement in the above is what you wanted. (Probably better 
to pull the parameter name dispatchMethod from a properties file or 
constants class).

Maybe there is a much better way to accomplish what I'm concerned with?
--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Problem in defining tab inside JSP file

2004-09-12 Thread Manisha Sathe
I am totally new to structs / JSP / Java. I am modifying the existing program. Want to 
put one html tag inside the JSP file. I tried 
 
html:hidden property=testvar  /
 
 
but i always get error 
 
[ServletException in:RoomListContent.jsp] No getter method for property testvar of 
bean org.apache.struts.taglib.html.BEAN' 
 
Pls let me know - what i am missing ?
 
 
Thanks in advance and regards
Manisha
 
 
 
 


-
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.