Re: Design Help

2003-01-14 Thread Chris Trawick
You can write a custom validator to parse the tokens, parse the integers,
and then validate their range.  See
http://jakarta.apache.org/struts/userGuide/dev_validator.html under
Pluggable Validators for details.

chris

- Original Message -
From: Weber, Jeremy [EMAIL PROTECTED]
To: 'Struts Users Mailing List' (E-mail) [EMAIL PROTECTED]
Sent: Tuesday, January 14, 2003 9:18 AM
Subject: Design Help


 Hello all,

 I have a unique requirement and was wondering if anyone had any ideas on
how
 to implement it.  I am using struts to install our server based product.
 Our product has several components which can be installed multiple times.
If
 you choose to install a component you have to provide some configuration
 information for each instance installed.  So if you install 5 times, you
 need to configure some port 5 times.  I would like the configuration
screens
 to accept text in the following format.

 Port: ,,,,.

 I can validate that there are 5 entries, no problem.  How do I then
validate
 each individual entry as being an integer and in the valid port range.  If
 anyone has any suggestions, I would appreciate it.

 Thanks,

 Jeremy Weber
 [EMAIL PROTECTED]

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



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




RE: Design Help

2003-01-14 Thread Jarnot Voytek Contr AU HQ/SC
You mean something other that using StringTokenizer to split the input
string on commas and Integer.parseInt to convert to ints and ,  to check
if the numbers are in a valid range?

http://home.earthlink.net/~dwinterfeldt/overview.html has some examples for
writing a pluggable validator to use with Struts and the Validator - but I
think it's out of date (might be a start, though).

--
Voytek Jarnot
Quidquid latine dictum sit, altum viditur.


-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 14, 2003 8:19 AM
To: 'Struts Users Mailing List' (E-mail)
Subject: Design Help


Hello all,

I have a unique requirement and was wondering if anyone had any ideas on how
to implement it.  I am using struts to install our server based product.
Our product has several components which can be installed multiple times. If
you choose to install a component you have to provide some configuration
information for each instance installed.  So if you install 5 times, you
need to configure some port 5 times.  I would like the configuration screens
to accept text in the following format.

Port: ,,,,.

I can validate that there are 5 entries, no problem.  How do I then validate
each individual entry as being an integer and in the valid port range.  If
anyone has any suggestions, I would appreciate it.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

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

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




RE: Design Help...

2002-04-25 Thread Jesse Alexander (KADA 12)

Hi,

the 100% pure Strust way could to write a index-page that automatically passes
control (redirect-meta-tag) to an action, which could call the model to 
populate the collection, stuff it into the request and forward control to 
a suitable jsp-page. If you supply a link to start the app from the outside
you can omit the index-page-redirect and immediately supply the action-url...

Alternatively, leave the setup-code in the servlet and enter the traditional
Struts-way of doing from the index-page on. 

Struts allows this kind of mix-and-match, which is one of the most important
features (in my opinion).

hope this helps
Alexander

-Original Message-
From: Roshan Paiva [mailto:[EMAIL PROTECTED]]
Sent: Dienstag, 16. April 2002 21:49
To: 'Struts Users Mailing List' (E-mail)
Subject: Design Help...


Hi..

I am designing an application which needs to populate a table in the index
page.

Previously what i had done was, in a servlet first populated a collection by
calling a Manager class, then setting the collection in a request object,
and then forwarding it to the index page which will get the collection
from the request object and then populate the table.

Could you pls help me out and tell me the best way to implement that
using the struts framework.


Thanks and Kind Regards
Roshan


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

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




RE: Design Help...

2002-04-25 Thread Witbeck, Shane

This is a similar approach that I have used alot in ColdFusion. The
methodology is called Fusebox. Basically there is an analogy to the
electrical fusebox in your house.  You can read more at
http://www.fusebox.org. Although this methodology is centered around the CF
community, there has been some effort to port it to other languages such as
JSP. 

