Re: Struts Beta 03 Build Problem

2001-06-09 Thread [EMAIL PROTECTED]

Hello Craig,

Yes!  The optional.jar was indeed the missing ingredient.  I am happily
building Struts now.

Thank you!

On Fri, 8 Jun 2001, Oleg V Alexeev wrote:

> Hello David,
>
> Friday, June 08, 2001, 9:06:12 AM, you wrote:
>
> DM> Any idea why I am consistently getting an
"org.apache.tools.ant.taskdefs.optional.TraXLiason"
ClassNotFoundException when trying an "ant dist" build of
jakarta-struts-1.0-b3-src using Ant 1.3 on
> DM> both NT and Linux?  I have what seem to be the only required jars
in my path: xalan.jar and jaxp.jar
from jaxp-1_1.zip, and jdbc2_0-stdext.jar, with jdk1.3.1?
>
> Place crimson.jar, jaxp.jar, xalan.jar files from jaxp-1_1.zip to the
> jdk extension dir - x:\jdk1.3.1\jre\lib\ext for example.
>
> --
> Best regards,
>  Olegmailto:[EMAIL PROTECTED]





template:put and get

2001-06-09 Thread Jim Richards


I've got a situation where I want to include a header file with





and then in the header file have



but replace the page="" with the . Trouble is you can't nest 
tags. One options is to do the html without the jsp, and have



but that doesn't look great, but I can't think of anything else. The 
seems to hide the content away somewhere away in the request, and I don't want to
create 20 little html/jsp pages for the different headers that I have.

Any ideas?



--
Kumera - a new Open Source Content Management System
for small to medium web sites written in Perl and using XML
http://www.cyber4.org/kumera/index.html



form beans are not being added to the session

2001-06-09 Thread Eliot Stock

My struts-config.xml contains:


  
  
  



   
   
   
   
   




  


  

  


  

  


  



So my page flow goes login.jsp -> location.jsp -> request.jsp. I expect
to find my loginForm in the session when I'm in my
RequestAction.perform() method. It's not there. Only the request form
bean is. If I do this:

log.debug("session:");
Enumeration attributes = session.getAttributeNames();
while (attributes.hasMoreElements())
{
log.debug(attributes.nextElement());
}

in each perform() method, all I see is this:


[DEBUG] session:
[DEBUG] org.apache.struts.action.LOCALE
[DEBUG] loginForm

[DEBUG] session:
[DEBUG] requestForm
[DEBUG] org.apache.struts.action.LOCALE

Is this the intended behavior or am I doing something wrong?

Eliot Stock






Re: File Upload Corrupting Zip File

2001-06-09 Thread Martin Cooper

Do you have a binary diff utility that you could use to see what changed in
the uploaded file? That would be very helpful.

Also, if you can tell me how many bytes were added to the file, and what
type of file it was that caused the problem, that might help too.

Thanks.

--
Martin Cooper


- Original Message -
From: "Darryl Pentz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 7:31 AM
Subject: File Upload Corrupting Zip File


> Hi all,
>
> Something happens to corrupt a file I'm uploading from a multipart form.
If
> I run a ZIP file through my unzip utility targeting the actual ZIP file,
it
> unzips just fine. If I point my unzip utility at the temporary file in the
> deployments temp directory of Orion Server (the app server I'm using), the
> utility fails with a ZipException indicating it expected x bytes but got
x+
> bytes on one of the zip entries.
>
> I did the same with WinZip and it worked on the original ZIP and also
failed
> on the uploaded temp file. It seems to me that the problem most likely
lies
> with Struts, particularly the DiskMultipartRequestHandler.java but there's
> nothing in there that appears suspicious. Does anyone have any insight on
> this or has anyone perhaps had this same problem?
>
> Interestingly though, I unzipped the file, removed the entry that was
> causing the problem, rezipped it and everything worked fine. That doesn't
> however exonerate Struts however, since both my zip utility AND WinZip
> worked on the original ZIP. The problem only occurs after Struts has
> uploaded the file.
>
> Here is the output that WinZip gave me when it failed to unzip the temp
> file:
>
> Extracting to "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\"
> Use Path: no   Overlay Files: yes
> warning
>
[C:/orion/application-deployments/wellcert/wellcert-web/temp/strts34531.tmp]
> :  extra 1 bytes at beginning or within Zip file (attempting to process
> anyway)
> Error in file #1:  bad Zip file offset (Error local header signature not
> found):  409756
> (attempting to re-compensate)
> Extracting Image36.gif
> Error: unexpected end of file encountered
> Error:  invalid compressed data to inflate
>
> thanks in advance,
> Darryl Pentz
>





JSP translated to Tags???

2001-06-09 Thread Gogineni, Pratima

Speaking of JRUN - I was playing with their latest version 3.1 and they have
a very strange concept/tool ..

You can write jsp pages and name them with a *.jst extension and they get
translated to a custom tag instead of to a servlet. I thought it was not a
good idea - jsp to create tags to use in jsp? and i guess you lose quite a
bit of control on how it is translated etc. and I dont see why writing the
code  as  scriptlets in the jsp page is better than writing the tag handler
classes your self? 

Does any one see any merits in this approach?

pratima
-Original Message-
From: Gogineni, Pratima 
Sent: Saturday, June 09, 2001 9:24 PM
To: '[EMAIL PROTECTED]'
Subject: RE: more strange JRUN behavior


sadly - I see this in 3.0 as well as 3.1 which was very recently released. I
havent tested the basic authentication as yet. I thought I would have more
control using the form based authentication. I need to evaluate and see if
the basic authentication works fine - else I should probably go with custom
authentication  

I went through their forums too and found messages about the form based
authentication.

Pratima

