DataSource

2000-12-20 Thread Sayles, Scott SAXONHQ


Pardon me if I'm missing something, but is it intended that the
javax.sql.DataSource be required in the ActionServlet?  It's just that I
downloaded a recent build and I'm now getting errors when trying to compile
my actions.  They relate to javax.sql.DataSource not being found on the
import.  Is it required to have the JDBC 2.0 Standard Extensions API now?

Thanks.



RE: Page Forwarding Question

2000-12-20 Thread Sayles, Scott SAXONHQ

Have the login page write a hidden field with the value of the requested url
and submit it to your logon action.  From your logon action you can then
instantiate a new ActionForward and set the path to the requested url, as
defined in the hidden form field, and return that.  Alternatively, instead
of instantiating a new ActionForward you could just use the request
dispatcher and forward with it and then return a null to the ActionServlet.

I'm using a similar method now but exapanded it so that all request
parameters are written as hidden fields in the login form as well.  That
way, the previous form results can be submitted along with the login request
(and then on to the subsequent page or action).

Hope this helps.

> -Original Message-
> From: James Howe [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 20, 2000 10:06 AM
> To: [EMAIL PROTECTED]
> Subject: Page Forwarding Question
> 
> 
> In my action classes I have code which checks to see if a 
> user has logged 
> on.  If not, the code forwards to the logon page (e.g. 
> servlet.findForward("logon")).  However this doesn't fully 
> accomplish what 
> I would like.  If a user attempts to reference a page which 
> requires a 
> login, I would like to forward to the login page and, once 
> the user has 
> authenticated, proceed back to the page to which the user was 
> going in the 
> first place.  In other words, I would like to forward to the 
> logon screen, 
> but give it a parameter which it uses to tell it which page 
> follows the 
> logon.Can anyone suggest a simple way to accomplish this?
> 
> Thanks.
> 



RE: logic:iterate and table row renderering

2000-12-19 Thread Sayles, Scott SAXONHQ

> 
> I'm using the logic:iterate tag to render a table. Now
> I need to show alternating colours for odd and even
> table rows. How do I achieve this effect together with
> the logic:iterate tag?
> 

What you could do is create a color alternating bean.  I've made one for
similar uses.  Here's how mine is layed out:

--ColorAlternator--
public String getNext()
public String getCurrent()
public void   setColor1(String color1)
public void   setColor2(String color2)
public void   setColor3(String color3)
public intgetNumberOfColors()
public void   setNumberOfColors(int numOfColors) // should be either 2 or 3
---

You just implement it so that each call to next sets the current color to
the next one and returns it.  Actually, this is really just a String
alternator but the intent is for color names.
I suppose that I could have used some kind of circular list and then enabled
it to handle any number of colors, but my assumption was that you probably
never have a use for more than 3 colors.  It makes the implementation pretty
simple.

Then you can use this bean whenever you want.  For example:

- JSP page -


   
   

  

  
   content
 

  




Hope this helps.

Scott



RE: application architecture

2000-11-29 Thread Sayles, Scott SAXONHQ

Craig,

I really appreciate the response. :)

> On the other hand, having everything in one context has an 
> impact on installing
> new versions of any "sub-application".  You basically have to 
> take down and
> restart the entire web app, instead of just one portion of 
> it.  This might or
> might not be acceptable, depending on your operational environment.

When you say "restart the entire web app" I guess you're talking about
restarting the servlet container(e.g. Tomcat), correct?
If I were to install a new version of an existing application(i.e. context),
wouldn't I have to restart Tomcat anyway?  We're using Tomcat 3.1 if it
makes any difference.


> The security issue can be dealt with fairly easily.  It is 
> the shared state
> issue that makes this one interesting -- especially when some 
> of that shared
> state might be required just to maintain the look and feel of 
> the "seamless"
> user interface.