Sincerely,

Shane Witbeck
__
Developer, Bank of America
email: [EMAIL PROTECTED]
phone: 904.987.1688

-Original Message-
From: Jesse Alexander (KADA 12) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 25, 2002 6:07 AM
To: Struts Users Mailing List
Subject: RE: Design Help...


Hi,

the 100% pure Strust way could to write a index-page that automatically
passes
control (redirect-meta-tag) to an action, which could call the model to 
populate the collection, stuff it into the request and forward control to 
a suitable jsp-page. If you supply a link to start the app from the
outside
you can omit the index-page-redirect and immediately supply the
action-url...

Alternatively, leave the setup-code in the servlet and enter the traditional
Struts-way of doing from the index-page on. 

Struts allows this kind of mix-and-match, which is one of the most important
features (in my opinion).

hope this helps
Alexander

-Original Message-
From: Roshan Paiva [mailto:[EMAIL PROTECTED]]
Sent: Dienstag, 16. April 2002 21:49
To: 'Struts Users Mailing List' (E-mail)
Subject: Design Help...


Hi..

I am designing an application which needs to populate a table in the index
page.

Previously what i had done was, in a servlet first populated a collection by
calling a Manager class, then setting the collection in a request object,
and then forwarding it to the index page which will get the collection
from the request object and then populate the table.

Could you pls help me out and tell me the best way to implement that
using the struts framework.


Thanks and Kind Regards
Roshan


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

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

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




Re: Design Help...

2002-04-16 Thread Enrique M. Almonte

Hi, check the iterate, nested tags or display tags at
http://edhill.its.uiowa.edu/display/

Enrique Almonte
Datapro Inc.

- Original Message -
From: Roshan Paiva [EMAIL PROTECTED]
To: 'Struts Users Mailing List' (E-mail) [EMAIL PROTECTED]
Sent: Tuesday, April 16, 2002 12:48 PM
Subject: Design Help...


 Hi..

 I am designing an application which needs to populate a table in the index
 page.

 Previously what i had done was, in a servlet first populated a collection
by
 calling a Manager class, then setting the collection in a request object,
 and then forwarding it to the index page which will get the collection
 from the request object and then populate the table.

 Could you pls help me out and tell me the best way to implement that
 using the struts framework.


 Thanks and Kind Regards
 Roshan


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





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




RE: Design Help...

2002-04-16 Thread Roshan Paiva

Thanks..

Where do i populate the collection? should i continue populating it in a
servlet before forwarding it to the jsp .. and then use a iterate tag to
display it? or is there another way i should follow in struts.

Thanks and Kind Regards
Roshan


-Original Message-
From: Enrique M. Almonte [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 4:54 PM
To: Struts Users Mailing List
Subject: Re: Design Help...


Hi, check the iterate, nested tags or display tags at
http://edhill.its.uiowa.edu/display/

Enrique Almonte
Datapro Inc.

- Original Message -
From: Roshan Paiva [EMAIL PROTECTED]
To: 'Struts Users Mailing List' (E-mail)
[EMAIL PROTECTED]
Sent: Tuesday, April 16, 2002 12:48 PM
Subject: Design Help...


 Hi..

 I am designing an application which needs to populate a table in the
index
 page.

 Previously what i had done was, in a servlet first populated a
collection
by
 calling a Manager class, then setting the collection in a request
object,
 and then forwarding it to the index page which will get the collection
 from the request object and then populate the table.

 Could you pls help me out and tell me the best way to implement that
 using the struts framework.


 Thanks and Kind Regards
 Roshan


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





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


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




RE: Design help needed for large scale app

2002-01-29 Thread Galbreath, Mark

Pete,

You may want to read Boris Lublinski's article, The Key to Superior EJB
Design in January's Java Developer's Journal, pp. 20ff.  While not
directly addressing Struts or servlets, he has some very enlightening
incites into data object design.

Mark

-Original Message-
From: Pete Serafin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 11:34 AM

I am in the design phase of an application that will need to handle
100's and more likely 1000's of users simultaneously.  The application
will consist of the typical create, edit, and retrieve functions for
information stored in a database.  My question concerns how to design my
Action classes.  While I usually place the hi level logic for inserts,
updates, and individual object retrieval in the same Action class, I was
thinking about breaking them out into 3 separate Action classes.  The
logic being that an Action class is created on the stack for each user
that accesses that class, and the slimmer the class,  the faster the
application and less memory used.  Would it make sense to architect the
application this way, or is it more just a matter of style?  Does anyone
have any ideas on this issue, or advice based on large scale
applications that you have developed?  Thanks,

Pete Serafin

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




Re: Design help needed for large scale app

2002-01-29 Thread John M. Corro

With an application like this, wouldn't the critical path (in terms of any
performance bottlenecks) be more along the lines of your database
communications?  I've been finding that any bottlenecks I've had regarding
performance were almost always due to hitting the database in an inefficient
manner.  Of course, I haven't had an opportunity to design applications w/
Pete's size of a user base.