-Original Message-
From: George Craig [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 09, 2001 7:28 PM
To: [EMAIL PROTECTED]
Subject: Re: more strange JRUN behavior


I, too, have observed this intermittent quirkiness in its authentication
behavior.

After reading all of their forum posts, the consensus is to use Basic
authentication. I concur that it has been the most stable for container
authentication in J-Run. I would shy away from Form-based authentication
until Macromedia has stabilized it in the next release (to some extent IIRC,
even they acknowledge its shortcomings.) However, I realize this might not
be an option for you.

For us, we've opted to use SiteMinder.

george


- Original Message -
From: "Gogineni, Pratima" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 8:16 PM
Subject: more strange JRUN behavior


>
> I have  a webapp that I have been testing under both tomcat and JRUN for
> sometime now. About a month ago I decided to go with app server provided
> form based security.
> I tested my app on JRUN,Tomcat and Resin and it worked fine.
>
> Since then I had been working only on tomcat - now when I tested with JRUN
> the login screen comes up, I enter the name and password and the screen
just
> hangs and the progress bar tells me "opening page j_security-check"  - now
> to check if it was the application that was causing the problem. I created
a
> dummy page that does nothing as the welcome page and I CAN login.
>
> So something in my application is causing JRUN to hang at the security
check
> - doesnt make too much sense to me. Another thing is that I disabled the
> authentication totally and the application works fine on JRUN.
>
> Now the question is - has anyone had similar problems with JRUN or have an
> idea why something like this should occur? Surely my app should not
> interfere with the appserver authentication - it should atleast
authenticate
> me and then show an error page. Also works fine in tomcat No error
> messages in the log files... My init servlets (both Action servlet and my
> own custom servlet) seem to be starting up fine.
>
> Does anyone have good/bad experiences with JRUN? I have had extremely
flaky
> behavior from JRUN.
> Things seem to work great on Tomcat and Resin.
>
> pratima



RE: more strange JRUN behavior

2001-06-09 Thread Gogineni, Pratima

sadly - I see this in 3.0 as well as 3.1 which was very recently released. I
havent tested the basic authentication as yet. I thought I would have more
control using the form based authentication. I need to evaluate and see if
the basic authentication works fine - else I should probably go with custom
authentication  

I went through their forums too and found messages about the form based
authentication.

Pratima

-Original Message-
From: George Craig [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 09, 2001 7:28 PM
To: [EMAIL PROTECTED]
Subject: Re: more strange JRUN behavior


I, too, have observed this intermittent quirkiness in its authentication
behavior.

After reading all of their forum posts, the consensus is to use Basic
authentication. I concur that it has been the most stable for container
authentication in J-Run. I would shy away from Form-based authentication
until Macromedia has stabilized it in the next release (to some extent IIRC,
even they acknowledge its shortcomings.) However, I realize this might not
be an option for you.

For us, we've opted to use SiteMinder.

george


- Original Message -
From: "Gogineni, Pratima" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 8:16 PM
Subject: more strange JRUN behavior


>
> I have  a webapp that I have been testing under both tomcat and JRUN for
> sometime now. About a month ago I decided to go with app server provided
> form based security.
> I tested my app on JRUN,Tomcat and Resin and it worked fine.
>
> Since then I had been working only on tomcat - now when I tested with JRUN
> the login screen comes up, I enter the name and password and the screen
just
> hangs and the progress bar tells me "opening page j_security-check"  - now
> to check if it was the application that was causing the problem. I created
a
> dummy page that does nothing as the welcome page and I CAN login.
>
> So something in my application is causing JRUN to hang at the security
check
> - doesnt make too much sense to me. Another thing is that I disabled the
> authentication totally and the application works fine on JRUN.
>
> Now the question is - has anyone had similar problems with JRUN or have an
> idea why something like this should occur? Surely my app should not
> interfere with the appserver authentication - it should atleast
authenticate
> me and then show an error page. Also works fine in tomcat No error
> messages in the log files... My init servlets (both Action servlet and my
> own custom servlet) seem to be starting up fine.
>
> Does anyone have good/bad experiences with JRUN? I have had extremely
flaky
> behavior from JRUN.
> Things seem to work great on Tomcat and Resin.
>
> pratima



Re: uploading file requires immediate serialization location?

2001-06-09 Thread Martin Cooper

Let me see if I can describe the process.

1. Check to see if the request should be treated as multipart (i.e. content
type is multipart/form-data and method is POST). If not, carry on as normal.
2. Find the multipart handler or instantiate one, set it on the form bean,
and call it to handle the request.
2a. Iterate over the fields (parts) in the request.
2a1. If the current part is not a file, store it as a String.
2a2. If the current part is a file (according to the Content-Disposition
header), create a new file in the temp directory, stream the content of the
part to that file, create a new object which implements FormFile, and store
the file data in it.
2b. Turn the set of fields into something that looks like regular request
parameters.
3. Populate the ActionForm instance from the set of request parameters.
Here, the value of a file parameter has type FormFile, so it matches a
setter on the form bean that takes a FormFile as a parameter.

That's the gist of it, although there are some other nitty gritty details.
Almost all of this happens inside the code that populates the form bean from
request parameters.

It appears (from my reading of the source, anyway) that the temporary files
will not be automatically deleted until another request comes in that uses
the same form bean instance, or until the form bean instance goes away.
Given that, I would recommend calling setMultipartRequestHandler(null) from
your form bean's reset() method if you keep your beans in session scope.

The part you are interested in, I believe, is 2a2 above. Unfortunately, that
code is buried inside an iterator class, so you can't override just that
piece. I assume what you would want is that the data is kept in memory
instead of to a file. Interestingly, I believe the original implementation
did this, but it was changed to use files because of potential memory
problems with large uploads.

Hope this helps.

--
Martin Cooper


- Original Message -
From: "Jonathan Asbell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 8:11 PM
Subject: Re: uploading file requires immediate serialization location?


> Hello Martin.  So is it POSSIBLE to save binary data in a bean?  What does
> struts do?  These are my real questions.  If I have a form which besides
> fields, has an uploaded file, how does the bean actually handle the file?
> Is there a conceptual step by step you can give me.  How does the
ActionForm
> save (and validate) the binary data sent via input type "file".
>
>
> - Original Message -
> From: "Martin Cooper" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "Jonathan Asbell"
<[EMAIL PROTECTED]>
> Sent: Saturday, June 09, 2001 10:55 PM
> Subject: Re: uploading file requires immediate serialization location?
>
>
> > Internally to Struts, multipart handling is provided through an
interface,
> > MultipartRequestHandler. In Struts 1.0, the only supplied implementation
> of
> > this interface is DiskMultipartRequestHandler, which, as you might
expect,
> > writes "file" parts to disk as it encounters them.
> >
> > Struts does allow you to configure the multipart handler to use, by
> > specifying the class name in the multipartClass init-param for your web
> app.
> > This allows you to provide your own implementation if you want to
> (although
> > this is no small task).
> >
> > --
> > Martin Cooper
> >
> >
> > - Original Message -
> > From: "Jonathan Asbell" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, June 09, 2001 6:39 AM
> > Subject: uploading file requires immediate serialization location?
> >
> >
> > Hello all.
> > I am just trying to understand an aspect of a multipart request.  When
> > you submit after using an input of type "file", do you have to provide
> > an immediate location for the file to be serialized to, or can you store
> > it in a java object (in a bean's field) as a binary object until you are
> > ready to serialize it.  The reason is that I want to hold a jpeg in a
> > bean until the person completes the last page of the form, and THEN
> > serialize it.
> >
> >
> >
> >
>





Re: uploading file requires immediate serialization location?

2001-06-09 Thread Jonathan Asbell

Hello Martin.  So is it POSSIBLE to save binary data in a bean?  What does
struts do?  These are my real questions.  If I have a form which besides
fields, has an uploaded file, how does the bean actually handle the file?
Is there a conceptual step by step you can give me.  How does the ActionForm
save (and validate) the binary data sent via input type "file".


- Original Message -
From: "Martin Cooper" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Jonathan Asbell" <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 10:55 PM
Subject: Re: uploading file requires immediate serialization location?


> Internally to Struts, multipart handling is provided through an interface,
> MultipartRequestHandler. In Struts 1.0, the only supplied implementation
of
> this interface is DiskMultipartRequestHandler, which, as you might expect,
> writes "file" parts to disk as it encounters them.
>
> Struts does allow you to configure the multipart handler to use, by
> specifying the class name in the multipartClass init-param for your web
app.
> This allows you to provide your own implementation if you want to
(although
> this is no small task).
>
> --
> Martin Cooper
>
>
> - Original Message -
> From: "Jonathan Asbell" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, June 09, 2001 6:39 AM
> Subject: uploading file requires immediate serialization location?
>
>
> Hello all.
> I am just trying to understand an aspect of a multipart request.  When
> you submit after using an input of type "file", do you have to provide
> an immediate location for the file to be serialized to, or can you store
> it in a java object (in a bean's field) as a binary object until you are
> ready to serialize it.  The reason is that I want to hold a jpeg in a
> bean until the person completes the last page of the form, and THEN
> serialize it.
>
>
>
>




Re: uploading file requires immediate serialization location?

2001-06-09 Thread Martin Cooper

Internally to Struts, multipart handling is provided through an interface,
MultipartRequestHandler. In Struts 1.0, the only supplied implementation of
this interface is DiskMultipartRequestHandler, which, as you might expect,
writes "file" parts to disk as it encounters them.

Struts does allow you to configure the multipart handler to use, by
specifying the class name in the multipartClass init-param for your web app.
This allows you to provide your own implementation if you want to (although
this is no small task).

--
Martin Cooper


- Original Message -
From: "Jonathan Asbell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 6:39 AM
Subject: uploading file requires immediate serialization location?


Hello all.
I am just trying to understand an aspect of a multipart request.  When
you submit after using an input of type "file", do you have to provide
an immediate location for the file to be serialized to, or can you store
it in a java object (in a bean's field) as a binary object until you are
ready to serialize it.  The reason is that I want to hold a jpeg in a
bean until the person completes the last page of the form, and THEN
serialize it.







Re: more strange JRUN behavior

2001-06-09 Thread George Craig

I, too, have observed this intermittent quirkiness in its authentication
behavior.

After reading all of their forum posts, the consensus is to use Basic
authentication. I concur that it has been the most stable for container
authentication in J-Run. I would shy away from Form-based authentication
until Macromedia has stabilized it in the next release (to some extent IIRC,
even they acknowledge its shortcomings.) However, I realize this might not
be an option for you.

For us, we've opted to use SiteMinder.

george


- Original Message -
From: "Gogineni, Pratima" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 8:16 PM
Subject: more strange JRUN behavior


>
> I have  a webapp that I have been testing under both tomcat and JRUN for
> sometime now. About a month ago I decided to go with app server provided
> form based security.
> I tested my app on JRUN,Tomcat and Resin and it worked fine.
>
> Since then I had been working only on tomcat - now when I tested with JRUN
> the login screen comes up, I enter the name and password and the screen
just
> hangs and the progress bar tells me "opening page j_security-check"  - now
> to check if it was the application that was causing the problem. I created
a
> dummy page that does nothing as the welcome page and I CAN login.
>
> So something in my application is causing JRUN to hang at the security
check
> - doesnt make too much sense to me. Another thing is that I disabled the
> authentication totally and the application works fine on JRUN.
>
> Now the question is - has anyone had similar problems with JRUN or have an
> idea why something like this should occur? Surely my app should not
> interfere with the appserver authentication - it should atleast
authenticate
> me and then show an error page. Also works fine in tomcat No error
> messages in the log files... My init servlets (both Action servlet and my
> own custom servlet) seem to be starting up fine.
>
> Does anyone have good/bad experiences with JRUN? I have had extremely
flaky
> behavior from JRUN.
> Things seem to work great on Tomcat and Resin.
>
> pratima




Re: ACtionError Issues

2001-06-09 Thread Martin Cooper

In your description, you said:

"Input on the struts-config page is department.do."

I believe that is the problem. You are specifying an Action path instead of
a JSP path for the input parameter in your struts-config.xml. In your
 element, you need to specify:



instead of specifying the department.do action.

Hope this helps.

--
Martin Cooper


- Original Message -
From: "Prabha Desai" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 07, 2001 6:22 AM
Subject: ACtionError Issues


> i have a page which calls an Action Form based on the action. Within the
> page, i have logic to view detail or not.
> I am trying to saveErrors and output them back to the page, but I keep
> getting an infinite loop.
>
>
> Error:
>
>
> path="" :action: Processing a POST for /department path="" :action:
> Looking for ActionForm bean under attribute 'departmentForm' path=""
> :action:  Recycling existing ActionForm bean instance of class
> 'com.netvendor.nvat.struts.forms.DepartmentForm' path="" :action:
> Populating bean properties from this request path="" :action:
> Validating input form properties path="" :action:   Validation error(s),
> redirecting to: /department.do
>
>
>
> my main page  is department.jsp
> The action to view is viewItem on which I need to show the errors..
> Input on the struts-config page is department.do.
> The initial page is department.jsp with action of viewList.
> This is already within the Action class.
> if (!errors.empty()) {
> saveErrors(request, errors);
> saveToken(request);
> return (new ActionForward(mapping.getInput()));
> }
>
> I need to write out errors if the user has not filled in all the items.
>
>





Re: viewing combo box

2001-06-09 Thread Martin Cooper

If you need to test for the property value being null, you can use the
 tag. If you need to test for a vector which exists but which
has no elements, you'll have to use another field in your form, as someone
else suggested, or use scriptlets in your page. (A better way of handling
this should appear in Struts 1.1 before too long.)

--
Martin Cooper


- Original Message -
From: "Alex Colic" <[EMAIL PROTECTED]>
To: "Struts" <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 1:49 PM
Subject: viewing combo box


> Hi,
>
> lets say you have a combo box filling from a vector. I can get this to
work
> but I don't want the combo box to show if there are no options in it. In
> other words if the vector=0. What the best way to do this.
>
> Thanks for the help.
>
> Alex
>
>





more strange JRUN behavior

2001-06-09 Thread Gogineni, Pratima


I have  a webapp that I have been testing under both tomcat and JRUN for
sometime now. About a month ago I decided to go with app server provided
form based security.
I tested my app on JRUN,Tomcat and Resin and it worked fine. 

Since then I had been working only on tomcat - now when I tested with JRUN
the login screen comes up, I enter the name and password and the screen just
hangs and the progress bar tells me "opening page j_security-check"  - now
to check if it was the application that was causing the problem. I created a
dummy page that does nothing as the welcome page and I CAN login. 

So something in my application is causing JRUN to hang at the security check
- doesnt make too much sense to me. Another thing is that I disabled the
authentication totally and the application works fine on JRUN.

Now the question is - has anyone had similar problems with JRUN or have an
idea why something like this should occur? Surely my app should not
interfere with the appserver authentication - it should atleast authenticate
me and then show an error page. Also works fine in tomcat No error
messages in the log files... My init servlets (both Action servlet and my
own custom servlet) seem to be starting up fine.

Does anyone have good/bad experiences with JRUN? I have had extremely flaky
behavior from JRUN.
Things seem to work great on Tomcat and Resin.

pratima



Re: "Java Server Faces"

2001-06-09 Thread Martin Cooper

No, JavaServer Faces is something different. JavaServer Faces is being
developed as JSR-127, the quick summary being "This specification defines an
architecture and APIs which simplify the creation and maintenance of Java
Server application GUIs".

The idea, as I understand it, is that JavaServer Faces will provide a GUI
component framework that tool vendors can use to develop standards-based
tools for designing JSP-based user interfaces. For more, see:

http://jcp.org/jsr/detail/127.jsp

Struts is referenced there, with a brief explanation of the differences, as
is the JSP Standard Tag Library (JSR-052).

--
Martin Cooper


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 8:37 PM
Subject: "Java Server Faces"


>
> At JavaOne today, it seemed to be suggested that j2ee would have a MVC
> framework join the recommendations.  Later in the talk ("scalibility in
the web
> tier with jsp blah blah" ridiculously long title), it struts was alluded
to as
> being part of j2ee in the future.  So is struts the ever mysterious "Java
Server
> Faces"?
>
> cheers,
> -Ian
>
> --
> Ian Kallen <[EMAIL PROTECTED]> | AIM: iankallen
>





Re: html:radio tag question

2001-06-09 Thread Martin Cooper

If you specify the same value for the 'property' attribute for all the radio
buttons which should be in the group, this should work. The value of the
'property' attribute (of your form or other bean) will then be used to
determine which one to select when the page is initially displayed, and the
same property will be used to store the value of the radio button selected
when the form is submitted.

Hope this helps.

--
Martin Cooper


- Original Message -
From: "Steve Salkin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 8:40 AM
Subject: html:radio tag question


> Hi-
>
> I am converting an html page to struts jsp. The original page has a set
> of radio buttons that are supposed to be mutually exclusive. Each has a
> name, and the author used javscript functions that refer to these names
> as onclick handlers.
>
> My struts  tags are all in the same form, yet they do not
> exhibit a mutual-exclusion behavior. When checking one, the others that
> are checked remain checked. I could manually fix this in javascript,
> except that I don't see how to get the  to emit a name and
> element attribute in the resulting 

Re: Exception handling in the ActionServlet

2001-06-09 Thread Craig R. McClanahan



On Sat, 9 Jun 2001 [EMAIL PROTECTED] wrote:

> Hi,
> 
> I would like to catch all of our project specific exceptions in one place (as a 
> last resort, if nobody else catches them earlier on) and handle them in a 
> generic way. The obvious way to do this, I think, is by overriding 
> processActionPerform in our own ActionServlet and catch 
> Exception's (superclass for all our own exceptions) there. But the 
> Action.perform method only throws IOException & ServletException, so either all 
> our own exceptions will have to inherit from either of those two classes (can't 
> be the right thing to do), or I will have to change the Action.perform 
> definition to also throw our Exception's (doesn't seem right either, 
> I'd prefer not to have to alter any struts code)?
> 
> What should I do?
> 

How about having the base class for you project exceptions be a subclass
of ServletException?  That way, you can throw it if you really want
to.  Then you could declare an  element in your web.xml file
to define common handling (if you don't the default will be an ugly stack
trace on most containers).

> This actually brings me to another problem that doesn't have anything to do 
> with struts, but is more a general Java question. Anyway, maybe somebody here 
> has an elegant solution to it:
> 
> Assume the problem above is solved and furthermore that some of the project 
> specific exceptions have to inherit from other existing exception classes (e.g. 
> ServletException, IOException, etc.). Since we don't have multiple inheritance, 
> I can't have a Exception that is a superclass to all my own 
> exceptions. I still want to catch all our own exceptions (but no others) in one 
> place. My first though was of course to define a Exception interface 
> and let all our own exceptions implement this interface, thus being able only 
> to catch Exception's. But Throwable is not an interface (why not? 
> What's the idea behind this design?) that Exception could inherit from 
> and thus this approach doesn't work, as the try{}catch(){} statement expects a 
> Throwable object as parameter (try{}catch(Exception e){} doesn't 
> compile).
> 
> Well, as a kind of a hack I then thought I'll catch all exceptions, check if it 
> is a project specific one (Exception.class.isInstance(anException)), 
> and if not throw it again, but that can't be right, because the method where 
> this happens then will have to be declared to throw Exception (to generic).
> 
> I'll appreciate any help, thanks in advance and the best satisfactory answer 
> wins a free beer in Zurich ;-)
> 

I'd investigate extending ServletException for your application exception
classes.

Another off-the-wall idea would be to extend RuntimeException instead --
you can throw such an exception without it being listed in the
"throws" clause.  This is how things like IllegalArgumentException and
NullPointerException work.

> 
> Klaus Bucka-Lassen
> 
> 

Craig





Re: "Java Server Faces"

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, Ian Kallen <[EMAIL PROTECTED]> wrote:

> 
> At JavaOne today, it seemed to be suggested that j2ee would have a MVC
> framework join the recommendations.  Later in the talk ("scalibility
> in the web tier with jsp blah blah" ridiculously long title), it
> struts was alluded to as being part of j2ee in the future.  So is
> struts the ever mysterious "Java Server Faces"?
> 

No, it's not ... but they will work together.

JavaServer Faces is focused on creating a GUI component model for web
apps, so that you can create development tools that give page developers
an experience similar to WebForms -- drag some GUI components onto your
page and attach event handlers to them.  Due to the nature of HTML and
HTTP, some of these events will happen on the client side, and some will
require a roundtrip to the server to do something and redisplay the same
page.  JSF is going to be developed under the Java Community Process as
JSR-127, and I've been invited to join the expert group.

>From the perspective of Struts, JavaServer Faces will provide an alternate
approach to building the pages in the view layer -- and you can still use
the the rest of the framework to manage the overall application.

As for "an MVC framework as part of J2EE's future", a *lot* of people at
JavaOne seemed to think that this would be a good idea, and that Struts
would make a good framework ... you never know what the future might hold
...

> cheers,
> -Ian
> 
> --
> Ian Kallen <[EMAIL PROTECTED]> | AIM: iankallen
> 
> 

Craig





Re: Problem With Struts and Tomcat

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, Thomas L Richards wrote:

> Ok, I've got a bit of a headache and here's the cause:
> 
> I'm using Visual Age for Java 3.5.2, with Tomcat 3.1. That works fine.
> I installed Struts 1.0-b3 with Xerces 1.4.0.
> Then I installed the struts-example.war file. That installed fine too
> (Tomcat took care of it).
> However, where my headache seems to be occurring is when I try to access a
> struts driven application.
> I have tried several of the "sample" apps, but every time I get this error:
> 
> Root cause:
> 
> java.lang.IllegalArgumentException: cant remove Attributes from request
> scope

Tomcat 3.1 was broken here -- as a couple of other containers are
apparently still broken.  Tomcat 3.1 also has a bunch of other bugs that
will make life unpleasant for people building Struts apps -- I'd really
encourage upgrading to 3.2.2 if you can.

Craig




Re: default select on radio

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, Kiet Nguyen wrote:

> how do I set default values for radio and checkboxes.
> 

I normally use boolean properties in my form beans for these.  You can set
them to appropriate defaults when the bean is first created (i.e. in the
constructor) just like you can set all the String properties to defaults.

> thanks
> 

Craig





Re: JSP expressions inside custom tags

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, Erich Meier wrote:

> Hi!
> 
> I am evaluating struts for a new project. One problem I wasn't able to solve
> was the integration of JSP expressions inside the attributes of
> custom tags.
> 
> My code looks like this:
> 
> 
>  <% String name = ((PElement)pelement).getName(); %>
>  
>^^^ Here is my problem!
> 
>  
> 
> 
> The links always contain the <%= name %> string instead of the evaluated
> expression. I tried it with different quoting techniques but without luck.
> 
> What is the correct solution here?
> 
> TIA,
> Erich
> 

You are up against the fact that runtime expressions and string constants
cannot be mixed in an attribute of a custom tag -- it's got to be one or
the other.  One way to deal with it is this:

  ">

which uses a Java string expression to calculate the entire value.

Craig





RE: Javascript Validation

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, Dudley Butt@i-Commerce wrote:

> i just find it sometimes easier to move all validation off the jsp, and
> hence all java off the jsp. I think its just basically a personal
> preference. This way I'm making full use of the struts error handling model
> and keep all my java in one place. There always seems to be more than one
> way to do things, just depends on what u need to do and whats your
> preference
> Thanx for all the help guys
> 

In future versions of Struts we will be integrating the ability to create
client side validations.  In my mind, the purpose of these validations is
to improve the quality of the user interface -- in this case, by catching
errors that can be caught inside the page (such as required fields and
invalid number formats) without wasting the time needed to submit the form
and get the errors back.

However, it is important to understand that you should *ALWAYS*
perform these validations again on the server side.  Consider the
following cases:

* The client turns off JavaScript

* The client does not support JavaScript

* The user is actually typing a URL (with request parameters)
  directly into the location line of the browser.

Basically, never trust the client to do any validations.

Craig McClanahan




Re: Struts Beta 03 Build Problem

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, Oleg V Alexeev wrote:

> Hello David,
> 
> Friday, June 08, 2001, 9:06:12 AM, you wrote:
> 
> DM> Any idea why I am consistently getting an 
>"org.apache.tools.ant.taskdefs.optional.TraXLiason" ClassNotFoundException when 
>trying an "ant dist" build of jakarta-struts-1.0-b3-src using Ant 1.3 on
> DM> both NT and Linux?  I have what seem to be the only required jars in my path: 
>xalan.jar and jaxp.jar from jaxp-1_1.zip, and jdbc2_0-stdext.jar, with jdk1.3.1?
> 
> Place crimson.jar, jaxp.jar, xalan.jar files from jaxp-1_1.zip to the
> jdk extension dir - x:\jdk1.3.1\jre\lib\ext for example.
> 
> -- 
> Best regards,
>  Olegmailto:[EMAIL PROTECTED]
> 
> 
> 

Forgot one more -- you need to download the "optional.jar" file from the
same place you got Ant, and put it in $ANT_HOME/lib.

Craig





Re: Struts Beta 03 Build Problem

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, David McLure wrote:

> Any idea why I am consistently getting an
> "org.apache.tools.ant.taskdefs.optional.TraXLiason"
> ClassNotFoundException when trying an "ant dist" build of
> jakarta-struts-1.0-b3-src using Ant 1.3 on both NT and Linux?  I have
> what seem to be the only required jars in my path: xalan.jar and
> jaxp.jar from jaxp-1_1.zip, and jdbc2_0-stdext.jar, with jdk1.3.1?
> 

You need crimson.jar from JAXP 1.1 as well.

> Thanks
> 
> David McLure
>  

Craig




RE: Can anyone help with solving the "BACK" button problem, in th e browser?

2001-06-09 Thread Craig R. McClanahan



On Fri, 8 Jun 2001, Dudley Butt@i-Commerce wrote:

> yes, but this is a form that is being filled in like a wizard type of thing,
> i need the form to be session
> any ideas, for an alternative?
> 

The alternative approach is to have *all* of the input fields for the
entire wizard included on every page -- but the ones you are not
displaying on the current page would be created with  instead
of  or whatever.

Craig




Re: Can you do this with internationalisation.

2001-06-09 Thread Craig R. McClanahan



On Thu, 7 Jun 2001, Alex Colic wrote:

> Hi,
> 
> my boss wants me to set up one of my apps written using struts for a demo.
> He wants to have a web page with a couple of flags. The use clicks on of the
> flags and enters the program using the language they selected.
> 
> Not having gone down this road before any idea what that would entail. I
> know I would have to create multiple localisation files for the languages.
> But how do I specify for each user what file to use and can you have
> multiple users all accessing your program concurrently viewing it in
> different languages.
> 
> Some insight into the above is appreciated.
> 
> Alex
> 
> 

The technical information on how to do this (modify the Locale in the
user's session) is correct -- I just wanted to make a social comment on
your boss's request.

When I built an app in Europe a couple of years ago (which is where a lot
of the basic ideas for Struts came from :-), I was told that the use of
flags to select languages was pretty offensive to people living in
countries that were officially multilingual -- such as Belgium, where
large portions of the population speak Dutch and French.  Using flags for
The Netherlands and France would not really have been appropriate.

I ended up using a little SELECT element listing all of the languages that
were supported by the app, with a little JavaScript "onchange" handler
that submitted it whenever a change was made.  This also took lots less
space on the screen.

Craig McClanahan




Re: Can anyone help with solving the "BACK" button problem, in thebr owser?

2001-06-09 Thread Craig R. McClanahan



On Thu, 7 Jun 2001, Dudley Butt@i-Commerce wrote:

> Please help,
> 
> When the user pushes the back button, I want the page to redirect or refresh
> to a different page, please, any ideas?
> 
> Thanx guys and gals
> Dudley
> 

The server doesn't really get involved in the back button -- any solution
to this would require some sort of JavaScript.

Craig






Re: Problem with struts example

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001 [EMAIL PROTECTED] wrote:

> Has anyone run into this problem? When I try to run the struts-example page
> I get the following error:
> 
> org.apache.jasper.JasperException: Unable to compile class for
> JSP/home/carol/web/enhydra3.1/work/Struts/_0002findex_0002ejspindex_jsp_0.java:72:
> 
> Incompatible type for method. Can't convert java.lang.String to boolean.
> _jspx_th_html_html_11.setLocale("true");
> 
> 
> The java code generated which causes this error looks like:
> 
> org.apache.struts.taglib.html.HtmlTag _jspx_th_html_html_11
> = new org.apache.struts.taglib.html.HtmlTag();
> _jspx_th_html_html_11.setPageContext(pageContext);
> _jspx_th_html_html_11.setParent(null);
> _jspx_th_html_html_11.setLocale("true");
> 
> I've only got one version of struts.jar, the one that was packed in
> struts-example.war. I'm running struts using Enhydra 3.1 on RedHat 7.1.
> 
> Renee Petris
> [EMAIL PROTECTED]
> 
> 

It looks like Enhydra 3.1 might be using a very old version of Jasper
(perhaps from Tomcat 3.1) that did not correctly deal with custom tag
properties that are booleans.  As you might expect, the last generated
line above should really be:

  _jspx_th_html_html_11.setLocale(true);

instead.

Craig





Re: ClassNotFound Exception in struts-example (b3)???

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001, Ritter, Steve wrote:

> Hello, I've got struts-b3 installed here and we were stepping through
> the struts-example.  A problem arises when I click on the "submit"
> button in logon.jsp -- I get a ClassNotFound exception:
> 
> [06/06/2001 16:12:39:511|17000] (ERROR) request_handler: Servlet Error: 
>ClassNotFoundException: logon
> 
> I used the correct username password ("user", "pass") so I would have
> expected to get forwarded to mainMenu.jsp via the "success" foward
> mapping.  Any ideas what might be wrong?
> 
> --Steve
> 

Hmm, have you modified the example application at all?  There are not any
references to a class named "logon" in the code.  What servlet container
are you trying this on?

Craig





Re: Can I have NO action?!

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001 [EMAIL PROTECTED] wrote:

> 
> 
> Hi.  I have a form where I display the current filename, and allow them to
> change it.  As such, I don't need to do anything in the action, just let Struts
> populate the form bean.
> 

Without an Action, how would Struts know where to go next?  You would
still need an action for this -- even if it's just a one-liner to return
an appropriate ActionForward.

> How do I go about this?  Do I need an action that does nothing in its perform
> method?  Or can I set things up so no action is needed at all?
> 
> Cheers,
> 
> Dave
> 
> 
> 
> 
Craig





Re: ActionForm/Action with edit mode

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001, John Hogan wrote:

> All,
> 
> I have a situation where it is desirable to use a form/page for both 
> adding new info and editing existing data.  The new info scenario is 
> straight forward struts ActionForm/Action classes.  What I'm 
> wrestling with a bit is the edit scenario.  I'm wondering if I can 
> stay within the struts framework and still do something like entering 
> a page in edit mode and have it displaying existing user data?
> 
> It seems this should be possible because that's exactly what the page 
> does for error handling.  Has anyone else tackled this one yet?  TIA.
> 
> JohnH
> 
> _
> 
> Get your free E-mail at http://www.ireland.com
> 

The Struts example application includes logic that does exactly what you
describe -- the same page (subscription.jsp) is used to add new
subscriptions, edit old ones, and confirm deletion of old ones.  For the
edit case, the trick was to forward to an Action that created a form bean
prepopulated with the values from the database object, and then forward to
the page.

Craig





Re: What happened to the 'etc','src' and 'web' directories in Struts binary download?

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001, Shamdasani Nimmi-ANS004 wrote:

> Hi,
> 
> I just downloaded Struts 1.0-b3 and found out that 'etc', 'src' and
> 'web' directories are no longer there. What happened to these? It was
> convenient to get the source code also in one shot of download.
> 
> -Nimmi 
> 
> 

They were removed from the binary distribution to reduce the size of the
download.  The sources are always available as a source distribution in
the "src" directory under where you got the binaries -- or, of course,
they are available online via CVS.

Craig





Re: Where can I get the latest version of Jasper?

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001, Ritter, Steve wrote:

> Does anyone know how I get the latest version of Jasper?  Do I have to
> download Tomcat and if so which version?
> 
> Thanks in advance!!!
> 
> --Steve
> 

Jasper is not packaged separately from Tomcat -- you'll need to get Tomcat
if you want it.

Craig





Re: Need your help --> Digester class

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001, Hartmut Bernecker wrote:

> Hi,
> 
> I want use the Digester class to populate some objects with XML-Data.
> The Properties of the objects have not identical names to the
> XML-Attributes.
> Therefore I need a mapping.
> Am I right, when I search for a solution with that statement:
> 
> **
> digester.addSetProperty("test", "email", "mail");
> **
> 
> Where "test" is the XML-element, "email" is the Property of my object on
> top of the stack, and "mail" is the XML-attribute within the "test"-Tag
> to be evaluated?
> 
> The XML-Source snippet is:
> 
> 
> 
> 
> 
> Here is the debug-protocol when parsing the XML with the digester:
> 
> ***
> Set de.dhw.asim.components.benutzer.UserDaten property null to
> [EMAIL PROTECTED]
> 
> ***
> 
> Why is the property null?
> What make I wrong??
> 

The "set property" rule is still going to expect the property names  to
match.  One thing you might consider is using a BeanInfo class associated
with your bean so that the standard JDK introspection code will work.

Another approach would be to consider modifying your XML structure to look
like this if you can:


  [EMAIL PROTECTED]


Then, you can use the "call method" rule to process it:

digester.addCallMethod("test/mail", "setEmail", 0);

If you can't do this, you will need to write a custom Rule.

> _
> Hartmut Bernecker
> Druckhaus Waiblingen
> Siemenstrasse 10
> D-71332 Waiblingen, Germany
> http://www.dhw.de/
> 

Craig





RE: Form based authentication

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001, Jon.Ridgway wrote:

> Hi,
> 
> When using form based auth the web container will under take the auth using
> the j_password & j_username supplied. So it all depends on which container
> you are using. Tomcat for example allows you to map to a database containing
> user and role info in the web.xml. You also have to specify a login and
> error page in the web.xml. 
> 
> Jon.
> 

The key issues to remember when using form-based login:

* Your login page must conform to the requirements of the servlet spec
  (i.e. must post to "j_security_check" and have fields "j_username"
  and "j_password").

* You must protect your pages with an appropriate 
  that includes an  inside.

* Don't refer to the login page itself in your application -- the
  container will simply use it automatically if the user requests
  a protected resource.

* Remember that security constraints work on the URL to which the browser
  submits (i.e. normally a "*.do").  They are not checked on a
  RequestDispatcher.forward() call.

Craig


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] 
> Sent: 06 June 2001 08:17
> To: [EMAIL PROTECTED]
> Subject: Form based authentication
> 
> 
> Hi,
> 
> Has anyone used Form based authentication? How does action
> ="j_security_check" work?
> 
> Thanks,
> Nagalli
> 
> 




Re: Query: ActionMappings

2001-06-09 Thread Craig R. McClanahan



On Tue, 5 Jun 2001, Upadhye, Sujit (GEAE, Foreign National) wrote:

> Hello,
> 
> In local-forwards, can I forward the control to another Action object
> instead of forwarding to a JSP?

Yes.  In effect, you are chaining multiple actions together.  Just set the
"path" in your  element to a path of an action instead of a page.

> 
> Sujit Upadhye
> 

Craig





Re: throwing Exceptions from perform()

2001-06-09 Thread Craig R. McClanahan



On Tue, 5 Jun 2001, Jonathan wrote:

> I am seeing that I can only throw IOException and ServletException
> from my Action classes.  Now I was thinking about adding Exceptions to
> the Action class but that would make it proprietary.  I could add just
> Exception, but I dont want to change anything without good reason.  
> Can you all telll me why I am limited to these two exceptions and what
> you all are doing about this.  The reason is that I have my own
> exceptions for my app, and will need to throw them sometimes within
> the perform method.
>
> Thanx Jonathan
> 

You can subclass ServletException with your own exception classes, but I
would recommend against this approach.  What it will cause is that your
user will see an ugly stack trace.  It would be better to forward control
to some error handling action (or page) that deals with this kind of a
problem more gracefully.

Craig





Re: Need help with "Can't remove attributes from request scope"probl em.

2001-06-09 Thread Craig R. McClanahan



On Tue, 5 Jun 2001, Ritter, Steve wrote:

> Hi everyone,
> 
> We ran into a problem running b2/b3 on Servletmill that others seem to
> have hit with WTE.  It occurs when trying to access the login page
> from struts-example, you get an IllegalArgumentException with message
> "Can't remove attributes from request scope".  It seems this thread
> discusses a potential HACK to "fix" the issue.
> 
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg08663.html
> 
> The top-most posting in this thread indicates bugzilla id 932 which I
> checked into:
> 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=932
> 
> So, according to Craig the bug is really in the servlet container and
> it would seem that my servlet container has the very same prolem.  
> What is suggested work around for this?  Can someone help me with some
> more details in the event that I need to speak with my container
> vendor?
> 

Struts is calling

pageContext.removeAttribute("foo", PageContext.REQUEST_SCOPE);

which is perfectly legal according to the JSP specification.  Containers
that disallow this are broken and need to be fixed.

> --Steve
> 

Craig McClanahan







Re: input in XML config

2001-06-09 Thread Craig R. McClanahan



On Wed, 6 Jun 2001, Jonathan wrote:

> I for one dont even understand the value in the "input value" parameter.
> There could be MANY pages that got you to the page you are on.  The "input"
> value just makes one possible origin available for you to have as a return
> target should things go fowl.  I had been saying on this discussion that
> there should be more or less 4 different destinations:

The "input" parameter defines where the Struts controller servlet will
forward control to if your form bean's validate() method returns errors.

> 1) where you came from (referrer, or if there is no referrer a default
> page...see below)
> 2) where you were originally going when you were interrupted
> 3) a specific page - (can be success or failure page or could be the first
> page in a form)
> 4) a default page
> 

One thing to note is that "where you came from" is not particularly
obvious.  If every request goes through the controller servlet (the usual
case in an MVC-based application), then the "referer" value will be the
name of an action (i.e. an xxx.do if you use the default naming approach),
not the name of a page.

Craig


> 
> - Original Message -
> From: "David Noll" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 06, 2001 1:24 PM
> Subject: RE: input in XML config
> 
> 
> >
> > Forget what I said last night about calling setInput() from the
> > ActionForm. Setting the input in the ActionForm's validate method
> > flagrantly violates Struts' MVC architecture; flow of control should
> > always be defined by the controller servlet and struts-config.xml. But
> > saving request scope variables as part of an ActionForm isn't always
> > an option. I think the best solution to Max's problem is to define the
> > input as the full path to the original action, then make sure that the
> > form coming from that page includes the necessary parameters to
> > recreate the original action page.
> >
> > The following hypothetical situation should make this a bit clearer:
> >
> > - You are running an online bookstore backed by a database. To display
> >   books you have defined an action as "viewbook.do". The action takes
> >   one parameter, an ISBN, so the user ends up seeing the url
> >   http://server/viewbook.do?ISBN=123.
> >
> > - On the book's page, you have a form asking users to rate the
> >   book. Part of the rating form uses a select box generated from a
> >   database of possible ratings (this list, all the possible ratings,
> >   is the kind of request scope variable that one would *not* want to
> >   store as part of a form; the list doesn't pertain to data the user
> >   entered, it merely defines *possible* input values).
> >
> > - When the user submits the ratings form, an ActionForm validates the
> >   input. In struts-config, the input attribute for the "save ratings"
> >   action is defined as "viewbook.do". Now suppose that the ratings
> >   ActionForm generates errors... in order for the "view book" action
> >   to successfully recreate the page that the ratings form was
> >   submitted from, it needs an ISBN parameter. The solution to that
> >   seems fairly simple--just drop in a hidden ISBN field in the ratings
> >   form.
> >
> > What I don't like about this solution is that information essential to
> > successfully defining the flow of control--a parameter that is part of
> > the definition of the input page--has to be in an HTML form. Perhaps a
> > feature for Struts 1.1 could be a special input value that signified
> > "use the form's HTTP referrer header, including all request
> > parameters, as the input for this form". Or, quite possibly, there is
> > an even more elegant solution that someone out there has discovered.
> >
> > Cheers,
> > David
> >
> > -Original Message-
> > From: Ted Husted [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, June 05, 2001 9:11 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: input in XML config
> >
> >
> > Could you create these request scope beans as properties of the
> > ActionForm?
> >
> > David Noll wrote:
> > >
> > > Max,
> > >
> > > I don't know if it's the official way to do it, but in my ActionForm's
> > > validate() method, I call mapping.setInput() with the full path of the
> > > original Action. An important thing to note is that if your Action class
> > > pre-populates an ActionForm for the page, you should check for the
> > > ActionForm's existence before populating it.
> > >
> > > All that said, it does seem a bit cumbersome to go through all that
> merely
> > > to return to a dynamically generated input page if there are form
> errors.
> > > Does anyone on the list know of a cleaner way to achieve this?
> > >
> > > David
> > >
> > > --
> > > David Noll, Public Digital
> > > [EMAIL PROTECTED]
> > >
> > > -Original Message-
> > > From: LORENA MASSIMO [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, June 05, 2001 6:37 AM
> > > To: '[EMAIL PROTECTED]'
> > > Subject: input in XML config
> > >
> > > Hi,
> >

Re: "multiple" selectlists

2001-06-09 Thread Craig R. McClanahan



On Mon, 4 Jun 2001, Dante le Poole wrote:

> Hi all,
> 
> Can Struts deal with selectlists which allow multiple selections?

Sure.  There is an example of this on the "html-select.jsp" page in the
exercise example application.  Basically, you say something like:

  
...
  

> If so, how should I create the accessors methods for the formbean, i.e.
> how does Struts get/set the multiple selections from the formbean?
> 

Use a String array for your property.  All of the selected values will be
returned.

> Thanx!
> 
> Dante
> 
> 

Craig





Re: Resetting an Action Form (urgent)

2001-06-09 Thread Craig R. McClanahan



On Mon, 4 Jun 2001, Mikkel Bruun wrote:

> Hi Guys, 
> 
> Please help me out on this one...
> 
> I ran in to a small problem...
> 
> 1. In the system im developing the user has to go through several pages,
> entering information that needs to be processed...
> 2. When ever the user enters invalid data, he'si returned to the form and is
> presented to error messages...
> 3. The user should be able to press the bacl button, or user other means to
> navigating backwards in the process. When navigating backwards the forms
> should be populated with whatever data he has entered...
> 
> (of course all the above is straight forwrd implemented in struts, but check
> this)
> 
> 4. After the user has completed the entire proces, he is able to do it one
> more time. 
> This time the forms should not "remember" what the user previuosly entered,
> and should therefor be blank...
> 
> To give a more substantial example...it could be an insurance broker who
> would do several calculations on an house insurance for each customer...
> Each calculation should be isolated from each other...
> 
> Is there a simple way to do this???
> 
> At the moment there no coupling between my ActionForms and my Logic Beans
> (ie no association or anything)...
> 
> Could I use the transaction token??? and if so, is there any documentation
> for the transaction token!!
> 
> thanks in advance
> 
> Mikkel
> 
> 
> 

How about just deleting the old form bean instance and creating a new
one?  Alternatively, you could add a method to reinitalize all the values
back to their original defaults.

Craig





RE: org.apache.struts.example.ApplicationMapping

2001-06-09 Thread Craig R. McClanahan



On Mon, 4 Jun 2001, Hampton, Paul wrote:

> 
> 
> > ActionServlet depends on ApplicationMapping.  It's one of the classes
> > defined in struts.jar, check your struts.jar is in your classpath.
> > 
> struts.jar is in my classpath, this exception is thrown at runtime & there
> is no org.apache.struts.example package in my struts.jar, hence my
> assumption that this was an example mapping specified in a config file...
> 

The "ApplicationMapping" class is definitely part of the example
application only.  Make sure you have not tried to include a servlet
initialization parameter named "mapping" with this value.

> Paul
> 

Craig




Re: No context loader error

2001-06-09 Thread Craig R. McClanahan



On Mon, 4 Jun 2001, Jan Fredrik Øveraasen wrote:

> Hi
> When I try to deploy my struts-application to a SilverStream app. server I
> get the following error message:
> 
> No context class loader: java.util.collection
> 

"No context class loader" seems like an odd message (it's not coming from
anywhere in Struts), but I don't think there is any class named
java.util.collection -- do you perhaps mean java.util.Collection instead?

> Thanks in advace
> 
> Jan Fredrik
> 

Craig McClanahan




Exception handling in the ActionServlet

2001-06-09 Thread klaus . bucka-lassen

Hi,

I would like to catch all of our project specific exceptions in one place (as a 
last resort, if nobody else catches them earlier on) and handle them in a 
generic way. The obvious way to do this, I think, is by overriding 
processActionPerform in our own ActionServlet and catch 
Exception's (superclass for all our own exceptions) there. But the 
Action.perform method only throws IOException & ServletException, so either all 
our own exceptions will have to inherit from either of those two classes (can't 
be the right thing to do), or I will have to change the Action.perform 
definition to also throw our Exception's (doesn't seem right either, 
I'd prefer not to have to alter any struts code)?

What should I do?

This actually brings me to another problem that doesn't have anything to do 
with struts, but is more a general Java question. Anyway, maybe somebody here 
has an elegant solution to it:

Assume the problem above is solved and furthermore that some of the project 
specific exceptions have to inherit from other existing exception classes (e.g. 
ServletException, IOException, etc.). Since we don't have multiple inheritance, 
I can't have a Exception that is a superclass to all my own 
exceptions. I still want to catch all our own exceptions (but no others) in one 
place. My first though was of course to define a Exception interface 
and let all our own exceptions implement this interface, thus being able only 
to catch Exception's. But Throwable is not an interface (why not? 
What's the idea behind this design?) that Exception could inherit from 
and thus this approach doesn't work, as the try{}catch(){} statement expects a 
Throwable object as parameter (try{}catch(Exception e){} doesn't 
compile).

Well, as a kind of a hack I then thought I'll catch all exceptions, check if it 
is a project specific one (Exception.class.isInstance(anException)), 
and if not throw it again, but that can't be right, because the method where 
this happens then will have to be declared to throw Exception (to generic).

I'll appreciate any help, thanks in advance and the best satisfactory answer 
wins a free beer in Zurich ;-)


Klaus Bucka-Lassen




Re[4]: Can you do this with internationalisation.

2001-06-09 Thread Oleg V Alexeev

Hello Valery,

Saturday, June 09, 2001, 1:56:53 PM, you wrote:

VK>   Thank you for your response.
VK> I try do your solution with
VK> only litle change  (I'm beginer in struts .May be I understand you)
VK> type="some.package.LanguageAction"
VK> 
VK>name="languageForm">
VK> 
VK> It's work.

VK> But how I can know in LanguageAction url of page where I click choose
VK> language.
VK> I need this ,becouse  I want forward to page when I click choose language.


VK> When I click choose language in Category.jsp I want forward to
VK> CategoryEditAction becouse CategoryEditAction
VK> populate Category.jsp localized values from db

Place, for example, forward name to the request scope and display it
hidden value in jsp page. Every action can do it with standart way -
scan ActionMappings find itself and place action path to the request
under some name. By this name you can identify source action.

P.S. This is not standart way - I only suggest you my idea to
implement it.

-- 
Best regards,
 Olegmailto:[EMAIL PROTECTED]





Re: Problem With Struts and Tomcat

2001-06-09 Thread Dan Miser

You don't *need* VAJ 3.5.3 to run 3.2.1. Of course, you need to do things
yourself as opposed to using the IBM Tomcat integration offering. If you
have specific problems with your config, post them here and I should be able
to help out. Also, there's an article on VADD that outlines most of the
things you need to do for Struts integration with VAJ.
--
Dan Miser
http://www.distribucon.com

- Original Message -
From: "Thomas L Richards" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 08, 2001 4:47 PM
Subject: Re: Problem With Struts and Tomcat


> I'm downloading Tomcat 3.2.1 now (can't get 3.2.2 for VAJ yet).
> Unfortunately, as it turns out, I need to upgrade VAJ to 3.5.3 since
Tomcat
> 3.2.X won't work with VAJ 3.5.2. Go figure.





uploading file requires immediate serialization location?

2001-06-09 Thread Jonathan Asbell



Hello all.
I am just trying to understand an aspect of a 
multipart request.  When you submit after using an input of type "file", do 
you have to provide an immediate location for the file to be serialized to, or 
can you store it in a java object (in a bean's field) as a binary object until 
you are ready to serialize it.  The reason is that I want to hold a jpeg in 
a bean until the person completes the last page of the form, and THEN serialize 
it.
 


Re: Re[2]: Can you do this with internationalisation.

2001-06-09 Thread Valery Kocubinsky

  Thank you for your response.
I try do your solution with
only litle change  (I'm beginer in struts .May be I understand you)

   name="languageForm">

It's work.

But how I can know in LanguageAction url of page where I click choose
language.
I need this ,becouse  I want forward to page when I click choose language.


When I click choose language in Category.jsp I want forward to
CategoryEditAction becouse CategoryEditAction
populate Category.jsp localized values from db







- Original Message -
From: "Oleg V Alexeev" <[EMAIL PROTECTED]>
To: "Valery Kocubinsky" <[EMAIL PROTECTED]>
Sent: Saturday, June 09, 2001 11:22 AM
Subject: Re[2]: Can you do this with internationalisation.


> Hello Valery,
>
> Saturday, June 09, 2001, 11:42:43 AM, you wrote:
>
> VK>  Hello
>
> VK> My boss wants to have each  web page with link of language choose.
>
> VK> Now each page have 2 link : french and english.I define link as
> VK> 
> VK> and
> VK> 
>
> 1. create action to perform language switch - LanguageAction
> 2. create global forward mapping in struts-config for this action -
>
>
>
>
>and action mappings itself
>
> type="some.package.LanguageForm"
>name="languageForm">
> 
>
> 3. create form to catch locale strings from request LanguageForm
>and register it in struts-config -
>
>  type="some.pachage.LanguageForm"/>
>
> 4. place to the jsp such links as -
>
>  
>  
>
> VK> But I have problem with populate form .
> VK> For example :
> VK>For modify category page I create Action EditCategoryAction.
> VK> This action populate localizable list "parent_category"  from
Oracle.And forward to category.jsp .
> VK> All ok.
> VK> When I click on french or english link message replace new localized
messages .But list still old,becouse
> VK> editCategoryAction not call again.
>
> VK>   Problem:
> VK> I want populate localized list  from action .But when I click on
change language link
> VK> Action not called again.
> VK> (Of course I can populate localizable list in jsp page .But in this
case many logic exist on jsp page)
>
> VK>   If anyone have this problem or know other solution help me.
>
> --
> Best regards,
>  Olegmailto:[EMAIL PROTECTED]
>


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Re[2]: Can you do this with internationalisation.

2001-06-09 Thread Oleg V Alexeev

Hello Valery,

Saturday, June 09, 2001, 11:42:43 AM, you wrote:

VK>  Hello 

VK> My boss wants to have each  web page with link of language choose.

VK> Now each page have 2 link : french and english.I define link as 
VK> 
VK> and
VK> 

1. create action to perform language switch - LanguageAction
2. create global forward mapping in struts-config for this action -

   
   

   and action mappings itself
   



3. create form to catch locale strings from request LanguageForm
   and register it in struts-config -



4. place to the jsp such links as -

 
 

VK> But I have problem with populate form .
VK> For example :
VK>For modify category page I create Action EditCategoryAction.
VK> This action populate localizable list "parent_category"  from Oracle.And forward 
to category.jsp .
VK> All ok.
VK> When I click on french or english link message replace new localized messages .But 
list still old,becouse 
VK> editCategoryAction not call again.

VK>   Problem:
VK> I want populate localized list  from action .But when I click on change language 
link 
VK> Action not called again.
VK> (Of course I can populate localizable list in jsp page .But in this case many 
logic exist on jsp page)

VK>   If anyone have this problem or know other solution help me.

-- 
Best regards,
 Olegmailto:[EMAIL PROTECTED]





RE: Can you do this with internationalisation.

2001-06-09 Thread Valery Kocubinsky



     Hello 
 
My boss wants to have each  web page with link 
of language choose.
 
Now each page have 2 link : french and english.I 
define link as 

and


 
But I have problem with populate form .
For example :
   For modify category page I create Action 
EditCategoryAction.
This action populate localizable list "parent_category"  
from Oracle.And forward to category.jsp .
All ok.
When I click on french or english link message replace new localized 
messages .But list still old,becouse 
editCategoryAction not call again.
 
  Problem:
I want populate localized list  from action .But when I click on 
change language link 
Action not called again.
(Of course I can populate localizable list in jsp page .But in this 
case many logic exist on jsp page)
 
  If anyone have this problem or know other solution help me.