Well, for the look and feel issue we plan to use a single template for all
pages implemented with Struts template tags.  This main template would also
have stuff like a menu toolbar and links for style sheets.  Under the
multiple contexts scenario I've thought about sharing a single template by
creating symbolic links (on our UNIX system) from the template file into
each context.  That way, our designer can simply modify the one file and
change the template for all applications.  However, I suppose this wouldn't
work on Windows?

There really isn't much that will be shared between our "applications" under
a multiple context scenario.  At this point, the only thing that needs to be
common is the user's login and associated information.  All the applications
will be able authenticate users on a middle tier system.  Based on the user
information, the menu presented on the main template will be dynamically
generated.  I'm contemplating setting a cookie to be used by each context in
verifying the user's login (i.e. to help maintain login information between
the contexts).

Another issue I can see is how to implement a loggoff mechanism under
multiple contexts.  I would like to make the initial point of login
verification to be a check against a session scope attribute.  The logoff
would have to invalidate or remove the session attributes from all
application contexts.  We would also have to know the session id for the
other contexts in that case.  I guess we could maintain some kind of user
context registry for the overall system in the middle tier? a cookie?  Then
when the user logsoff we could obtain the user context session ids and
request logoffs to each corresponding context.  h far fetched?

Perhaps the single context will be easier to implement.  My main concern is
that there are other individuals working on specific "applications" and we
are not following a standard architecture for web application development.
I can see it ending up a big cluge.  I'm pushing for the use of Struts to
help rectify this.


Thanks

Scott


> -Original Message-
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 28, 2000 7:54 PM
> To: [EMAIL PROTECTED]
> Subject: Re: application architecture
> 
> 
> "Sayles, Scott SAXONHQ" wrote:
> 
> > Hello,
> >
> > This is probably close to being off topic but...
> >
> 
> I'm personally comfortable with talking about architecture 
> topics here, even if
> they extend beyond the specifics of using Struts.  This topic 
> is going to be
> important to people that use Struts (as well as those that 
> are not), so it seems
> germane if everyone is willing to put up with a few extra 
> mail messages.
> 
> And it is sure a lot more fun for me than telling newbies on 
> TOMCAT-USER how to
> set the default session timeout in web.xml :-).
> 
> >
> > We're currently looking at building an internal application 
> system that will
> > be composed of functionally different components.  By this 
> I mean, for
> > example, we'll basically have different "applications" that will be
> > presented seamlessly to the user.
> 
> I'm assuming when you use the term "application" here you are 
> thinking about
> whether or not the entire suite should be packaged as one 
> "web application"
> (i.e. running inside one ServletContext) or not, right?
> 
> >  What I'm trying to figure out is what the
> > pros and cons are of lumping these applications into one 
> context, or having
> > individual contexts for each.  Normally, I would choose the 
> latter, but
> > there is a lot of common stuff that's going to be used between the
> > applications.  For instance, a

RE: starting the struts example with Tomcat

2000-11-28 Thread Sayles, Scott SAXONHQ

> >
> > My guess is that you don't have the jaxp jar files in the CLASSPATH.
> >
> 
> tomcat should do this for you on startup--you should only 
> need to set the
> JAVA_HOME environment variable to point to your jdk root

Of course that's assuming you have the appropriate libraries under
WEB-INF/lib or WEB-INF/classes alredy.  Otherwise, you have to specify it in
tomcat.bat, as an option when running tomcat from the command line, or by
having it set in the environment CLASSPATH.

The JAXP libraries aren't included with Tomcat or Struts by default.




RE: starting the struts example with Tomcat

2000-11-28 Thread Sayles, Scott SAXONHQ

Dan,

There was most likely an error that occurred with the startup and the java
process ended.  You could change the tomcat.bat file so that it doesn't run
java in another window.  You can just remove the DOS "start" command in the
appropriate place and then run startup.bat from a command prompt.  I believe
it's in the :startServer section.  You could then catch what error is
(probably) being displayed.  You might also be able to get some clues from
tomcat.log.

My guess is that you don't have the jaxp jar files in the CLASSPATH.