To answer the question specifically, I actually prefer to keep all database
mgt, security mgt, and biz logic out of action classes.  I tend to have 1
action class for any general area of functionality (ie UserAction for User
adds, edits, deletes) and then use that Action class as a controller to some
other class that directs the actual functionality.

- Original Message -
From: Pete Serafin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, January 29, 2002 10:33 AM
Subject: Design help needed for large scale app


 I am in the design phase of an application that will need to handle
 100's and more likely 1000's of users simultaneously.  The application
 will consist of the typical create, edit, and retrieve functions for
 information stored in a database.  My question concerns how to design my
 Action classes.  While I usually place the hi level logic for inserts,
 updates, and individual object retrieval in the same Action class, I was
 thinking about breaking them out into 3 separate Action classes.  The
 logic being that an Action class is created on the stack for each user
 that accesses that class, and the slimmer the class,  the faster the
 application and less memory used.  Would it make sense to architect the
 application this way, or is it more just a matter of style?  Does anyone
 have any ideas on this issue, or advice based on large scale
 applications that you have developed?  Thanks,

 Pete Serafin


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




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




Re: Design Help Needed - Routing to common transformer JSP

2002-01-19 Thread Matt Raible

Hmmm, doesn't work like I'd hoped:

java.lang.IllegalArgumentException: Cannot URL decode request path /%=xmlJsp%



--- Matt Raible [EMAIL PROTECTED] wrote:
 I've figured out a pretty slick (I think) way to use XSL have one page that
 changes the look and feel of my entire application.  Basically, I put all my
 XML JSP's in a pages directory - and all they really contain is title,
 heading, and form elements (populated by bean:write and html:form).  All
 layout is controlled by a CSS stylesheet (I'm only supporting
 standards-compliant browsers - and client agrees ;).  
 
 So my rough solution at this point is to route all requests for JSP's to a
 JSP (with the same name in the / directory).  So I have a JSP Transformer for
 each JSP XML page.  I'd like to just have one page that does the
 transformation.
 
 However, there's GOT to be an easier way.  You would think it would be easy
 to
 create a URL-mapping for this - or something like that.  I would like it
 would
 be easy to create a url-pattern of *.jsx that would route to a
 htmlTransform.jsp page.  Is this the best way?  I really like the idea of
 using
 JSP's to get messages and form values - seems pretty easy.  If there is a way
 of using a servlet in place of the htmlTransform.jsp - that might be a good
 idea...
 
 Thanks,
 
 Matt
 
 
 web.xml -
   !-- XSLT Tranformer --
   servlet
   servlet-namexslt/servlet-name
   jsp-file/htmlTransform.jsp/jsp-file
   /servlet
   !-- XSLT Mapping --
   servlet-mapping
   servlet-namexslt/servlet-name
   url-pattern*.jsx/url-patter
   /servlet-mapping
 
 htmlTransform.jsp --
 
 %@ page language=java %
 %@ taglib uri=/WEB-INF/c.tld prefix=c %
 %@ taglib uri=/WEB-INF/x.tld prefix=x %
 
 % 
 String xmlJsp = request.getServletPath(); 
 xmlJsp = /pages + xmlJsp.substring(0,xmlJsp.indexOf(.)) + .jsp;
 System.out.println(xmlJsp =  + xmlJsp);
 
 %
 
 c:import url=%=xmlJsp% var=xml/ 
 c:import url=/styles/xsl-xhtml.jsp var=xslt/
 x:transform source=$xml xslt=$xslt/
 
 __
 Do You Yahoo!?
 Send FREE video emails in Yahoo! Mail!
 http://promo.yahoo.com/videomail/
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