-Original Message-
From: Dan Cancro [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 28, 2000 5:55 PM
To: [EMAIL PROTECTED]
Subject: starting the struts example with Tomcat


I can't get the example to run with Tomcat.  This is what I have done so
far:
1) put struts-example.war in my c:\jakarta-tomcat\webapps directory
2) added this text to my server.xml file:
 
  

When I try to start Tomcat with the start.bat script, it opens and closes a
DOS window.

I have never used Tomcat or Struts before.  Let me know if you can see what
I have missed.  Thanks.



application architecture

2000-11-28 Thread Sayles, Scott SAXONHQ

Hello,

This is probably close to being off topic but...

We're currently looking at building an internal application system that will
be composed of functionally different components.  By this I mean, for
example, we'll basically have different "applications" that will be
presented seamlessly to the user.  What I'm trying to figure out is what the
pros and cons are of lumping these applications into one context, or having
individual contexts for each.  Normally, I would choose the latter, but
there is a lot of common stuff that's going to be used between the
applications.  For instance, all user's will login through a common
interface to establish a single session, which is maintained on a middle
tier, and all movement between applications will have to be seamless.  Also,
the applications will utilize Struts for basic application framework and
templating for common look and feel.

I've gone over various scenarios in my head.  There are certainly other
factors to consider but I think the crux of what I'm trying to weigh is:
1. common context => easier to implement seamless application, but could
potentially grow into a beast of actions and etc. and have harder
maintainability
2. separated contexts => easier application maintenance but more complex
mechanisms are required to make the system seamless.

Anybody have any thoughts about this?  I would appreciate any feedback. :)

Thanks 

Scott



RE: struts.upload, performance and more

2000-11-27 Thread Sayles, Scott SAXONHQ


For what it's worth, I was also experiencing serious performance problems
with the multipart request handling.  I ended up trying out the multipart
handler stuff from "Java Servlet Programming" from Oreilly.  I haven't
delved deep into the code so I apologize for not providing any specific
information, but I am able to upload files without any problems using the
examples from Oreilly.  Perhaps this is worth looking at for comparisons
(Mark)?

http://www.servlets.com/resources/com.oreilly.servlet/index.html


Scott