RE: Design Help

2001-12-13 Thread Todd G. Nist

James,

I was reading through the archives when I came across the below post.  If
one follow the design as you have shown below, dose the Delegate get stored
in the form?  If it does then does one reference the DAO via the delegate
with a nested type syntax in the view/JSP?

So if I have a Delegate, which in you example does a viewall, I first
create the delegate, create the DAO and populate it and then store the
Delegate in the form with some standard setter and getter method:

   FORM:

   public void setDelgate(Object d) {
   this.delgate = d;
   }

   public Object getDelgate() {
   return this.delgate;
   }

Then in the view how do I reference the values in the DAO?

Is it just something like:

bean:write name=ViewAllFrm property=delegate.dao.value/

Where dao is the Data access object, and value is a getter in that object.

Is this the correct flow or am I missing something?

Thanks in advance.

Regards,

Todd G. Nist

-Original Message-
From: Hicks, James [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 5:46 PM
To: Struts Users Mailing List
Subject: RE: Design Help


1) The relationship is a starting point.  Basically, I would not pass an
ActionForm to my business delegate (RentalBean).  Doing so ties that
delegate to the web interface.  If you were wanting to create a Swing client
in the future, you would have to create seperate business delegates for it.
Try to abstract your business delegates from your view ( see code below ).

2) Use a constructor that requires no params, but provide 'public void
init(...)' params to initialize the state of your bean.

3) Depends on the scope of the application.  I usually provide several
different applications, all depending on the business cases (admin app, web
user app, swing app, web services for b2b,...).

4) Start off with a base data access class that has general methods.  The
methods should provide a way to create jdbc connections and close
connections, statements, and result sets.  You can also have query builder
methods in this class that don't tie it to any single use case.


If you are wanting the application to scale upto EJB in the future, you are
best to use delegate objects like you are doing (RentalBean).

If you are wanting to use an Action class for every use case ( adding a
rental, editing a rental, viewing a rental, deleting a rental), then you
don't need to the action property .  If you are wanting to use one class,
then use the 'action' property in the request, this is how id did it below.

The data access object (RentalDAO) should be an interface.  You should use a
factory that uses a JNDI value to select the DAO object.  This allows you to
change databases by just modifing a value in the web.xml file and
redeploying your app.  I wont go into this, but check the java petstore app
(1.2.1) for examples.

With the following code, only the BaseAction, RentalForm, and RentalAction
are tied to the web client and struts.  The business delegate
(RentalDelegate) and the data access object(s) (BaseDAO and RentalDAO) can
now be used with other clients (web, wap, swing,...).

Lets rewrite some of the pseudo-code you sent:

-- Code for BaseAction.java --
public abstract class BaseAction extends Action {
   //Don't use class variables in Action objects.  These are not thread
safe.
   //protected String action=null;

   //provide this method just in case any of your subclassing actions want
to do some pre-initialization processing.
   public ActionForward prePerform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException {

   //could do custom authentication or something else.

   //base implementation returns null.
   return null;
   }