-Original Message-
From: Stefan Wesner [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 27, 2000 5:30 AM
To: [EMAIL PROTECTED]
Subject: RE: struts.upload, performance and more


I just want to mention that the performance problem exists also using resin
as the servlet engine.

> -Original Message-
> From: Schachter, Michael [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 27, 2000 7:13 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: struts.upload, performance and more
>
>
> Sorry if this is a duplicate:
>
> > So my question is anyone else has observed performance problems ?
>
> I have, but only with tomcat.  The ServletInputStream.readLine() method
> seems to hang on occassion.
>
> >There should be no need for me to bother about
> >MultipartRequestHandler, MultipartIterator and MultipartElement, right
> ?
> >I should just use the FormFile interface and get/setFile methods
> >in my form ?
>
> MultipartRequestHandler is an interface you'd implement to create your
> own way of handling multipart
> requests.  MultipartIterator and MultipartElement are helper classes
> that I used to create my own
> implementation of MultipartRequestHandler, they're pretty useful, except
> for this weird performance problem.
>
> >What's the init param in web.xml called that governs where the
> >temporary files are put ?
>
> Either have the javax.servlet.context.tempdir attribute set, or use the
> init param "tempDir"
>
> >It was very easy to get upload of files to work using the
> struts.upload.
> >Now I only hope the performance problem will be fixed..
>
> I'll definately be looking into this problem more.
>
> - Mike Schachter
>



multipart requests

2000-11-16 Thread Sayles, Scott SAXONHQ

Michael,
Ya, I've checked it out.  It's nice that it's built in.  Although, I was
having problems with uploading relatively larger files (like 300k!).  For
some reason, the getNextElement() method for MultipartIterator was taking
way too long.  I tried setting the buffer sizes to various sizes with no
significant changes.  I probably missed something about how to utilize these
components.  Since I wasn't using implementing an action form for the form,
the DiskMultipartRequestHandler(DMRH) never came into play from the form
processing.  I explicity utilized the handler in the action class and set
the buffer sizes for both the iterator and the handler from 1 - 10Mb.  The
reason I did this was so that I could explicitly specify different
directories to write the file to based on the request (as opposed to the one
defined in the servlet init-param).  I ended up using the MultipartRequest
stuff from Oreilly and it works fine.  I know I could have done it
differently, but any thoughts on what problems there might have been?

Thanks

Scott
-Original Message-
From: Schachter, Michael [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 16, 2000 2:58 PM
To: 'Sayles, Scott SAXONHQ '
Subject: RE: multipart requests / request attributes and forwarding


 Scott,

Although this isn't an answer to your question, have you checked out the
multipart request handling that's built into struts now?  All you have to do
is create set and get methods of type "FormFile" in your ActionForm class
and the proper form:file tags in your jsp for file uploading.

-Original Message-
From: Sayles, Scott SAXONHQ
To: '[EMAIL PROTECTED]'
Sent: 11/16/00 2:33 PM
Subject: multipart requests / request attributes and forwarding

Hello,

I'm facing a small dilema.  I've created a struts action class that
handles
requests for uploading files.  I'm creating some action errors using the
standard struts method in which the action errors are added to an action
errors object and is forwarded to a page that is using the

tag.  When the request is forwarded to the page, the tag (I assume) is
not
able to handle the request attribute to get the errors.  It seems like
the
request attributes are not excluded from the multipart request format.
I'm
getting a "page cannot be displayed" meesage from the browser.  When I
take
out the tag, the page comes up fine.  I could probably just make a
single
specific error page or put the errors into the session scope, but
perhaps
there's a more elegant solution to handle this?  Perhaps, I'm missing
something?  Any thoughts?

Thanks

Scott



multipart requests / request attributes and forwarding

2000-11-16 Thread Sayles, Scott SAXONHQ

Hello,

I'm facing a small dilema.  I've created a struts action class that handles
requests for uploading files.  I'm creating some action errors using the
standard struts method in which the action errors are added to an action
errors object and is forwarded to a page that is using the 
tag.  When the request is forwarded to the page, the tag (I assume) is not
able to handle the request attribute to get the errors.  It seems like the
request attributes are not excluded from the multipart request format.  I'm
getting a "page cannot be displayed" meesage from the browser.  When I take
out the tag, the page comes up fine.  I could probably just make a single
specific error page or put the errors into the session scope, but perhaps
there's a more elegant solution to handle this?  Perhaps, I'm missing
something?  Any thoughts?

Thanks

Scott



RE: struts-example question - DatabaseServlet / Digester

2000-11-02 Thread Sayles, Scott SAXONHQ

Uh... nevermind.  I think I just found the answer.  

The Subscription object is passed a reference to the "parent" object via
it's setUser method and it calls the parent's addSubscription method to add
itself.

I'll just throw this out there: It would seem to me that it would make more
sense for the Digester to add the child object directly to the parent by
calling the parent's add method.  Of course, this would mean that the
digester would have to know what the parent is in relation to the child
(perhaps it already does? I don't know).  I just think it's better than
forcing the implementation of an additional method in the child to add
itself to the parent.  That way, you could more freely define what child
object to use (especially if you have one that already exists) and just
implement a method in the parent.  

Perhaps it's not too big of a deal?  Any thoughts?

Thanks :)

Scott


-----Original Message-
From: Sayles, Scott SAXONHQ 
Sent: Thursday, November 02, 2000 9:55 AM
To: '[EMAIL PROTECTED]'
Subject: struts-example question - DatabaseServlet / Digester


I'm just looking for a clarification of how digester.addSetTop works in the
example.

>From DatabaseServlet.load() 
...
digester.addObjectCreate("database/user",
 "org.apache.struts.example.User");
digester.addSetProperties("database/user");
digester.addSetNext("database/user", "addUser");
digester.addObjectCreate("database/user/subscription",
 "org.apache.struts.example.Subscription");
digester.addSetProperties("database/user/subscription");
digester.addSetTop("database/user/subscription", "setUser");


>From what I can gather, the addSetTop method adds a SetTopRule which
specifies that the Subscription object will be added to the parent object,
User, via the setUser method.  Am I understanding this correctly?  If I am,
then where is the setUser method?  Shouldn't "setUser" be "addSubscription"?

Thanks :)

Scott



struts-example question - DatabaseServlet / Digester

2000-11-02 Thread Sayles, Scott SAXONHQ

I'm just looking for a clarification of how digester.addSetTop works in the
example.

>From DatabaseServlet.load() 
...
digester.addObjectCreate("database/user",
 "org.apache.struts.example.User");
digester.addSetProperties("database/user");
digester.addSetNext("database/user", "addUser");
digester.addObjectCreate("database/user/subscription",
 "org.apache.struts.example.Subscription");
digester.addSetProperties("database/user/subscription");
digester.addSetTop("database/user/subscription", "setUser");


>From what I can gather, the addSetTop method adds a SetTopRule which
specifies that the Subscription object will be added to the parent object,
User, via the setUser method.  Am I understanding this correctly?  If I am,
then where is the setUser method?  Shouldn't "setUser" be "addSubscription"?

Thanks :)

Scott



RE: newbie question regarding performance

2000-10-26 Thread Sayles, Scott SAXONHQ

Thanks for the feedback :)