   //this is good.  I do this on all of my projects.  Also got the idea from
Ted Husted and a few others on the list.
   public abstract ActionForward performAction(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException;


   //proxy method
   public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException {

   //WE CANT DO THIS BECAUSE Action OBJECTS ARE NOT THREAD SAFE.
   //Find out what we are doing (Create,Edit,Save,Reset, Delete, etc.)
   //action=request.getParameter(action);
   //if (action == null)
   //  action=mapping.getParameter();


   //catch all uncaught exceptions.  Provide global

RE: Design Help

2001-11-29 Thread Hicks, James

1) The relationship is a starting point.  Basically, I would not pass an
ActionForm to my business delegate (RentalBean).  Doing so ties that
delegate to the web interface.  If you were wanting to create a Swing client
in the future, you would have to create seperate business delegates for it.
Try to abstract your business delegates from your view ( see code below ).

2) Use a constructor that requires no params, but provide 'public void
init(...)' params to initialize the state of your bean.

3) Depends on the scope of the application.  I usually provide several
different applications, all depending on the business cases (admin app, web
user app, swing app, web services for b2b,...).

4) Start off with a base data access class that has general methods.  The
methods should provide a way to create jdbc connections and close
connections, statements, and result sets.  You can also have query builder
methods in this class that don't tie it to any single use case.


If you are wanting the application to scale upto EJB in the future, you are
best to use delegate objects like you are doing (RentalBean).

If you are wanting to use an Action class for every use case ( adding a
rental, editing a rental, viewing a rental, deleting a rental), then you
don't need to the action property .  If you are wanting to use one class,
then use the 'action' property in the request, this is how id did it below.

The data access object (RentalDAO) should be an interface.  You should use a
factory that uses a JNDI value to select the DAO object.  This allows you to
change databases by just modifing a value in the web.xml file and
redeploying your app.  I wont go into this, but check the java petstore app
(1.2.1) for examples.

With the following code, only the BaseAction, RentalForm, and RentalAction
are tied to the web client and struts.  The business delegate
(RentalDelegate) and the data access object(s) (BaseDAO and RentalDAO) can
now be used with other clients (web, wap, swing,...).

Lets rewrite some of the pseudo-code you sent:

-- Code for BaseAction.java --
public abstract class BaseAction extends Action {
   //Don't use class variables in Action objects.  These are not thread
safe.
   //protected String action=null; 

   //provide this method just in case any of your subclassing actions want
to do some pre-initialization processing.
   public ActionForward prePerform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException {

   //could do custom authentication or something else.

   //base implementation returns null.
   return null;
   } 
   
   //this is good.  I do this on all of my projects.  Also got the idea from
Ted Husted and a few others on the list.
   public abstract ActionForward performAction(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException;

   
   //proxy method
   public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException {

   //WE CANT DO THIS BECAUSE Action OBJECTS ARE NOT THREAD SAFE.
   //Find out what we are doing (Create,Edit,Save,Reset, Delete, etc.)
   //action=request.getParameter(action);  
   //if (action == null)
   //  action=mapping.getParameter();


   //catch all uncaught exceptions.  Provide global error handling.
   try {
   // do pre-processing
   ActionForward forward =
prePerform(mapping,form,request,response);
   
   //if the pre-processing returned a forward, then forward
   if(forward != null) {
   return forward;
   }

   forward = performAction(mapping,form,request,response);
  
   if(forward != null) {
   return forward;
   } else {
   //return an ActionForward to the main page
   }
} catch(Exception e) {
   //do something with the exception
}
}
}

-- code for RentalAction.java --
public class RentalAction extends BaseAction {
public static final String CREATE = create;
public static final String UPDATE = update;
public static final String VIEW = view;
public static final String VIEWALL = viewall;
public static final String DELETE = delete;

public ActionForward performAction(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,