Unfortunately, I'm not familiar with implementing load-balancing techniques
and we're probably not equipped to do anything like that anytime soon.

I understand the higher level of control, convenience, etc. from using a
servlet centric architecture.  However, what I'm still wondering is if you
have a high traffic site (whith a lot of requests to a single controlling
servlet in an application) that is somewhat complex, based on the struts
framework, would there be any greater benifit in utilizing multiple servlets
(e.g. 2 controlling servlets for an application each with their own action
mappings)?  Yes, I know this defeats the purpose of the Struts framework,
but I'm just exploring the idea.  Would this reduce contention from the 1
servlet architecture?  Am I just being stupid?


Thanks 

Scott

-Original Message-
From: McCay, Larry [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 26, 2000 6:09 PM
To: '[EMAIL PROTECTED]'
Subject: RE: newbie question regarding performance


Scott,

Scalability can be handled by the load-balancing techniques that you apply
to your site.  These mechanisms may be web farm configurations or
application server deployment options.

For example Bluestone Software's Total-e-Server (UBS) is typically deployed
across multiple application hosts running multiple vm's.  The Load Balance
Broker (LBB) determines the optimal vm on the most appropriate application
host to dispatch the request to.

These types of approaches resolve high volume scalability before it actually
reaches the web application itself.

Having a single controlling servlet provides a single entry point to the
application which becomes a convienient place to do many things that would
otherwise be distributed accross your whole application - for instance form
validation and repopulation of for elements in the event of input errors,
authenticated a user, personalizing the application look and feel or
collection of clickstream information.

I hope this was helpful.

Larry

-Original Message-
From: Sayles, Scott SAXONHQ [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 26, 2000 5:29 PM
To: '[EMAIL PROTECTED]'
Subject: newbie question regarding performance



I'm relatively new to Struts and MVC based architecture for Web
applications.  What are the implications to using a single controlling
servlet for a high volume site?  i.e. do I have to worry about performace in
regards to using a single ActionServlet for all our requests?


Thanks

Scott



newbie question regarding performance

2000-10-26 Thread Sayles, Scott SAXONHQ


I'm relatively new to Struts and MVC based architecture for Web
applications.  What are the implications to using a single controlling
servlet for a high volume site?  i.e. do I have to worry about performace in
regards to using a single ActionServlet for all our requests?


Thanks

Scott