Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Tamas Szabo

Hi Frank,

Doesn't the sessionCount get decremented regardless of whether the 
session is being destroyed as the result of a regular logoff or 
timeout as well as if it was a rejected logon (i.e., max sessions 
already in use)?  I dealt with this problem in the code I'm adding to 
Java Web Parts tomorrow, but maybe you found a better way than I did :)  


Yes, the sessionCount is decremented everytime a session is destroyed 
regardless of regular logoff, 'forced' logoff (max sessions in use) :-)) 
or timeout.

But that's what I wanted. Do you see a problem with it?
sessionCount is the number of existing sessions, so I decrement the 
sessionCount everytime a session is destroyed(no matter why it was 
destroyed).


Also, I was a bit surprised to learn that filters fire BEFORE 
listeners... it seemed more logical the other way around, but it's not 
reality.  Any problem with what you've done with that in mind?


A SessionContextListener's sessionCreated method will execute when a new 
HttpSession is created.

HttpSessions are created by some servlet or jsp code.
So if you use a Filter that catches any request, the Filter will fire 
before any code that could create a session has a chance to execute.


If the request is not for the 'special' appInUse.jsp or logout.jsp(by 
the way I think that it's ok if we only treat appInUse.jsp specially, 
logout.jsp can be
treated like all other resources) then I always get a session in the 
usual way:


HttpSession session = request.getSession();

As you know this will create a session if one doesn't exist or it will 
get an existing session.
Because this is a Filter that catches everything, all the sessions will 
be created at this point.


This is also the point where the sessionCreated will be executed if the 
session.isNew().
In the sessionCreated a session is always created, but if maxSessions 
was exceeded then we

flag the session.

Back to the filter code, if the session is flagged then we invalidate it 
and we redirect.


It is always benefic to try to write down in words what your code does.
I think I found a a little problem in my solution :-) :

Ex.:
MAX_SESSIONS = 1
and there is one active session (User A)

User B tries to connect, filter fires, flagged session is created 
sessionCount is 2 now.

We are back in the filter before session.invalidate().

In another thread User A's session is destroyed and the 
sessionDestroyed() is executed which decremenets sessionCount. 
sessionCount = 1


User C comes in, in another thread the filter fires for his request, but 
he will get a flagged session too, 'cause sessionCount is still 1.


However this is a minor issue and it probably can be easily changed by 
not incrementing/decrementing sessionCount in 
sessionCreated()/sessionDestroyed()

if the session is flagged.
This is what you suggested in the first place? :-)

Tamas





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



Problem with Dyna Form

2005-07-28 Thread Kade Jeevan Kumar
Hi All,
 
My requirement is to generate a set of dynamic rows(with checkbox and combo 
box) at client side using JSP and Struts 1.1.
As of now, i am generating the above stuff using java script.
How can i use Dyna Form to meet the above requirement (or) suggest me other way 
if u have any solution for this.

-Thanks in Advance
Jeevan

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: [OT] Create/Edit Form

2005-07-28 Thread Emmanouil Batsis


You need an identifier to update an object, which usually corresponds to 
a PK in your database.  When the identifier is not present or does not 
correspond to a persisted entry, you probably want to create.


hth,

Manos

Andrew Tomaka wrote:


Hey all,

The following is pretty hard to understand.  I'm no good at describing
my problems and wasn't sure how to explain it.  Hopefully, someone
will get what I'm attempting to say

I'm working on a screen that allows a user to dynamically add rows via
Javascript. I then have have a form that contains a list of beans that
stores the data (but that's really beside the point).

My issue comes with the storage of this information.  The form can
either be a blank form or it can be preloaded with other information
depending on whether the record exists or not.  If it is preloaded,
the user can edit the existing rows or add new rows.  The problem
comes when I need to update the database.  When the user hits the save
button, it submits all the information, but I have no way of telling
if a specific row was edited or created. Because of this, I don't know
whether to make an UPDATE query or an INSERT query.  Can anyone think
of a creative way to do this without adding an extra query for each
row?

Any insight would be greatly appreciated!

Thanks,
~ Andrew Tomaka

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

 




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



Re: JSF is the beginning of the end of Struts !!!

2005-07-28 Thread netsql

news to some:
http://bugs.sakaiproject.org/confluence/pages/viewpage.action?pageId=4981

I think it was said us Java dudes should talk less and produce apps 
more in this thread, which is what I said +1 too. It's hard to debate 
PHP vs Java on the server, which is better, which is bigger... bla, bla.


I know you can't do http://roomity.com/launch.jsp in PHP, that would be 
JDNC. And as of tmrw night it will run Linux-Mozilla and OSX-Saffari, 
not just Windoze!.  So if somone says why Java, you say RiA! won't you. 
Lets see somone do that.


(and ah... there is allways the business benefit of not having to post 
your email to mail groups... but we use apps for tech benfit :-) )


hth,
.V

ps: Like Ted said... sometimes we just use MVC we learned in Struts in 
other projects, and my JDNC impl is all MVC, developed by Struts dudes.


John Public wrote:
  Make no mistake about it. JSF

rocks. JSF is based on true MVC architecture, not
the MODEL 2 version that Struts uses. 


J.J.
JSF Developer (former Struts Lead Developer)





--

.V

People are conversing... without posting their email or filling up their
mail box.
roomity.com http://roomity.com/launch.jsp

No sign up to read or search this Rich Internet App.


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



Re: mutli-checkbox

2005-07-28 Thread Sagar Naik
Hi
Sorry for bothering u guys , I could figure out the
mistake
But now the problem is , I dont get the values vback
in the Action (when submit is hit).
I am using form oy type DynaValidatorForm
and my Form Bean has all the properties of type String

Can u pl help.

Thanks

Floowing is the JSP Page :-



%@ page language=java import=java.util.*%
%@ page
import=org.questforum.fwork.struts.DisplayLists%
%@ page import=org.questforum.fwork.WP.UserWP%

%@ page
import=org.questforum.fwork.struts.StringConstants%
%@ page
import=org.questforum.fwork.core.perm.UserPermission%
%@ page
import=org.questforum.fwork.struts.GeneralService%
%@ page
import=org.questforum.fwork.struts.WrapperClass %

%@ taglib uri=http://struts.apache.org/tags-bean;
prefix=bean%
%@ taglib uri=http://struts.apache.org/tags-html;
prefix=html%
%@ taglib
uri=http://jakarta.apache.org/struts/tags-logic;
prefix=logic%
%@ taglib uri=http://java.sun.com/jstl/core;
prefix=c%


%
String strContactId =
request.getParameter(contactId);
UserWP objUserWp = (UserWP)
session.getAttribute(StringConstants.strUserObject);

String []listOfAllPerms = DisplayLists.getAllUserPerms
();
WrapperClass userPerms =
DisplayLists.getPermissionForUser(Integer.parseInt
(strContactId));

pageContext.setAttribute(userPerms, userPerms);
pageContext.setAttribute(listOfAllPerms,
listOfAllPerms);


%
html
head
titlebean:message key=editUserPerm.page.title
//title
/head

body
bean:message key=editUserPerm.page.title /
br
html:form action=editUserPermAction
logic:iterate id = itrListOfAllPerms
name=listOfAllPerms
html:multibox name=userPerms
property=collectionObj 
bean:write name=itrListOfAllPerms /
/html:multibox
bean:write name=itrListOfAllPerms/
br
/logic:iterate

br
html:submit property=PermActions
bean:message key=editUserPerm.back /
/html:submit
/html:form
html:errors /


/body
/html




__
How much free photo storage do you get? Store your friends 'n family snaps for 
FREE with Yahoo! Photos http://in.photos.yahoo.com

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



Re: How to have logical 'OR' between two validator rules ?

2005-07-28 Thread Marc Demlenne
Thanks for the reply, 

This only allows you to compare fields, not to enter a regular
expression mask in the test var. So uit's not enought, except if I'm
totally wrong.
I don't need to have an 'OR' between fields, but between validator
results. That's the problem.
In fact, OR between validwhen and mask should be ok. 
The only solution I'fe found until now is to write a new validator for me. 



On 27/07/05, Glen Mazza [EMAIL PROTECTED] wrote:
 Yes, much clearer now.  If you're using Struts 1.2.x, There is a
 validwhen clause that may help you--look at the test example just
 below it:
 
 http://struts.apache.org/userGuide/dev_validator.html#validwhen
 
 Glen
 
 
 Marc Demlenne escribió:
  Yes, sorry I made a mistake while explaining. I'll try to do it better now.
 
  Of course I need always to validate my form, you're right, sorry for
  the confusion. But I need the form to be valid if either it is
  validated threw the mask validator, OR if it is unchanged, even if in
  this case it does not look like the mask wants any more.
 
  So I want a my field to be something like ^[0-9]{4}$. Ok, I use the
  mask validator, and everything is fine.
 
  Now, if the value already stored in the DB isn't like this mask (there
  are some good reasons to allow this), I want the user to be able to
  modify everything in his form. If he doesn't change the value of this
  field, everything should be correct. BUT if he decide to modify this
  field, then he MUST enter a mask-valid field.
 
  To cope with this, I can use another field, the same, but hidden,
  containing the original value, for example.  Then in my validation, I
  would like,
  - First to check if the given field is the same as the hidden one. In
  this case it has not been modified, and I say validation returns true.
  - Then, if those 2 fields are not the same, I check the real field
  (the one enterered by user) against the mask threw the mask validator,
  and I only accept all of this if this last validation returns true.
 
  Hope it's better explained ?
 
  Thanks Joe for this wonderful link. I have not yet verified
  everything, but I'm affraid it won't be satisfying in my case ... I'm
  still investigating ...
 
 
 
  On 27/07/05, Glen Mazza [EMAIL PROTECTED] wrote:
 
 Marc Demlenne wrote:
 
 
 Hi and thanks for the answer,
 
 In fact my problem could be explained the following way :
 
 Having two fields A and B, I need to validate A if
 (A == mask) OR (A == B)
 
 Your way of stating the problem doesn't seem right and may be adding to
 the difficulties here--I would again think that you *always* need to
 validate A, it's just that validation passes 100% if the above two
 conditions fit, but passes/fails (depending on the results of more
 complex logic) if the above isn't correct.
 
 I.e., instead of saying, If a ZIP code is provided, I need to validate
 that it is five digits long, why not:  I need to validate that the ZIP
 code is either empty, or if not 5 digits?
 
 Again, I'm unsure here (sorry, still a newbie), but using the p. 38
 example below, my inclination is that you can always validate but just
 change the validation logic if the scenario above occurs, something like:
 
 (Pseudocode):
 
 validate() {
 if (A.equals(mask) || a.equals(B)) {
return null; // validate always true
 } else {
// do actual validation,
// return ActionErrors or null as appropriate
 }
 }
 
 I hope someone else can provide a better answer for you though--as I'm
 also quite curious here.
 
 Glen
 
 
 
 I don't know if it is possible to include a field in a mask
 expression. But in the other case, I need to have an alternative
 between the two validators. Is thos possible with struts validator ?
 
 If this isn't possible, I'll need to create my own validator plugin
 
 But if someone has eny advice, it's welcomed !
 
 
 On 26/07/05, Glen Mazza [EMAIL PROTECTED] wrote:
 
 
 I'm not exactly certain of your needs, but I think you can always
 activate validation but just change the validation code based on the
 value/state of other fields (such as the original one you mention).
 
 Perhaps the Java code example on page 38 of
 http://www.objectsource.com/Struts_Survival_Guide.pdf can be of help for
 you--I am unsure.
 
 Glen
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
Marc Demlenne

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



Struts-EL problem with struts-el-1.3.0-dev

2005-07-28 Thread Marco Mistroni
Hello all,
 I have an app which is using struts 1.3.. I wanted to 'replace'
existing struts tag with struts-el tag.
So I downloaded struts-el-1.3.0-dev and put it into my jar, (along with
struts-taglib-1.3.0-dev)

I have declared taglibs in web.xml, and I wrote a simple page which uses
Struts-el inside a logic:tag

And, to my surprise, it did't work  
Basically I have an attribute of type collection in my HttpSession, and
I was trying to access it from the page using

Logic:present name=${sessionScope.results}


for doublechecking, I wrote a scriptlet code that was trying to get the
'results' attribute from the session, to see that if it was actually
there..
and it was there

Even the c:forEAch loop that uses JSTL to get that attribute works
fine..

for providing as much info as I can, here is my web.xml

** WEB.XML (TAGLIBS ONLY) *
   !-- Struts Tag Library Descriptors --
  taglib
taglib-uri/WEB-INF/struts-bean.tld/taglib-uri
taglib-location/WEB-INF/struts-bean.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-html.tld/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-logic.tld/taglib-uri
taglib-location/WEB-INF/struts-logic.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-nested.tld/taglib-uri
taglib-location/WEB-INF/struts-nested.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-tiles.tld/taglib-uri
taglib-location/WEB-INF/struts-tiles.tld/taglib-location
  /taglib

   !-- Struts-EL Tag Library Descriptors --
  taglib
taglib-uri/WEB-INF/struts-bean-el.tld/taglib-uri
taglib-location/WEB-INF/struts-bean-el.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-html-el.tld/taglib-uri
taglib-location/WEB-INF/struts-html-el.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-logic-el.tld/taglib-uri
taglib-location/WEB-INF/struts-logic-el.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-tiles-el.tld/taglib-uri
taglib-location/WEB-INF/struts-tiles-el.tld/taglib-location
  /taglib   
***

and here is my JSP (only relevant part)***

%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %
%@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; % 
%@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-bean-el.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-logic-el.tld prefix=logic%

% if(session.getAttribute(results) != null) {
java.util.Collection coll =
(java.util.Collection)session.getAttribute(RESULTS);
System.out.println( in session there are  + coll.size() +
 elements!!!); // this print successfully
}
%


TR
TD colspan=4centerlogic:present
name=${sessionScope.results}hello/logic:presentc:out
value=${statusMsg}//center
/TD
  /TR
  

c:forEach  var=entry items=${sessionScope.results}  
    // this displays the loop data
/c:forEach

***


other than that, in my \lib directory I have both
struts-taglib-1.3.0-dev and struts-el-1.3.0-dev,
and I am running my code on Jboss 3.2.5

anyone could give me some hints on what's wrong?
Do you think the fact that I have both  struts-taglib and struts-el in
my
Lib directory could cause problems?

Thanks in advance and regards
marco







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



Re: Struts-EL problem with struts-el-1.3.0-dev

2005-07-28 Thread Joe Germuska

At 11:08 AM +0100 7/28/05, Marco Mistroni wrote:

anyone could give me some hints on what's wrong?
Do you think the fact that I have both  struts-taglib and struts-el in
my
Lib directory could cause problems?


No, because el actually depends on taglib -- you have to have taglib to use el.

If you're also using JSTL, I would always advise using c:if 
whereever it works -- not that this shouldn't be fixed if it turns 
out to be a bug.


Joe



Hello all,
 I have an app which is using struts 1.3.. I wanted to 'replace'
existing struts tag with struts-el tag.
So I downloaded struts-el-1.3.0-dev and put it into my jar, (along with
struts-taglib-1.3.0-dev)

I have declared taglibs in web.xml, and I wrote a simple page which uses
Struts-el inside a logic:tag

And, to my surprise, it did't work 
Basically I have an attribute of type collection in my HttpSession, and

I was trying to access it from the page using

Logic:present name=${sessionScope.results}


for doublechecking, I wrote a scriptlet code that was trying to get the
'results' attribute from the session, to see that if it was actually
there..
and it was there

Even the c:forEAch loop that uses JSTL to get that attribute works
fine..

for providing as much info as I can, here is my web.xml

** WEB.XML (TAGLIBS ONLY) *
   !-- Struts Tag Library Descriptors --
  taglib
taglib-uri/WEB-INF/struts-bean.tld/taglib-uri
taglib-location/WEB-INF/struts-bean.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-html.tld/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-logic.tld/taglib-uri
taglib-location/WEB-INF/struts-logic.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-nested.tld/taglib-uri
taglib-location/WEB-INF/struts-nested.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-tiles.tld/taglib-uri
taglib-location/WEB-INF/struts-tiles.tld/taglib-location
  /taglib

   !-- Struts-EL Tag Library Descriptors --
  taglib
taglib-uri/WEB-INF/struts-bean-el.tld/taglib-uri
taglib-location/WEB-INF/struts-bean-el.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-html-el.tld/taglib-uri
taglib-location/WEB-INF/struts-html-el.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-logic-el.tld/taglib-uri
taglib-location/WEB-INF/struts-logic-el.tld/taglib-location
  /taglib

  taglib
taglib-uri/WEB-INF/struts-tiles-el.tld/taglib-uri
taglib-location/WEB-INF/struts-tiles-el.tld/taglib-location
  /taglib  
***


and here is my JSP (only relevant part)***

%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %
%@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; %
%@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-bean-el.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-logic-el.tld prefix=logic%

% if(session.getAttribute(results) != null) {
java.util.Collection coll =
(java.util.Collection)session.getAttribute(RESULTS);
System.out.println( in session there are  + coll.size() +
 elements!!!); // this print successfully
}
%


TR
TD colspan=4centerlogic:present
name=${sessionScope.results}hello/logic:presentc:out
value=${statusMsg}//center
/TD
  /TR


c:forEach  var=entry items=${sessionScope.results} 
    // this displays the loop data

/c:forEach

***


other than that, in my \lib directory I have both
struts-taglib-1.3.0-dev and struts-el-1.3.0-dev,
and I am running my code on Jboss 3.2.5


Thanks in advance and regards
marco







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



--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
Narrow minds are weapons made for mass destruction  -The Ex


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



RE: Struts-EL problem with struts-el-1.3.0-dev

2005-07-28 Thread Marco Mistroni
Hello Joe,
Yes I actually reverted to using c:if, and it worked
Just fine

I wanted just to report the situation to see if I was 
Using the taglib incorrectly...


Thanx again and regards
marco


-Original Message-
From: Joe Germuska [mailto:[EMAIL PROTECTED] 
Sent: 28 July 2005 12:15
To: Marco Mistroni; 'Struts Users Mailing List'
Subject: Re: Struts-EL problem with struts-el-1.3.0-dev

At 11:08 AM +0100 7/28/05, Marco Mistroni wrote:
anyone could give me some hints on what's wrong?
Do you think the fact that I have both  struts-taglib and struts-el in
my
Lib directory could cause problems?

No, because el actually depends on taglib -- you have to have taglib to
use el.

If you're also using JSTL, I would always advise using c:if 
whereever it works -- not that this shouldn't be fixed if it turns 
out to be a bug.

Joe


Hello all,
I have an app which is using struts 1.3.. I wanted to 'replace'
existing struts tag with struts-el tag.
So I downloaded struts-el-1.3.0-dev and put it into my jar, (along with
struts-taglib-1.3.0-dev)

I have declared taglibs in web.xml, and I wrote a simple page which
uses
Struts-el inside a logic:tag

And, to my surprise, it did't work 
Basically I have an attribute of type collection in my HttpSession, and
I was trying to access it from the page using

Logic:present name=${sessionScope.results}


for doublechecking, I wrote a scriptlet code that was trying to get the
'results' attribute from the session, to see that if it was actually
there..
and it was there

Even the c:forEAch loop that uses JSTL to get that attribute works
fine..

for providing as much info as I can, here is my web.xml

** WEB.XML (TAGLIBS ONLY) *
!-- Struts Tag Library Descriptors --
   taglib
 taglib-uri/WEB-INF/struts-bean.tld/taglib-uri
 taglib-location/WEB-INF/struts-bean.tld/taglib-location
   /taglib

   taglib
 taglib-uri/WEB-INF/struts-html.tld/taglib-uri
 taglib-location/WEB-INF/struts-html.tld/taglib-location
   /taglib

   taglib
 taglib-uri/WEB-INF/struts-logic.tld/taglib-uri
 taglib-location/WEB-INF/struts-logic.tld/taglib-location
   /taglib

   taglib
 taglib-uri/WEB-INF/struts-nested.tld/taglib-uri
 taglib-location/WEB-INF/struts-nested.tld/taglib-location
   /taglib

   taglib
 taglib-uri/WEB-INF/struts-tiles.tld/taglib-uri
 taglib-location/WEB-INF/struts-tiles.tld/taglib-location
   /taglib

!-- Struts-EL Tag Library Descriptors --
   taglib
 taglib-uri/WEB-INF/struts-bean-el.tld/taglib-uri
 taglib-location/WEB-INF/struts-bean-el.tld/taglib-location
   /taglib

   taglib
 taglib-uri/WEB-INF/struts-html-el.tld/taglib-uri
 taglib-location/WEB-INF/struts-html-el.tld/taglib-location
   /taglib

   taglib
 taglib-uri/WEB-INF/struts-logic-el.tld/taglib-uri
 taglib-location/WEB-INF/struts-logic-el.tld/taglib-location
   /taglib

   taglib
 taglib-uri/WEB-INF/struts-tiles-el.tld/taglib-uri
 taglib-location/WEB-INF/struts-tiles-el.tld/taglib-location
   /taglib  
***

and here is my JSP (only relevant part)***

%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %
%@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; %
%@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-bean-el.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-logic-el.tld prefix=logic%

% if(session.getAttribute(results) != null) {
   java.util.Collection coll =
(java.util.Collection)session.getAttribute(RESULTS);
   System.out.println( in session there are  + coll.size() +
 elements!!!); // this print successfully
 }
%


TR
 TD colspan=4centerlogic:present
name=${sessionScope.results}hello/logic:presentc:out
value=${statusMsg}//center
 /TD
   /TR


c:forEach  var=entry items=${sessionScope.results} 
 // this displays the loop data
/c:forEach

***


other than that, in my \lib directory I have both
struts-taglib-1.3.0-dev and struts-el-1.3.0-dev,
and I am running my code on Jboss 3.2.5


Thanks in advance and regards
   marco







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


-- 
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
Narrow minds are weapons made for mass destruction  -The Ex

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


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



UrlValidator

2005-07-28 Thread Marc Logemann

Hi,

can it be that UrlValidator from Commons-Validator doesnt validate URLs 
with localhost in it?


The following URL - http://localhost:8081/context/jsp/versand_1.jsp

breaks in isValidAuthority() within UrlValidator. It seems he tries to 
check for toplevel domain length and sees my localhost as a toplevel 
domain.


I am hoping i ve done something wrong because i would suspect that a 
UrlValidator validates this pretty straightforward URL.



--
regards
Marc Logemann
[blog] http://www.logemann.org
[busn] http://www.logentis.de

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



Error Message Problem (Again)

2005-07-28 Thread BHansard

Hi All,

Seems this is a constant area of irritation.  I am attempting to put an
error message into the ActionMessage in an Action Class and redisplay this
on a JSP page.  This application is using tiles and is located in a Struts
Module.  Seems simple enough, but I can't get the darn thing to display on
the JSP.

Here is extracts from my code.

Action Class:
public ActionForward execute(final ActionMapping mapping,
final
ActionForm form,
final
HttpServletRequest request,
final
HttpServletResponse response) {

ActionForward forward = mapping.findForward(fail);
ActionMessages errors = new ActionMessages();

...

errors.add(displayerror, new ActionMessage(myerror, false));

 ...

 saveErrors(request, errors);

}

JSP Page:

html:form action=/myAction.do method=post
html:messages id=error property=displayerror
bean:write name=error /
/html:messages

  ...

/html:form

I have also tried:

html:form action=/myAction.do method=post
html:errors/

  ...

/html:form

Neither work

I inspect errors on the save error line and can see the error message in
the ActionMessage list, so I know it is being added to the request.  I also
used the false attribute to simply display myerror on the page to
eliminate the possibilty of a properties file typo problem.  Any
recommendations on where to look?

RE: Error Message Problem (Again)

2005-07-28 Thread Harland, David
Hi,

Try the following:

Use saveMessages(request, messages) instead of saveErrors(request,
errors)

And use something like 

  logic:messagesPresent message=true
  tr
tdnbsp;/td
tdnbsp;/td
tdnbsp;/td
  /tr
  html:messages id=message message=true
  tr
tdnbsp;/td
td colspan=8 class=style1font color=redlibean:write
name=message//li/font/td
tdnbsp;/td
  /tr
  tr
tdnbsp;/td
td colspan=8 class=style1nbsp;/td
tdnbsp;/td
  /tr
  /html:messages
  /logic:messagesPresent 

In your web page.

Regards

David.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: 28 July 2005 13:35
To: user@struts.apache.org
Subject: Error Message Problem (Again)


Hi All,

Seems this is a constant area of irritation.  I am attempting to put an
error message into the ActionMessage in an Action Class and redisplay
this
on a JSP page.  This application is using tiles and is located in a
Struts
Module.  Seems simple enough, but I can't get the darn thing to display
on
the JSP.

Here is extracts from my code.

Action Class:
public ActionForward execute(final ActionMapping mapping,
final
ActionForm form,
final
HttpServletRequest request,
final
HttpServletResponse response) {

ActionForward forward = mapping.findForward(fail);
ActionMessages errors = new ActionMessages();

...

errors.add(displayerror, new ActionMessage(myerror, false));

 ...

 saveErrors(request, errors);

}

JSP Page:

html:form action=/myAction.do method=post
html:messages id=error property=displayerror
bean:write name=error /
/html:messages

  ...

/html:form

I have also tried:

html:form action=/myAction.do method=post
html:errors/

  ...

/html:form

Neither work

I inspect errors on the save error line and can see the error message in
the ActionMessage list, so I know it is being added to the request.  I
also
used the false attribute to simply display myerror on the page to
eliminate the possibilty of a properties file typo problem.  Any
recommendations on where to look?

This e mail is from DLA Piper Rudnick Gray Cary UK LLP.

The contents of this email and any attachments are confidential to the intended 
recipient. They may not be disclosed to or used by or copied in any way by 
anyone other than the intended recipient. If this email is received in error, 
please contact DLA Piper Rudnick Gray Cary UK LLP on +44 (0) 8700 11 
quoting the name of the sender and the email address to which it has been sent 
and then delete it.

Please note that neither DLA Piper Rudnick Gray Cary UK LLP nor the sender 
accept any responsibility for viruses and it is your responsibility to scan or 
otherwise check this email and any attachments. 

DLA Piper Rudnick Gray Cary UK LLP is a limited liability partnership 
registered in England and Wales (registered number OC307847) which provides 
services from offices in England, Belgium, Germany and the People's Republic of 
China.  A list of members is open for inspection at its registered office and 
principal place of business 3 Noble Street, London EC2V 7EE.  Partner denotes 
member of a limited liability partnership.

DLA Piper Rudnick Gray Cary UK LLP is regulated by the Law Society and is a 
member of DLA Piper Rudnick Gray Cary, a global legal services organisation, 
the members of which are separate and distinct legal entities.  For further 
information, please refer to www.dlapiper.com.




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



Re: Struts-EL problem with struts-el-1.3.0-dev

2005-07-28 Thread Wendy Smoak

From: Marco Mistroni [EMAIL PROTECTED]


Yes I actually reverted to using c:if, and it worked
Just fine

I wanted just to report the situation to see if I was
Using the taglib incorrectly...



logic:present name=${sessionScope.results}


Even if you're going to use an expression, the 'name' attribute should still
evaluate to the _name_ of the bean, not the bean itself.
  http://struts.apache.org/userGuide/struts-logic.html#present

If this works:

c:forEach  var=entry items=${sessionScope.results}
   // this displays the loop data
/c:forEach


Then the logic:present tag would be:
  %@ taglib uri=http://struts.apache.org/tags-logic-el; prefix=logic %
  logic:present name=results scope=session

No EL required for that one.  But do use the JSTL tags instead whenever
possible. :)

[BTW, in a Servlet 2.3 container, you do not need all those taglib tags in 
web.xml.  If you use the correct URI, the tlds will be located in the .jar 
files in WEB-INF/lib.]


--
Wendy Smoak



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



RE: Error Message Problem (Again)

2005-07-28 Thread BHansard

No luck.

I also added test inside the logic:messagesPresent ... tag.  The text was not displayed which indicates the save did not put any messages into the request,  Yet, the ActionMessages does have a message in it and the saveMessage(request, errors) line is called.


Harland, David [EMAIL PROTECTED]








Harland, David [EMAIL PROTECTED] 
07/28/2005 08:52 AM

Please respond to
Struts Users Mailing List user@struts.apache.org








To
Struts Users Mailing List user@struts.apache.org


cc



Subject
RE: Error Message Problem (Again)








Hi,

Try the following:

Use saveMessages(request, messages) instead of saveErrors(request,
errors)

And use something like 

 logic:messagesPresent message=true
 tr
  tdnbsp;/td
  tdnbsp;/td
  tdnbsp;/td
 /tr
 html:messages id=message message=true
 tr
  tdnbsp;/td
  td colspan=8 class=style1font color=redlibean:write
name=message//li/font/td
  tdnbsp;/td
 /tr
 tr
  tdnbsp;/td
  td colspan=8 class=style1nbsp;/td
  tdnbsp;/td
 /tr
 /html:messages
 /logic:messagesPresent 

In your web page.

Regards

David.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] 
Sent: 28 July 2005 13:35
To: user@struts.apache.org
Subject: Error Message Problem (Again)


Hi All,

Seems this is a constant area of irritation. I am attempting to put an
error message into the ActionMessage in an Action Class and redisplay
this
on a JSP page. This application is using tiles and is located in a
Struts
Module. Seems simple enough, but I can't get the darn thing to display
on
the JSP.

Here is extracts from my code.

Action Class:
public ActionForward execute(final ActionMapping mapping,
  final
ActionForm form,
  final
HttpServletRequest request,
  final
HttpServletResponse response) {

ActionForward forward = mapping.findForward(fail);
ActionMessages errors = new ActionMessages();

...

errors.add(displayerror, new ActionMessage(myerror, false));

 ...

 saveErrors(request, errors);

}

JSP Page:

html:form action="" method=post
  html:messages id=error property=displayerror
bean:write name=error /
  /html:messages

   ...

/html:form

I have also tried:

html:form action="" method=post
  html:errors/

   ...

/html:form

Neither work

I inspect errors on the save error line and can see the error message in
the ActionMessage list, so I know it is being added to the request. I
also
used the false attribute to simply display myerror on the page to
eliminate the possibilty of a properties file typo problem. Any
recommendations on where to look?

This e mail is from DLA Piper Rudnick Gray Cary UK LLP.

The contents of this email and any attachments are confidential to the intended recipient. They may not be disclosed to or used by or copied in any way by anyone other than the intended recipient. If this email is received in error, please contact DLA Piper Rudnick Gray Cary UK LLP on +44 (0) 8700 11 quoting the name of the sender and the email address to which it has been sent and then delete it.

Please note that neither DLA Piper Rudnick Gray Cary UK LLP nor the sender accept any responsibility for viruses and it is your responsibility to scan or otherwise check this email and any attachments. 

DLA Piper Rudnick Gray Cary UK LLP is a limited liability partnership registered in England and Wales (registered number OC307847) which provides services from offices in England, Belgium, Germany and the People's Republic of China. A list of members is open for inspection at its registered office and principal place of business 3 Noble Street, London EC2V 7EE. Partner denotes member of a limited liability partnership.

DLA Piper Rudnick Gray Cary UK LLP is regulated by the Law Society and is a member of DLA Piper Rudnick Gray Cary, a global legal services organisation, the members of which are separate and distinct legal entities. For further information, please refer to www.dlapiper.com.




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





RE: Error Message Problem (Again)

2005-07-28 Thread BHansard

Sorry, it does work, I forgot to change the messages name from errors.  

Thank you for the help...


Harland, David [EMAIL PROTECTED]








Harland, David [EMAIL PROTECTED] 
07/28/2005 08:52 AM

Please respond to
Struts Users Mailing List user@struts.apache.org








To
Struts Users Mailing List user@struts.apache.org


cc



Subject
RE: Error Message Problem (Again)








Hi,

Try the following:

Use saveMessages(request, messages) instead of saveErrors(request,
errors)

And use something like 

 logic:messagesPresent message=true
 tr
  tdnbsp;/td
  tdnbsp;/td
  tdnbsp;/td
 /tr
 html:messages id=message message=true
 tr
  tdnbsp;/td
  td colspan=8 class=style1font color=redlibean:write
name=message//li/font/td
  tdnbsp;/td
 /tr
 tr
  tdnbsp;/td
  td colspan=8 class=style1nbsp;/td
  tdnbsp;/td
 /tr
 /html:messages
 /logic:messagesPresent 

In your web page.

Regards

David.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] 
Sent: 28 July 2005 13:35
To: user@struts.apache.org
Subject: Error Message Problem (Again)


Hi All,

Seems this is a constant area of irritation. I am attempting to put an
error message into the ActionMessage in an Action Class and redisplay
this
on a JSP page. This application is using tiles and is located in a
Struts
Module. Seems simple enough, but I can't get the darn thing to display
on
the JSP.

Here is extracts from my code.

Action Class:
public ActionForward execute(final ActionMapping mapping,
  final
ActionForm form,
  final
HttpServletRequest request,
  final
HttpServletResponse response) {

ActionForward forward = mapping.findForward(fail);
ActionMessages errors = new ActionMessages();

...

errors.add(displayerror, new ActionMessage(myerror, false));

 ...

 saveErrors(request, errors);

}

JSP Page:

html:form action="" method=post
  html:messages id=error property=displayerror
bean:write name=error /
  /html:messages

   ...

/html:form

I have also tried:

html:form action="" method=post
  html:errors/

   ...

/html:form

Neither work

I inspect errors on the save error line and can see the error message in
the ActionMessage list, so I know it is being added to the request. I
also
used the false attribute to simply display myerror on the page to
eliminate the possibilty of a properties file typo problem. Any
recommendations on where to look?

This e mail is from DLA Piper Rudnick Gray Cary UK LLP.

The contents of this email and any attachments are confidential to the intended recipient. They may not be disclosed to or used by or copied in any way by anyone other than the intended recipient. If this email is received in error, please contact DLA Piper Rudnick Gray Cary UK LLP on +44 (0) 8700 11 quoting the name of the sender and the email address to which it has been sent and then delete it.

Please note that neither DLA Piper Rudnick Gray Cary UK LLP nor the sender accept any responsibility for viruses and it is your responsibility to scan or otherwise check this email and any attachments. 

DLA Piper Rudnick Gray Cary UK LLP is a limited liability partnership registered in England and Wales (registered number OC307847) which provides services from offices in England, Belgium, Germany and the People's Republic of China. A list of members is open for inspection at its registered office and principal place of business 3 Noble Street, London EC2V 7EE. Partner denotes member of a limited liability partnership.

DLA Piper Rudnick Gray Cary UK LLP is regulated by the Law Society and is a member of DLA Piper Rudnick Gray Cary, a global legal services organisation, the members of which are separate and distinct legal entities. For further information, please refer to www.dlapiper.com.




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





String concatenation

2005-07-28 Thread Konrad Billewicz
Hi,

I would like to use Struts tags in JSP file in order to dynamically merge two 
beans. First is constant String, second is an Integer. The current, very dirty :
-(, version is as follows (I present it in order to give you a better view of 
what I'm trying to do):

bean:define id=dictionaryId name=dictionaryId scope=request /

...

% String action =  createDictionaryEntity.do?dictionary= + (Integer)
dictionaryId; %
html:form action=%= action %

Probably it's quite easy and straightforward but I have been searching and 
haven't found an answer.

Best regards,
Konrad Billewicz



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



RE: UrlValidator

2005-07-28 Thread Lindholm, Greg
I encountered this awhile back but didn't have time to investigate.
As a workaround I use the localhost IP address 127.0.0.1 but it
would be nice to get this fixed.
 

-Original Message-
From: Marc Logemann [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 28, 2005 8:33 AM
To: user@struts.apache.org
Subject: UrlValidator

Hi,

can it be that UrlValidator from Commons-Validator doesnt validate URLs 
with localhost in it?

The following URL - http://localhost:8081/context/jsp/versand_1.jsp

breaks in isValidAuthority() within UrlValidator. It seems he tries to 
check for toplevel domain length and sees my localhost as a toplevel 
domain.

I am hoping i ve done something wrong because i would suspect that a 
UrlValidator validates this pretty straightforward URL.


-- 

regards
Marc Logemann
[blog] http://www.logemann.org
[busn] http://www.logentis.de

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


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



Re: String concatenation

2005-07-28 Thread Stéphane Zuckerman

Hello Konrad,

I'm not sure I've understood correctly what you want to do, but here's 
what I would do :


bean:define
  id=myBean
  value=%= SomeConstantsHolderClass.CONSTANT_STRING + 
SomeConstantsHolderClass.CONSTANT_STRING % /


html:form action=%= action %
...

Don't forget that you can still use an action _before_ you go to your 
JSP to prepopulate it. And by the way, in the JSP, everything is 
toString()ed, if I'm not mistaken, so you can always do something like

bean:define id=aValue value=%= someString + someInteger %/

--
Stéphane Zuckerman

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



RE: Struts-EL problem with struts-el-1.3.0-dev

2005-07-28 Thread Marco Mistroni

Hello Wendy,
I missed one point of your statement..

 logic:present name=${sessionScope.results}

Even if you're going to use an expression, the 'name' attribute should
still
evaluate to the _name_ of the bean, not the bean itself.
   http://struts.apache.org/userGuide/struts-logic.html#present

what do you mean? If I store the bean under the attribute name 'result',
why
the above EL is wrong?

Then the logic:present tag would be:
   %@ taglib uri=http://struts.apache.org/tags-logic-el;
prefix=logic%
   logic:present name=results scope=session

No EL required for that one.  But do use the JSTL tags instead whenever
possible. :)

I use EL to replace   logic:present name=%= Constants.RESULT%/
where Constants.RESULT  has value 'results'

Where does the above declaration differ from the EL?

What does  ${sessionScope.result} represent in this case?



can you show me a quick sample on a simple  use of EL ?
if I store objects in session/request/applicationScope, why can't I use

struts-el with EL to retrieve them?


Thanx in advance for your time and regards
Marco mistroni




[BTW, in a Servlet 2.3 container, you do not need all those taglib
tags in 
web.xml.  If you use the correct URI, the tlds will be located in the
.jar 
files in WEB-INF/lib.]

-- 
Wendy Smoak



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


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



Re: String concatenation

2005-07-28 Thread ichy
hi, Konrad.
 do you need to put dictionaryId to querystring?
 i come up with
 html:form action=createDictionaryEntity
input type=hidden name=dictionaryId value=bean:write 
name=dictionaryId/
 as an alternative
 regards
ichy


Re: Re: JSF is the beginning of the end of Struts !!!

2005-07-28 Thread John Henry Xu
I think I need clarify my statements before.

 Craig, I assure you that I always hope Java success and I do think it
 popular for web app. The only thing I think I said Java was not doing
 well as PHP is that PHP becomes more popular in public sites.

That is definitely what you claimed.  I claim that such a standard is
irrelevant.

I just try to find where I said Java, as a whole, is not popular in web
application from my previous email. Unfortunately I can not find that
statement. Can someone post my original saying so I can find it? I really
like to know where I said that statement.

 [snip]
 
  If it uses Java in Apache, I may find mod_jk, or jsp, .do?... I found
  .shtml mostly.
 

 Consider a Struts based web site that maps *.html to the Struts
 action servlet (and there are more such sites on the public Internet
 than you would possibly believe :-). Your approach is going to come
 to the mistaken conclusion that this is a static HTML based site
 instead of a Struts based site. Actually, my favorite sites are the
 ones that map *.asp to the Struts servlet. Gotta love people that
 bend minds like that!

 But the serious point is that, if you think you can conclude anything
 based on the textual content of a URL, you are naively mistaken. Only
 the server you are calling knows for sure what technologies are used
 to produce a particular response.

Did I say I can conclude based on textual content of a URL? Someone
please find where I said that also. I really want see how I concluded
that.  

What I say was that there is No Evidence that www.javaworld.com uses java
in their site. If someone have evidence, please let me know. I really
like to see how and why that site tried to hide java implementation.  Am
I so naive about thinking html is static site? Just go to our sites, see
all the html there. If someone think those html are real html, they are
wrong.

Actually, my favorite sites are the
 ones that map *.asp to the Struts servlet. Gotta love people that
 bend minds like that!


I cannot imagine what motivates people tried to map there servlets to
.asp. Even I could easily map my site to .aspx, I would not do that.
Although I respect MS, I am not really a huge fun of Microsoft. If I
implement sites with Java, I want java take credits. If I implement sites
in PHP, I want PHP take credits, I would not map that to .asp. If I use
.net, I don't map it to jsp also.  If I saw a site ends with .php or
.aspx, I assume that was a php and .net site, and I belieave I am right
on that with 99% confidence.  

John H. Xu


http://www.usanalyst.com

http://www.GetusJobs.com (The largest free job portal in North America)

-- 
___
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm



Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Frank W. Zammetti
Yes, I think what you caught yourself is what I was driving towards :)

Just for comparisons' sake, here's the filter and listener I came up with
to deal with this (this is condensed for space, just showing the main bits
of the puzzle)... this is what's going in JWP (unless someone points out a
major flaw of course!)...

The filter:


import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class SessionLimiterFilter implements Filter {
  private static String forwardTo;
  public void destroy() {
  }
  public void init(FilterConfig filterConfig) throws ServletException {
int maxSessions = Integer.parseInt(
  filterConfig.getInitParameter(maxSessions));
SessionLimiterListener.setMaxSessions(maxSessions);
forwardTo = filterConfig.getInitParameter(forwardTo);
  }
  public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain filterChain)
   throws ServletException, IOException {
filterChain.doFilter(request, response);
HttpSession session = ((HttpServletRequest)request).getSession();
String ds =
   (String)session.getAttribute(SessionLimiter_DisallowSession);
if (ds != null) {
  session.setAttribute(SessionLimiter_NoDecreaseCount, true);
  session.invalidate();
  request.getRequestDispatcher(forwardTo).forward(request, response);
}
  }
}


The listener:


import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
public class SessionLimiterListener implements HttpSessionListener {
  private static Log log = LogFactory.getLog(SessionLimiterListener.class);
  private static int maxSessions;
  private static volatile int sessionCount;
  public static void setMaxSessions(int inMaxSessions) {
maxSessions = inMaxSessions;
  }
  public synchronized void sessionCreated(HttpSessionEvent se) {
if (sessionCount == maxSessions) {
  HttpSession session = se.getSession();
  session.setAttribute(SessionLimiter_DisallowSession, true);
} else {
  sessionCount++;
}
  }
  public synchronized void sessionDestroyed(HttpSessionEvent se) {
HttpSession session = se.getSession();
String ndc =
(String)session.getAttribute(SessionLimiter_NoDecreaseCount);
if (ndc == null) {
  sessionCount--;
}
  }
}


Our code looks pretty similar... that's to be expected based on the
solution path we took :)  This code allows you to not really care how or
where the session got created, and it of course allows you to set any
number of sessions as the maximum.

Basically, the flow is this:

1. Filter fires, nothing happens initially, chain continues.

2. Listener fires when session is created.  If max sessions is already in
use, set a flag in session and return.  If max sessions NOT already in
use, bump up session count and return.

3. We wind up back in the filter, which checks for the flag that may have
been set in sessionCreated().  If it's found, we set a flag in session
indicating NOT to decrease the session count (because the session that was
just created doesn't really count towards reaching max sessions),
invalidate the session (which of course executes sessionDestroyed() in the
listener) and forward to the configured landing page.  If the flag WAS NOT
found, filter is done.

4. Now, when a session is destroyed, we of course reach sessionDestroyed()
in the listener.  In this case we check for that flag mentioned above that
could have been set by the filter.  If it's NOT present we decrease the
session count because we know this was the result of logoff or timeout. 
If the flag IS found, count is not touched.

In the end we came up with an almost identical solution really :)  Great
minds and all that jazz right?!?

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, July 28, 2005 2:24 am, Tamas Szabo said:
 Hi Frank,

 Doesn't the sessionCount get decremented regardless of whether the
 session is being destroyed as the result of a regular logoff or
 timeout as well as if it was a rejected logon (i.e., max sessions
 already in use)?  I dealt with this problem in the code I'm adding to
 Java Web Parts tomorrow, but maybe you found a better way than I did :)

 Yes, the sessionCount is decremented everytime a session is destroyed
 regardless of regular logoff, 'forced' logoff (max sessions in use) :-))
 or timeout.
 But that's what I wanted. Do you see a problem with it?
 sessionCount is the number of existing sessions, so I decrement the
 sessionCount everytime a session is destroyed(no matter why it was
 destroyed).

 Also, I was a bit surprised to learn that filters 

Re: UrlValidator

2005-07-28 Thread Marc Logemann

Hi,

if i have the time in the next days i will work on that, but where 
should i send a possible fix? struts-dev or to the commons-validator guys?




Lindholm, Greg wrote:

I encountered this awhile back but didn't have time to investigate.
As a workaround I use the localhost IP address 127.0.0.1 but it
would be nice to get this fixed.
 


-Original Message-
From: Marc Logemann [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 28, 2005 8:33 AM

To: user@struts.apache.org
Subject: UrlValidator

Hi,

can it be that UrlValidator from Commons-Validator doesnt validate URLs 
with localhost in it?


The following URL - http://localhost:8081/context/jsp/versand_1.jsp



--
regards
Marc Logemann
[blog] http://www.logemann.org
[busn] http://www.logentis.de

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



multipart request issues

2005-07-28 Thread Carl Smith

I am having issues to get the request parameters from a multipart request, le 
me explain my problem first:

Our flow of process is:

(1) a multipart request is submitted to a struts action (let's say 
updateTableAction.do) using POST

(2) the multipart request is processed by ActionServlet.process() method

(3) in our processPreprocess method, which overrides processPreprocess in 
RequestProcessor.java from struts,

we need the parameters from this multipart request thus I am doing this:

CommonsMultipartRequestHandler commonMultiPartHandler = new 
CommonsMultipartRequestHandler(); 



try {

commonMultiPartHandler.handleRequest(request);

}catch(Exception e){

// some handling

}

Hashtable ht = commonMultiPartHandler.getTextElements(); // thus I get the 
parameters from the request

(4) however, all the fields/parameters in multipart request are no longer there 
in the updateTableAction.do

Can you help me find out why this is happening? One theory is that a multipart 
request can't be parsed twice. Is this correct, if it is correct, do you have 
any alternative?

Thanks.



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Restricting Get requests

2005-07-28 Thread Josh Cronemeyer
Part of the OWASP recommendations is that we do not allow authentication
and session data to be submitted via GET request, this includes the
session id. This comes from the OWASP top ten
(http://www.owasp.org/documentation/topten/a3.html) under A3.5 under
Browser Caching and Session ID Protection.

I can tell jsp's to pass parameters in using a POST request, but if the
user passes the parameters in through the url, I need to be able to
restrict that. Does anyone know of any way to do this in struts?

Also, does anyone know how to force struts to not pass along the session
id if cookies are disabled?

-- 
Josh Cronemeyer
Information Network of Kansas

I don't understand, said the scientist, why you lemmings all rush 
down to the sea and drown yourselves.

How curious, said the lemming.  The one thing I don't understand 
is why you human beings don't.
  
From Interview With a Lemming, by James Thurber

CONFIDENTIALITY NOTICE:
This E-mail and any attachments are confidential.  If you are not the
intended recipient, you do not have permission to disclose, copy,
distribute, or open any attachments.  If you have received this E-mail
in error, please notify us immediately by returning it to the sender
and delete this copy from your system.

Thank you.

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



Re: Restricting Get requests

2005-07-28 Thread DGraham
Are you asking if Struts can control what URL your user types into his 
browser?  I could be wrong, but somehow, I don't think Struts is _that_ 
powerful.  ;)

-Dennis




Josh Cronemeyer [EMAIL PROTECTED] 
07/28/2005 10:48 AM
Please respond to
Struts Users Mailing List user@struts.apache.org


To
Struts Users Mailing List user@struts.apache.org
cc

Subject
Restricting Get requests






Part of the OWASP recommendations is that we do not allow authentication
and session data to be submitted via GET request, this includes the
session id. This comes from the OWASP top ten
(http://www.owasp.org/documentation/topten/a3.html) under A3.5 under
Browser Caching and Session ID Protection.

I can tell jsp's to pass parameters in using a POST request, but if the
user passes the parameters in through the url, I need to be able to
restrict that. Does anyone know of any way to do this in struts?

Also, does anyone know how to force struts to not pass along the session
id if cookies are disabled?

-- 
Josh Cronemeyer
Information Network of Kansas

I don't understand, said the scientist, why you lemmings all rush 
down to the sea and drown yourselves.

How curious, said the lemming.  The one thing I don't understand 
is why you human beings don't.
 
From Interview With a Lemming, by James Thurber

CONFIDENTIALITY NOTICE:
This E-mail and any attachments are confidential.  If you are not the
intended recipient, you do not have permission to disclose, copy,
distribute, or open any attachments.  If you have received this E-mail
in error, please notify us immediately by returning it to the sender
and delete this copy from your system.

Thank you.

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




Merging form properties

2005-07-28 Thread Cadariu, Mihai
Hi,

Is there a way to merge properties of two formbeans?

I have two instances of the same form bean class, both containing some
properties filled, the rest being null. I would like to copy the non-null
properties from one form bean to the other. I tried using the
PropertyUtils.copyProperties or BeanUtils.copyProperties but they copy all
properties, whether they are null or not. Is there a way to tweak the
copying, so that only non-null values are overwritten?

TIA,
Mihai


-- 
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 


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



Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Rick Reumann

Tamas Szabo wrote the following on 7/28/2005 2:24 AM:

Yes, the sessionCount is decremented everytime a session is destroyed 
regardless of regular logoff, 'forced' logoff (max sessions in use) :-)) 
or timeout.

But that's what I wanted. Do you see a problem with it?
sessionCount is the number of existing sessions, so I decrement the 
sessionCount everytime a session is destroyed(no matter why it was 
destroyed).


Thanks so much Tamas (and Frank, et al) for help with this. Tamas your 
solution is what I ended up going with (started it before I saw Frank's 
which looked similar). Here were some problems though...


1) For one, the business requirement created a bit more complication in 
the filter. For example a check for the session timing out has to take 
place on all pages except for (index.jsp/login/logout/appinuse). I'm 
doing this check in the filter by checking for the session being null, 
but it created complications of when to force a new one, which is needed 
for the 'invalidate' check.


I'd love some help with the ugly logic I have (which I'll post at end of 
this doc). I know it can be cleaned up, but you know how it is when your 
trying a million different if/else things and your brain is frazzled:)


2) I noticed a lot of odd behavior when the server was shut down and the 
pages were still up. For example, if the user was left on a page that 
displayed a log off link and the server was restarted, when they then 
clicked on log off (which calls session invalidate) it would decrement 
the sessionCounter to -1. I'm not sure how sessionDestroyed could get 
called before sessionCreated, but I guess it can? My hack here was to do 
a check for sessionCount being less than 0 and if so reset it to 0.


3) Using [EMAIL PROTECTED] session=false % didn't seem to call the 
sessionDestroyed method, which I really need to have happen when they 
hit the logoff and appinuse.jsp. I went back to using % 
session.invalidate(); % (I haven't looked at the docs on 
session=false for JSPs does that just make sure a new Session isn't 
created?)


OK here is the filter that I'd love some clean up on. There must be a 
way to make this less ugly...you can try this link to see the full version:


http://rafb.net/paste/results/6APQEc67.html

or the relevant code is below but I'm sure it'll wrap ugly...


if ( pathNeedsCheckForSession(path) ) {
log.debug(pathNeedsCheckForSession = true);
if (session == null) {
log.debug(The session no longer exists, we are 
creating new one and redirecting to index.jsp);
//create a new Session which will allow it to be tested 
for too many

session = request.getSession(true);
response.sendRedirect(contextPath+/index.jsp);
return;
}
 } else if (session == null ) {
 //we are going to login/logout/or index page and no sesion 
exists so we should create new one

 session = request.getSession(true);
 }

if ( path.indexOf(/appinuse.jsp) == -1  
path.indexOf(/logout.jsp) == -1 ) {
log.debug(path not appinuser or logout.jsp so testing for 
if too many users);
//if it's not the appinuse page or logout page, we need to 
see if the app is in use

 if ( session.getAttribute(Constants.INVALIDATE) != null ) {
log.debug(The application is in use);
response.sendRedirect(contextPath+/appinuse.jsp);
//make sure on appinuse page to also invalidate the 
session!

return;
 }
}

Thanks!

--
Rick

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



Re: Restricting Get requests

2005-07-28 Thread Frank W. Zammetti
I think JSF and Shale are! LOL

:) Sorry Craig, couldn't resist :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, July 28, 2005 10:50 am, [EMAIL PROTECTED] said:
 Are you asking if Struts can control what URL your user types into his
 browser?  I could be wrong, but somehow, I don't think Struts is _that_
 powerful.  ;)

 -Dennis




 Josh Cronemeyer [EMAIL PROTECTED]
 07/28/2005 10:48 AM
 Please respond to
 Struts Users Mailing List user@struts.apache.org


 To
 Struts Users Mailing List user@struts.apache.org
 cc

 Subject
 Restricting Get requests






 Part of the OWASP recommendations is that we do not allow authentication
 and session data to be submitted via GET request, this includes the
 session id. This comes from the OWASP top ten
 (http://www.owasp.org/documentation/topten/a3.html) under A3.5 under
 Browser Caching and Session ID Protection.

 I can tell jsp's to pass parameters in using a POST request, but if the
 user passes the parameters in through the url, I need to be able to
 restrict that. Does anyone know of any way to do this in struts?

 Also, does anyone know how to force struts to not pass along the session
 id if cookies are disabled?

 --
 Josh Cronemeyer
 Information Network of Kansas

 I don't understand, said the scientist, why you lemmings all rush
 down to the sea and drown yourselves.

 How curious, said the lemming.  The one thing I don't understand
 is why you human beings don't.

From Interview With a Lemming, by James Thurber

 CONFIDENTIALITY NOTICE:
 This E-mail and any attachments are confidential.  If you are not the
 intended recipient, you do not have permission to disclose, copy,
 distribute, or open any attachments.  If you have received this E-mail
 in error, please notify us immediately by returning it to the sender
 and delete this copy from your system.

 Thank you.

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





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



Re: Merging form properties

2005-07-28 Thread Wendy Smoak
From: Cadariu, Mihai [EMAIL PROTECTED]

 I have two instances of the same form bean class, both containing some
 properties filled, the rest being null. I would like to copy the non-null
 properties from one form bean to the other. I tried using the
 PropertyUtils.copyProperties or BeanUtils.copyProperties but they copy all
 properties, whether they are null or not. Is there a way to tweak the
 copying, so that only non-null values are overwritten?

I haven't done it, but you can use a BeanInfo class to control what
properties are exposed:
   http://java.sun.com/docs/books/tutorial/javabeans/beaninfo/

-- 
Wendy Smoak



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



Re: Problem with Dyna Form

2005-07-28 Thread David Durham

Kade Jeevan Kumar wrote:

Hi All,
 
My requirement is to generate a set of dynamic rows(with checkbox and combo box) at client side using JSP and Struts 1.1.

As of now, i am generating the above stuff using java script.
How can i use Dyna Form to meet the above requirement (or) suggest me other way 
if u have any solution for this.



You can you use a dyna action form with a property like this:

form-property name=blah type=java.lang.String[]/


- Dave

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



Using XHTML and no form name tag

2005-07-28 Thread Titi Wangsa
i'm havig problem with struts.
i'm using 1.2.7 and i'm using the validator plug-in
the problem is when i'm using html:javascript forname=

the name attribiute for form
form name=
is not rendered when html:html xhtml=true

however when only html:html is specified, without turning on the
xhtml feature,
the form name= tag is rendered.

the question is, how to use the html:javascript
feature for client side validation when using html:html xhtml=true

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



Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Tamas Szabo

Hi again,

Frank W. Zammetti wrote:


Yes, I think what you caught yourself is what I was driving towards :)

Just for comparisons' sake, here's the filter and listener I came up with
to deal with this (this is condensed for space, just showing the main bits
of the puzzle)... this is what's going in JWP (unless someone points out a
major flaw of course!)...
 



I wouldn't call itt a major flaw but there is a part which could cause 
some problems in your solution.


You execute the

filterChain.doFilter(request, response);

in every case.

This way you allow users to make requests which could have side effects on the 
server.
I mean that I could execute a /updateUser.jsp?id=1firstName=TomlastName=Sawyer
I could also execute POST requests.

A second problem is that you can access all servlets that don't create 
HttpSessions in their
doGet, doPost methods and jsp's with [EMAIL PROTECTED] session=false %.

If you make it like I did it you won't have these problems.
The two solutions will look more similar if you make this modification, but no 
worries,
I won't sue you. ;-) (I would if I had the money for it, but I'm just a poor 
unemployed Java programmer hehe)


Tamas





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



Re: bean traversal question

2005-07-28 Thread Werner Punz
I after Wendy gave me the advice to rephrase the question I will try to 
rephrase it.


Being new to struts, I want to know how people deal with data objects
which need a scope bigger than request but smaller than session.

I will give an example, you have some kind of wizard interface with 
myriads of input fields distributed over multiple forms.


There are some ways to handle this
a) You can dump anything into the session, which means you run into 
memory problems in the long run.


b) you can put everything into hidden fields, which means you have 
myriads of hidden fields, which is slow and error prone to implement.


c) You can try to add the stuff manually to the session and remove it 
later, which also is problematic in case of an error because then you 
have a mem leak caused, by a tangeling object in the session.


Other frameworks have interesting approaches to solve this.
MyFaces has x:saveState which basically serializes the data objects away 
and loads then once you reach  the next page (and before the request 
data is assigned)


Rails according to a friend has some kind of data structure which you 
can tell to extend to the next request, where you can dump data.


And there is Shale with the dialog system, which allows you to specify 
scopes smaller than session but bigger than request.


How is this problem resolved in struts in a proper manner?

Werner


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



Re: JSF is the beginning of the end of Struts !!!

2005-07-28 Thread Neil Erdwien
I presume preserving URLs is the reason to map one technology's default 
extention to another.  For example, if you have a static web site with 
files than end in .html, and switch to Java/Struts, then you can map 
*.html to the Struts' action servlet.


The end users' bookmarks don't have to change, but you're really running 
a Struts action under the covers.



Stéphane Zuckerman wrote:

John Henry Xu a écrit :


Actually, my favorite sites are the



ones that map *.asp to the Struts servlet. Gotta love people that
bend minds like that!





I cannot imagine what motivates people tried to map there servlets to
.asp. Even I could easily map my site to .aspx, I would not do that.
Although I respect MS, I am not really a huge fun of Microsoft. If I
implement sites with Java, I want java take credits. If I implement sites
in PHP, I want PHP take credits, I would not map that to .asp. If I use
.net, I don't map it to jsp also.  If I saw a site ends with .php or
.aspx, I assume that was a php and .net site, and I belieave I am right
on that with 99% confidence.  



I guess this is against wannabe crackers. Yes, yes, I know, security
through obscurity, blah blah blah... Well, once you've done everything
that isn't obfuscation-related, there is only obscurity that remains,
and frankly, it does help gain a few {minutes,hours} before the nasty
black hats break the server. :-)



--
Neil Erdwien, [EMAIL PROTECTED], Web Technologies Manager
Computing and Network Services, Kansas State University

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



Re: Restricting Get requests

2005-07-28 Thread Joe Germuska

At 9:48 AM -0500 7/28/05, Josh Cronemeyer wrote:

Part of the OWASP recommendations is that we do not allow authentication
and session data to be submitted via GET request, this includes the
session id. This comes from the OWASP top ten
(http://www.owasp.org/documentation/topten/a3.html) under A3.5 under
Browser Caching and Session ID Protection.

I can tell jsp's to pass parameters in using a POST request, but if the
user passes the parameters in through the url, I need to be able to
restrict that. Does anyone know of any way to do this in struts?


Struts doesn't have programmatic support for this right now; I 
believe a Bugzilla enhancement was entered (or maybe just a 
discussion on the lists) to add HTTP method to the action mappings so 
that you could have different mappings for path + protocol.  I 
haven't heard a lot of use cases for that, so I'd be hesitant to 
forge off on an implementation without a little more clarity about 
how people want to use it (it's not something I've ever needed.)


In the meantime, I guess the best thing would be to use 
HttpServletRequest.getMethod() to test and evaluate whether to 
proceed or not.



Also, does anyone know how to force struts to not pass along the session
id if cookies are disabled?


This is a function of the servlet container, not Struts; if you use 
JSP tags which rewrite URLs, they will append the session ID when the 
session ID is not being sent as a cookie-- the solution is to not use 
them!  Of course, that leads to links which have the servlet context 
hard-coded in them, which is generally annoying.


Why do you not want to pass along the session ID?  Do you have an app 
which really doesn't use sessions?


Joe

--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
Narrow minds are weapons made for mass destruction  -The Ex


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



Re: Struts-EL problem with struts-el-1.3.0-dev

2005-07-28 Thread Jeff Beal
On 7/28/05, Marco Mistroni [EMAIL PROTECTED] wrote:
 
 Hello Wendy,
 I missed one point of your statement..
 
  logic:present name=${sessionScope.results}
 
 Even if you're going to use an expression, the 'name' attribute should
 still
 evaluate to the _name_ of the bean, not the bean itself.
http://struts.apache.org/userGuide/struts-logic.html#present
 
 what do you mean? If I store the bean under the attribute name 'result',
 why
 the above EL is wrong?

What you want is:
logic:present name=results scope=session

This will check for a bean stored under the name 'results' in session scope.

${sessionScope.results} evaluates to the bean itself.  The logic tag
receives *that bean* where before it received a String.  I believe
that the logic tag would then convert that bean to a String and look
for an object stored under that name, instead.

Instead of dealing with all of this, just try the following JSTL:

c:if test=${not empty sessionScope.results}

-- Jeff

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



Re: JSF is the beginning of the end of Struts !!!

2005-07-28 Thread Dakota Jack
[EMAIL PROTECTED] is the lead?  Cool!

On 7/25/05, John Public [EMAIL PROTECTED] wrote:
 After just finishing my JSF class, I can confidently
 confirm that JSF will eventually lead to Struts
 becoming OBSOLETE. Make no mistake about it. JSF
 rocks. JSF is based on true MVC architecture, not
 the MODEL 2 version that Struts uses. Struts had a
 good run, now it is time to build on the JSF
 foundation. JSF is the ONLY foundation that can
 compete witn ASP.NET 2.0 at this time. Let's all get
 behind JSF before MS takes over the web. Hopefully
 Tool Vendors will harness JSF potential and make
 Front-end web dev as easy as VS 2005 does. Time is not
 on our side. Let's get busy !!!
 
 J.J.
 JSF Developer (former Struts Lead Developer)
 
 
 
 
 
 Start your day with Yahoo! - make it your home page
 http://www.yahoo.com/r/hs
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
You can lead a horse to water but you cannot make it float on its back.
~Dakota Jack~

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



Re: UrlValidator (why not use java.net.URL?)

2005-07-28 Thread Marc Logemann

Hi,

after looking into the code of UrlValidator and moreover looking into a 
similar class in Tapestry which is no longer active as it seems, i 
wonder why commons-validator UrlValidator is using Regex so much. 
Wouldnt it be enough to just use java.net.URL and let this class do the 
verification? Of course i am not quite sure how it deals non-schema URLs 
but for complete URLs to verifiy, its perhaps a better choice.


Perhaps this one is for the developer list but i try it here first ;-)




Lindholm, Greg wrote:

I encountered this awhile back but didn't have time to investigate.
As a workaround I use the localhost IP address 127.0.0.1 but it
would be nice to get this fixed.
 


-Original Message-
From: Marc Logemann [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 28, 2005 8:33 AM

To: user@struts.apache.org
Subject: UrlValidator

Hi,

can it be that UrlValidator from Commons-Validator doesnt validate URLs 
with localhost in it?


The following URL - http://localhost:8081/context/jsp/versand_1.jsp



--
regards
Marc Logemann
[blog] http://www.logemann.org
[busn] http://www.logentis.de


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



Re: JSF is the beginning of the end of Struts !!!

2005-07-28 Thread Dakota Jack
Struts could live by improving in ways unlikely with the present
management.  The people in charge of Struts these days are really
interested in something else.  Unless the baton passes to those
actively building something, Struts likely will either die from be
non-competitive with like products or from being turned into something
it is not, like JSF, Shale, Clay, Dirt.

On 7/26/05, Greg Reddin [EMAIL PROTECTED] wrote:
 Interesting this discussion would come up now.  I've been in and out of
 Struts for about 5 years.  I'm now coming back in and taking interest in
 JSF/Shale, etc.  A few of points to think about:
 
 1.  Struts will someday die.  If it doesn't, then we've seen the end of
 technology advancement.  If those of us who love Struts and what it
 provides want to continue to have influence going forward, we have to be
   ready to embrace the next thing that's better than Struts and add
 value there.  Staying with something because of familiarity is typically
 the road to becoming a dinosaur in technology.
 
 2.  I only started studying JSF seriously about 2 weeks ago. From what
 I've seen it takes the best things Struts offers and brings them into a
 somewhat cleaner package.  Those things are:
 
 *  Nice HTML tag library.
 *  Auto-populating of form beans.
 *  Simple controller interface.
 
 It also expands on these things by making the view easier to develop,
 less restriction on how form beans and controllers are developed, and
 some other really interesting services that I've only begun to play
 with.  To sum it up, using JSF out of the box I can do most of what I
 can with Struts, only quicker and with less code.  I see JSF as the next
 step of Struts.  But it's still not complete.  I'm only beginning to see
 what Shale adds to JSF and am following Shale with great interest.
 
 3.  PHP.  I've done some PHP over the last couple years.  I'm by no
 means an expert, but I do know my way around somewhat.  The whole time
 I've caught myself thinking if I was in Java I'd have a better way to do
 just about everything.  But most of the better way is because of the
 J2EE APIs, Struts, and Tiles.  The language is a bit more cumbersome
 than Java and it's much more difficult to modularize.  I find PHP is
 easier (to me) if I don't try to make things elegant, but just spew
 code to some extent.  I finally found a CMS to use as a Struts-like
 framework, but I still find Java/Struts and now JSF to be better,
 cleaner, and more modular.  I am now trying to figure out a way to do my
 future on-the-side consulting in Java instead of PHP.
 
 I think another of PHPs success factors has to do with its acceptance
 from the open source community.  Somehow Java has had a somewhat tainted
 reputation due to the lack of a truly open complete implementation --
 and probably some are just bitter that Sun hasn't opened the whole thing
 up.  I don't personally have anything to contribute to that debate, but
 I suspect it's a factor in why PHP has been so widely embraced on the
 web compared to Java.
 
 So all in all, it doesn't much matter to me if JSF supercedes Struts.
 If it's better, then it should.  If we get behind Shale it think we can
 have our cake and eat it too.
 
 BTW, for JSF info, try MyFaces.  Their Getting Started section points to
 some pretty good tutorials.  In short testing I've found the myfaces
 implementation to be pretty stable.  I'm actually surprised Craig is not
 listed as a contributor to that project.
 
 That's my 50 cents.
 Greg
 
 Daniel Perry wrote:
  Sorry for the OT postings.
 
  My point was that you cant compare usage of PHP with Struts.
 
  The number of Struts sites (or even java sites) will never overtake the
  number of PHP sites for the reasons i pointed out (although... zend are
  doing their best to kill off php by trying to move it into the enterprise
  arena and tying it with java).  But for those same reasons, comparing the
  two is useless.
 
  As for JSF... It seems like a nice idea, but i havnt fully got my head round
  it.  I cant see it killing off struts in the short term (just look at daily
  rate of postings on this list!!!) I do like the idea of replacing struts
  html tags with JSF.  I certainly think JSTL/EL are nicer than the logic
  tags.
 
  I now have a dilema... I'm just about to start on another project.  What
  technologies do i use?
 
  I guess i'll probably stick with struts.  Though i may dabble with JSF a
  bit.
 
  Can anyone recommend any good resources? Sure a google search provides tons
  of information... but which is any good?
 
  Daniel.
 
 
 -Original Message-
 From: Mark Benussi [mailto:[EMAIL PROTECTED]
 Sent: 26 July 2005 10:38
 To: 'Struts Users Mailing List'
 Subject: RE: Re: JSF is the beginning of the end of Struts !!!
 
 
 No offence but this is a daft conversation that I have seen too
 many times.
 Say Struts is dead to a certain Blue vendor who has just releases their
 latest Portal server which is built on Struts and they may 

Re: Path like urls with objects' OIDs: /objects/object/17/198/4 possible?

2005-07-28 Thread Dave Newton

Tomasz Nazar wrote:


But: I'd like to have something more prettier:

Say: /context/emplyee/17

Or even more: /context/archive/1998/employee/tomasz/tasks/7


Can you point me where to look for this? Is there any standard
option for that; some URL pattern rewriting or God knows what.

Do I have to write my own implementation of some method/class and
then parse the url, set proper parameters and pass over to Struts
(dispatcher?) ?
 

I suspect there are (substantially :) better ways to do what I did, but 
here's one option:


- Use wildcard mappings to point to an action
- That action splits the URL based on whatever you need to accomplish (I 
had a basic /admin/${table}[/${command}[/${identifier}]] structure)
- The action retrieves a previously-initialized hash of ${command} = 
command-handler-classes
- The command-handler-classes extended a base class that Did the Right 
Thing for simple database cases (generic CRUD) and povided hooks for 
specialized form initialization stuff (like populating a drop-down list 
for foreign keys, whatever).
- Somewhere in there I had a way to instantiate appropriate classes to 
represent the form and DTOs (the only form bean I have in my struts 
config looks like this:


 form-beans
   !-- Mysterious, huh? --
   form-bean name=adminForm 
type=org.apache.struts.validator.DynaValidatorActionForm/

 /form-beans

Hrm... uh. Ah, here we go: I have a request processor that automagically 
instantiates ActionForm subclasses based on the ${table} wildcard value. 
I vaguely remember digging through source code and needing to have the 
dummy entry (the action discussed above has the dummy form as its 'name' 
attribute) but I don't recall why.


I was playing with Spring for IoC so ended up  using that for a lot of 
configuration; I could make fairly substantial changes in functionality 
without having to touch the actual webapp code--neato.


Then they yelled at me for not doing billable work and I had to stop; 
another couple of weeks and it would have been a poor duplicate of code 
that already exists in the wild.


Sorry for the ramble--I'm motivated to work on that code again now, though!

Dave



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



RE: multipart request issues

2005-07-28 Thread Paul McCulloch
You're theory is correct. The input stream is consumed as it is parsed.

The process flow doesn't seem to match what I'm seeing (Struts 1.2.4). In
1.2.4 all off this is handled in the request processor - not the servlet.
The very first thing the request processor does (in processMultipart) is to
parse the input stream and put all of the request paramaters in the wrapped
request object.

You can access these with a simple request.getParamater() in
processPreprocess in your extended request processor.

There is still a problem with multipart requests in that the parameters are
never available in JSPs, as they get the original (rather than the wrapped)
request. I overcome this by coppying the paramaters into a request scoped
map.

Hope this is of some use.

Paul


 -Original Message-
 From: Carl Smith [mailto:[EMAIL PROTECTED]
 Sent: 28 July 2005 15:38
 To: user@struts.apache.org
 Subject: multipart request issues
 
 
 
 I am having issues to get the request parameters from a 
 multipart request, le me explain my problem first:
 
 Our flow of process is:
 
 (1) a multipart request is submitted to a struts action 
 (let's say updateTableAction.do) using POST
 
 (2) the multipart request is processed by 
 ActionServlet.process() method
 
 (3) in our processPreprocess method, which overrides 
 processPreprocess in RequestProcessor.java from struts,
 
 we need the parameters from this multipart request thus I am 
 doing this:
 
 CommonsMultipartRequestHandler commonMultiPartHandler = new 
 CommonsMultipartRequestHandler(); 
 
 
 
 try {
 
 commonMultiPartHandler.handleRequest(request);
 
 }catch(Exception e){
 
 // some handling
 
 }
 
 Hashtable ht = commonMultiPartHandler.getTextElements(); // 
 thus I get the parameters from the request
 
 (4) however, all the fields/parameters in multipart request 
 are no longer there in the updateTableAction.do
 
 Can you help me find out why this is happening? One theory is 
 that a multipart request can't be parsed twice. Is this 
 correct, if it is correct, do you have any alternative?
 
 Thanks.
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 

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


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



Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Tamas Szabo

Hi Rick,

It's past midnight here so I'll check the code tomorrow. A few questions 
though...


1) For one, the business requirement created a bit more complication 
in the filter. For example a check for the session timing out has to 
take place on all pages except for (index.jsp/login/logout/appinuse). 
I'm doing this check in the filter by checking for the session being 
null, but it created complications of when to force a new one, which 
is needed for the 'invalidate' check.


I'd love some help with the ugly logic I have (which I'll post at end 
of this doc). I know it can be cleaned up, but you know how it is when 
your trying a million different if/else things and your brain is 
frazzled:)



Could you clear this situation for me:

User A is using the app, then his session expires.
User B starts to use the app.

User A comes back and want to access a page in the app. Remember that 
his session is expired and User B is already using the app.

You redirect him to index.jsp? Or to appInUse.jsp?

At first I would say that you could use a second filter which checks for 
expired session.

This way the situation will be clear.
One filter limits the sessions the other filter checks for timeouted 
sessions.



2) I noticed a lot of odd behavior when the server was shut down and 
the pages were still up. For example, if the user was left on a page 
that displayed a log off link and the server was restarted, when 
they then clicked on log off (which calls session invalidate) it would 
decrement the sessionCounter to -1. I'm not sure how sessionDestroyed 
could get called before sessionCreated, but I guess it can? My hack 
here was to do a check for sessionCount being less than 0 and if so 
reset it to 0.



This is strange. What kind of webcontainer do you use?
At first glance it seems like your web container has a 'feature' to 
serialize sessions on stop and to recreate them when you start the 
server again.
In this case the sessionCounter would be set to 0 on restart but the 
session would be recreated = no sessionCreated() executed, just

sessionDestroyed() on logout...

3) Using [EMAIL PROTECTED] session=false % didn't seem to call the 
sessionDestroyed method, which I really need to have happen when they 
hit the logoff and appinuse.jsp. I went back to using % 
session.invalidate(); % (I haven't looked at the docs on 
session=false for JSPs does that just make sure a new Session isn't 
created?)



If you use
[EMAIL PROTECTED] session=false %
your session implicit object will not be initialized.

If you use
[EMAIL PROTECTED] session=true %

in the translated servlet you will have a line:
session = request.getSession();

So if you want to use session.invalidate() you cannot use [EMAIL PROTECTED] 
session=false %.


I used [EMAIL PROTECTED] session=false % only in appInUse, not in logoff.
I used it because otherwise a new session will be created when you 
redirect to the appinuse.jsp from the filter.
The session will be flagged for invalidation, but because we just let 
through all the request to appInUse.jsp

in the filter the sesiion will not be invalidated.


OK here is the filter that I'd love some clean up on. There must be a 
way to make this less ugly...you can try this link to see the full 
version:



I will check it tomorrow...sorry

Tamas

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



Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Rick Reumann

Tamas Szabo wrote the following on 7/28/2005 12:51 PM:


Could you clear this situation for me:

User A is using the app, then his session expires.
User B starts to use the app.

User A comes back and want to access a page in the app. Remember that 
his session is expired and User B is already using the app.

You redirect him to index.jsp? Or to appInUse.jsp?


He should go to appInUse.jsp BUT

if A's session has expired and no one else is using the app (B didn't 
log in), user A should go to index.jsp - this is a bit confusing since 
in order to determine if he can go to index.jsp we need to make him have 
a session - which is why path checking needs to take place to dictate 
what should/shouldn't be done.


At first I would say that you could use a second filter which checks for 
expired session.

This way the situation will be clear.
One filter limits the sessions the other filter checks for timeouted 
sessions.


That would probably be a good idea to use two filters vs doing it all in 
one. Although it could also be nice to see all that happens for each 
request by looking in just one filter vs two.


2) I noticed a lot of odd behavior when the server was shut down and 
the pages were still up. For example, if the user was left on a page 
that displayed a log off link and the server was restarted, when 
they then clicked on log off (which calls session invalidate) it would 
decrement the sessionCounter to -1. I'm not sure how sessionDestroyed 
could get called before sessionCreated, but I guess it can? My hack 
here was to do a check for sessionCount being less than 0 and if so 
reset it to 0.



This is strange. What kind of webcontainer do you use?
At first glance it seems like your web container has a 'feature' to 
serialize sessions on stop and to recreate them when you start the 
server again.
In this case the sessionCounter would be set to 0 on restart but the 
session would be recreated = no sessionCreated() executed, just

sessionDestroyed() on logout...


Possibly that is what is happening. The scenario where I noticed this 
was using JBoss (Tomcat as the app server in JBoss).


OK here is the filter that I'd love some clean up on. There must be a 
way to make this less ugly...you can try this link to see the full 
version:



I will check it tomorrow...sorry


No problem. I appreciate all your help so far.


--
Rick

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



Re: bean traversal question

2005-07-28 Thread Werner Punz

Michael Jouravlev wrote:



There are no standard ways to do this. Creating wizards myself, I was
thinking about some kind of garbage collector for session object. This
project: http://wfnm.sourceforge.net/ seems to have this feature. It
has some other features so I don't know can you pull out the session
garbage collection feature only or not. I guess not, because it
detects garbage in relation to the flow. Thus seems that you have to
define the flow, which is unfortunate. Anyway, I did not really use
this project, so you may try and report results ;-)


just checked it out, looks exactly like what I need...

I will give it a try, once I reach the point where I need it
(which will come in a few days)

thanks for pointing me towards it.

Werner


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



Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Gonzalez Aleksander
Hello,

I cannon run an application
The error that I get when i asm going to run the
apllication is

type Status report

message Servlet action is currently unavailable

description The requested service (Servlet action is
currently unavailable) is not currently available.

It doesn{to procees my transaciton.


The web.xml file is:


?xml version=1.0 encoding=ISO-8859-1?



!DOCTYPE web-app

  PUBLIC -//Sun Microsystems, Inc.//DTD Web
Application 2.2//EN

  http://java.sun.com/j2ee/dtds/web-app_2_2.dtd;



web-app





  !-- Action Servlet Configuration --

  servlet

servlet-nameaction/servlet-name

   
servlet-classorg.apache.struts.action.ActionServlet/servlet-class

init-param

  param-nameconfig/param-name

 
param-value/WEB-INF/struts-config.xml/param-value

/init-param

load-on-startup1/load-on-startup

  /servlet



  !-- Action Servlet Mapping --

  servlet-mapping

servlet-nameaction/servlet-name

url-pattern*.do/url-pattern

  /servlet-mapping



  !-- The Usual Welcome File List --

  welcome-file-list

welcome-fileindex.jsp/welcome-file

  /welcome-file-list





  !-- Struts Tag Library Descriptors --

  taglib

taglib-uri/tags/struts-bean/taglib-uri

   
taglib-location/WEB-INF/struts-bean.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-html/taglib-uri

   
taglib-location/WEB-INF/struts-html.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-logic/taglib-uri

   
taglib-location/WEB-INF/struts-logic.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-nested/taglib-uri

   
taglib-location/WEB-INF/struts-nested.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-template/taglib-uri

   
taglib-location/WEB-INF/struts-template.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-tiles/taglib-uri

   
taglib-location/WEB-INF/struts-tiles.tld/taglib-location

  /taglib



/web-app




and the struts-config.xml is:


?xml version=1.0 encoding=ISO-8859-1 ?



!DOCTYPE struts-config PUBLIC

  -//Apache Software Foundation//DTD Struts
Configuration 1.1//EN

 
http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;





struts-config



!--  Data Source
Configuration --

 data-sources



   data-source

 set-property

property=autoCommit

value=true/

 set-property

property=description

value=Configuración de la Base de Datos del
Sistema/

 set-property

property=driverClassName

value=org.postgresql.Driver/

 set-property

property=maxCount

value=100/

 set-property

property=minCount

value=2/

 set-property

property=url
value=jdbc:postgresql://159.90.16.8/oest4/

  set-property

   property=username

   value=postgres/
  set-property

   property=password

   value=postgres/

   /data-source



 /data-sources







!--  Form
Bean Definitions --



form-beans



   form-bean

name=validacionForm

   
type=dide.bienestar.usuario.form.ValidacionForm /

   form-bean

name=usuarioForm

   
type=dide.bienestar.usuario.form.UsuarioForm /

   form-bean

name=presolicitudForm

   
type=dide.bienestar.solicitud.form.PresolicitudForm
/

   form-bean

name=solicitudForm

   
type=dide.bienestar.solicitud.form.SolicitudForm /

   form-bean

name=familiarForm

   
type=dide.bienestar.solicitud.form.FamiliarForm /

   form-bean

name=exoneracionForm

   
type=dide.bienestar.solicitud.form.ExoneracionForm
/

   form-bean

name=exoneracion1Form


type=dide.bienestar.solicitud.form.Exoneracion1Form
/

   form-bean

name=estudianteForm


type=dide.bienestar.estudiante.form.EstudianteForm
/

   form-bean

name=observacionesForm


type=dide.bienestar.solicitud.form.ObservacionesForm
/

   form-bean

name=analisisForm


type=dide.bienestar.solicitud.form.AnalisisForm /

   form-bean

name=exoneracionesForm


type=dide.bienestar.beneficios.form.ExoneracionesForm
/  

   form-bean

name=anularForm


type=dide.bienestar.beneficios.form.AnularForm / 

   form-bean

name=cestaForm


type=dide.bienestar.metodologia.form.CestaForm /

   form-bean

name=ingresosForm


type=dide.bienestar.metodologia.form.IngresosForm /

   form-bean

name=claseForm


type=dide.bienestar.metodologia.form.ClaseForm /

/form-beans





!-- === Global
Forward Definitions --



global-forwards



forward

  

Please i caanot run this

2005-07-28 Thread Gonzalez Aleksander


--- Tamas Szabo [EMAIL PROTECTED] wrote:

 Hi Rick,
 
 It's past midnight here so I'll check the code
 tomorrow. A few questions 
 though...
 
  1) For one, the business requirement created a bit
 more complication 
  in the filter. For example a check for the session
 timing out has to 
  take place on all pages except for
 (index.jsp/login/logout/appinuse). 
  I'm doing this check in the filter by checking for
 the session being 
  null, but it created complications of when to
 force a new one, which 
  is needed for the 'invalidate' check.
 
  I'd love some help with the ugly logic I have
 (which I'll post at end 
  of this doc). I know it can be cleaned up, but you
 know how it is when 
  your trying a million different if/else things and
 your brain is 
  frazzled:)
 
 
 Could you clear this situation for me:
 
 User A is using the app, then his session expires.
 User B starts to use the app.
 
 User A comes back and want to access a page in the
 app. Remember that 
 his session is expired and User B is already using
 the app.
 You redirect him to index.jsp? Or to appInUse.jsp?
 
 At first I would say that you could use a second
 filter which checks for 
 expired session.
 This way the situation will be clear.
 One filter limits the sessions the other filter
 checks for timeouted 
 sessions.
 
 
  2) I noticed a lot of odd behavior when the server
 was shut down and 
  the pages were still up. For example, if the user
 was left on a page 
  that displayed a log off link and the server was
 restarted, when 
  they then clicked on log off (which calls session
 invalidate) it would 
  decrement the sessionCounter to -1. I'm not sure
 how sessionDestroyed 
  could get called before sessionCreated, but I
 guess it can? My hack 
  here was to do a check for sessionCount being less
 than 0 and if so 
  reset it to 0.
 
 This is strange. What kind of webcontainer do you
 use?
 At first glance it seems like your web container has
 a 'feature' to 
 serialize sessions on stop and to recreate them when
 you start the 
 server again.
 In this case the sessionCounter would be set to 0 on
 restart but the 
 session would be recreated = no sessionCreated()
 executed, just
 sessionDestroyed() on logout...
 
  3) Using [EMAIL PROTECTED] session=false % didn't seem to
 call the 
  sessionDestroyed method, which I really need to
 have happen when they 
  hit the logoff and appinuse.jsp. I went back to
 using % 
  session.invalidate(); % (I haven't looked at the
 docs on 
  session=false for JSPs does that just make sure
 a new Session isn't 
  created?)
 
 If you use
 [EMAIL PROTECTED] session=false %
 your session implicit object will not be
 initialized.
 
 If you use
 [EMAIL PROTECTED] session=true %
 
 in the translated servlet you will have a line:
 session = request.getSession();
 
 So if you want to use session.invalidate() you
 cannot use [EMAIL PROTECTED] 
 session=false %.
 
 I used [EMAIL PROTECTED] session=false % only in appInUse,
 not in logoff.
 I used it because otherwise a new session will be
 created when you 
 redirect to the appinuse.jsp from the filter.
 The session will be flagged for invalidation, but
 because we just let 
 through all the request to appInUse.jsp
 in the filter the sesiion will not be invalidated.
 
 
  OK here is the filter that I'd love some clean up
 on. There must be a 
  way to make this less ugly...you can try this link
 to see the full 
  version:
 
 I will check it tomorrow...sorry
 
 Tamas
 

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


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: String concatenation

2005-07-28 Thread Konrad Billewicz
 I'm not sure I've understood correctly what you want to do, but here's 
 what I would do :
 
 bean:define
id=myBean
value=%= SomeConstantsHolderClass.CONSTANT_STRING + 
 SomeConstantsHolderClass.CONSTANT_STRING % /
 
 html:form action=%= action %
 ...

It's not exactly what I expected, but it's better solution than mine. Ideally I 
thought about complete aviodance of % and % tags. I wish to use only Struts 
tags in order to concatenate two strings and put them as an action property for 
html:form tag. Is it possible?

I thought that using % and % in Struts-driven applications is rather bad idea 
for common things. Such form action with parameter is probably common thing... 
Was I right?

Best regards,
Konrad Billewicz







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



Re: JSF is the beginning of the end of Struts !!!

2005-07-28 Thread John Henry Xu
I mapped to .html but not .asp, and I doubt many people would map java
apps to .php, .asp or .aspx in hosting companies (Of course u can
technically but I can not see the benefit). That's why I assume if I see
.php, I know it is php site with 99% confidence.

The reason for our mapping to html was that this page is rather stable
and I don't change their contents over time (in general). And for
security reason as Stéphane said. For PHP and perl it is very simple to
do that. For java it is a little more difficult but manageable. It can
give you more URL addresses as Neil said.

As for jsf, is it .jspx? or maybe mapping to others? It is possible jsf
maps to html. jsf using .aspx? It is unthinkable even technically
possible.

John H. Xu

  - Original Message -
  From: Neil Erdwien
  To: Struts Users Mailing List
  Subject: Re: JSF is the beginning of the end of Struts !!!
  Date: Thu, 28 Jul 2005 11:01:29 -0500

  
   I presume preserving URLs is the reason to map one technology's
   default extention to another. For example, if you have a static
   web site with files than end in .html, and switch to Java/Struts,
   then you can map *.html to the Struts' action servlet.
  
   The end users' bookmarks don't have to change, but you're really
   running a Struts action under the covers.
  
  
   Stéphane Zuckerman wrote:
John Henry Xu a écrit :
   
Actually, my favorite sites are the
   
   
ones that map *.asp to the Struts servlet. Gotta love people
  that
bend minds like that!
   
   
   
   
I cannot imagine what motivates people tried to map there
  servlets to
.asp. Even I could easily map my site to .aspx, I would not do
  that.
Although I respect MS, I am not really a huge fun of Microsoft.
  If I
implement sites with Java, I want java take credits. If I
  implement sites
in PHP, I want PHP take credits, I would not map that to .asp.
  If I use
.net, I don't map it to jsp also. If I saw a site ends with .php
  or
.aspx, I assume that was a php and .net site, and I belieave I
  am right
on that with 99% confidence.
   
   
I guess this is against wannabe crackers. Yes, yes, I know,
  security
through obscurity, blah blah blah... Well, once you've done
  everything
that isn't obfuscation-related, there is only obscurity that
  remains,
and frankly, it does help gain a few {minutes,hours} before the
  nasty
black hats break the server. :-)
   
  
   -- Neil Erdwien, [EMAIL PROTECTED], Web Technologies Manager
   Computing and Network Services, Kansas State University
  
  
  -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]






John H. Xu


http://www.usanalyst.com 

http://www.GetusJobs.com (The largest free job portal in North America)

-- 
___
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm



Re: String concatenation

2005-07-28 Thread Konrad Billewicz

  do you need to put dictionaryId to querystring?
  i come up with
  html:form action=createDictionaryEntity
 input type=hidden name=dictionaryId value=bean:write 
 name=dictionaryId/
  as an alternative

It is a good idea. But... shouldn't I avoid using non-Struts HTML form tags in 
Struts-driven applications? I am quite new in Struts and I don't want to get 
bad 
habits. :-)

Best regards,
Konrad Billewicz





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



Re: bean traversal question

2005-07-28 Thread Werner Punz

Michael Jouravlev wrote:

On 7/28/05, Werner Punz [EMAIL PROTECTED] wrote:


I after Wendy gave me the advice to rephrase the question I will try to
rephrase it.

Being new to struts, I want to know how people deal with data objects
which need a scope bigger than request but smaller than session.



There are no standard ways to do this. Creating wizards myself, I was
thinking about some kind of garbage collector for session object. This
project: http://wfnm.sourceforge.net/ seems to have this feature. It
has some other features so I don't know can you pull out the session
garbage collection feature only or not. I guess not, because it
detects garbage in relation to the flow. Thus seems that you have to
define the flow, which is unfortunate. Anyway, I did not really use
this project, so you may try and report results ;-)

Actually I was thinking also along the lines of having some kind of 
garbage collecting mechanism.
I did something like that in JSF very easy (reprogrammed parts of the 
x:saveState)
the trick was to push the object into the session with some kind of key 
which stores the current and the old session and at the end of each 
rendering cycle (which is the problem because struts behaves totally 
different)



I basically dumped the objects from the old url and pushed the newly
registrated ones into the central object storage.

That trick worked very well, because you have clear distinctive phases 
in JSF which mark the before assigning the data part and the after 
rendering part of the request and you already have a save and restore 
mechanism on component level which utilizes those two phases.


I tried to move over a similar mechanism in Struts, but basically failed 
due to time constraints, which I cannot resolve by technical means ;-)



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



Gonzalez's question posted as new thread:

2005-07-28 Thread Rick Reumann

Aleksander Gonzalez,

It's a very bad idea to hi-jack a thread by replying to it and changing 
the content. (ref: probably a cleaner way..testing for one user). Here 
is the question that you asked in the hijacked thread that I'm posting 
new. But as far as an answer goes to your question, you need to look in 
your server logs for a hint as to what the problem is.


Aleksnader's post:


Hello,

I cannon run an application
The error that I get when i asm going to run the
apllication is

type Status report

message Servlet action is currently unavailable

description The requested service (Servlet action is
currently unavailable) is not currently available.

It doesn{to procees my transaciton.


The web.xml file is:


?xml version=1.0 encoding=ISO-8859-1?



!DOCTYPE web-app

  PUBLIC -//Sun Microsystems, Inc.//DTD Web
Application 2.2//EN

  http://java.sun.com/j2ee/dtds/web-app_2_2.dtd;



web-app





  !-- Action Servlet Configuration --

  servlet

servlet-nameaction/servlet-name


servlet-classorg.apache.struts.action.ActionServlet/servlet-class

init-param

  param-nameconfig/param-name


param-value/WEB-INF/struts-config.xml/param-value

/init-param

load-on-startup1/load-on-startup

  /servlet



  !-- Action Servlet Mapping --

  servlet-mapping

servlet-nameaction/servlet-name

url-pattern*.do/url-pattern

  /servlet-mapping



  !-- The Usual Welcome File List --

  welcome-file-list

welcome-fileindex.jsp/welcome-file

  /welcome-file-list





  !-- Struts Tag Library Descriptors --

  taglib

taglib-uri/tags/struts-bean/taglib-uri


taglib-location/WEB-INF/struts-bean.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-html/taglib-uri


taglib-location/WEB-INF/struts-html.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-logic/taglib-uri


taglib-location/WEB-INF/struts-logic.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-nested/taglib-uri


taglib-location/WEB-INF/struts-nested.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-template/taglib-uri


taglib-location/WEB-INF/struts-template.tld/taglib-location

  /taglib



  taglib

taglib-uri/tags/struts-tiles/taglib-uri


taglib-location/WEB-INF/struts-tiles.tld/taglib-location

  /taglib



/web-app




and the struts-config.xml is:


?xml version=1.0 encoding=ISO-8859-1 ?



!DOCTYPE struts-config PUBLIC

  -//Apache Software Foundation//DTD Struts
Configuration 1.1//EN


http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;





struts-config



!--  Data Source
Configuration --

 data-sources



   data-source

 set-property

property=autoCommit

value=true/

 set-property

property=description

value=Configuración de la Base de Datos del
Sistema/

 set-property

property=driverClassName

value=org.postgresql.Driver/

 set-property

property=maxCount

value=100/

 set-property

property=minCount

value=2/

 set-property

property=url
value=jdbc:postgresql://159.90.16.8/oest4/

  set-property

   property=username

   value=postgres/
  set-property

   property=password

   value=postgres/

   /data-source



 /data-sources







!--  Form
Bean Definitions --



form-beans



   form-bean

name=validacionForm


type=dide.bienestar.usuario.form.ValidacionForm /

   form-bean

name=usuarioForm


type=dide.bienestar.usuario.form.UsuarioForm /

   form-bean

name=presolicitudForm


type=dide.bienestar.solicitud.form.PresolicitudForm
/

   form-bean

name=solicitudForm


type=dide.bienestar.solicitud.form.SolicitudForm /

   form-bean

name=familiarForm


type=dide.bienestar.solicitud.form.FamiliarForm /

   form-bean

name=exoneracionForm


type=dide.bienestar.solicitud.form.ExoneracionForm
/

   form-bean

name=exoneracion1Form


type=dide.bienestar.solicitud.form.Exoneracion1Form
/

   form-bean

name=estudianteForm


type=dide.bienestar.estudiante.form.EstudianteForm
/

   form-bean

name=observacionesForm


type=dide.bienestar.solicitud.form.ObservacionesForm
/

   form-bean

name=analisisForm


type=dide.bienestar.solicitud.form.AnalisisForm /

   form-bean

name=exoneracionesForm


type=dide.bienestar.beneficios.form.ExoneracionesForm
/   

   form-bean

name=anularForm


type=dide.bienestar.beneficios.form.AnularForm /

   form-bean

name=cestaForm


type=dide.bienestar.metodologia.form.CestaForm /

   form-bean

name=ingresosForm



RE: [OT] Hibernate vs. iBatis vs. POJO

2005-07-28 Thread Hernandez, Mariano
I've work for the USPS for 3 years and now work for the DOD. At the PO we
moved from pojos to iBatis, although there was another team trying to get
Hibernate going. Now with the DOD, we use EJBs, although I and a colleague
have tried to persuade our architech to use ANYTHING other than EJBs. I
don't think this fully answers your question but it's a start. 

Mariano Hernandez

-Original Message-
From: Access Denied [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 22, 2005 8:50 AM
To: Struts Users Mailing List; Ed Griebel
Subject: Re: [OT] Hibernate vs. iBatis vs. POJO

I bought James Elliott's Hibernate (O'Reilly Developer Notebook
Series 2004), but a search for iBATIS on amazon returns books like
Pocket Guide to the Birds of Britain and North-West Europe and An
Introduction To The Mystical Use of Classical Persian Poems.  Is
there any timely definitive literature available for iBATIS?  In this
realm, at least, it looks like Hibernate rules.

I have also recently noticed that any job opportunities specifying a
java persistence technology requires Hibernate; I have yet to run
across any requirements for iBATIS.  Does Hibernate dominate in
business and government, too?

It has also been my general experience that clients demand impossible
deadlines, mainly, I think, because most do not have a clue when it
comes to SDLC and due diligence.  I've worked at many companies and
agencies over the years and changing jobs has not changed the lack of
appreciation for the SDLC outside of IT.  The comment that
contractors are assumed to already know the technology is true; the
facts of tech life is anathema to this assumption.  For a personal
example, I was using java 1.2 and struts 1.0 on my last java job, but
now with java 5.0, struts 1.2 and spring, the landscape has changed
dramatically.  We have no choice but to learn new stuff by the seat of
our pants.

~buddy

On 7/22/05, Ed Griebel [EMAIL PROTECTED] wrote:
 All too often that's how it works. If you say no, there are people
 that will say yes. Even if they end up taking as much time as you said
 it would, they've got the project, not you. Sometimes the short time
 is understandable, possibly due to uncontrollable situations, but most
 of the time it's due to poor (or too much!) planning. Many times the
 situation described below is a start to negotiations on budget, scope,
 resources, etc., but not always :-)
 
 -ed
 
 On 7/22/05, netsql [EMAIL PROTECTED] wrote:
  Frank W. Zammetti wrote:
  It has not been unusual to estimate three months
   for something, and that's fairly realistic to do it right, and the
   business says nope, 1.5 months is when we need it.
 
 
  I need you to paint the house, but I only have budget to wash my hair?
 
  That is no respect and a bit like slavery!
 
 
  .V
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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

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



Filtering bean properties

2005-07-28 Thread Konrad Billewicz
I have a report with a huge number of columns (about 150). In the prior form 
user can choose some of them. My current task is to show only choosen columns 
in 
the report. I'm unexpectedly uncertain how to do it elegantly (using, of 
course, 
Struts). The current version of this huge result page (showing all colums) is 
similar to this:

table
tr
tdbAgreement type/b/td
tdbAgreement symbol/b/td

!-- many, many (about 150) other columns) --

/tr

logic:iterate name=treaties id=treaty scope=request

tr
td
bean:write name=treaty property=agreementType/
/td
td
bean:write name=treaty property=agreementSymbol/
/td

!-- many, many (150 too) values, mostly String and Date objects  --

/tr

In my opinion reports are quite common, so it should be a quite common problem. 
How would you handle it?

Best regards,
Konrad Billewicz



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



Re: String concatenation

2005-07-28 Thread Dave Newton

Konrad Billewicz wrote:


bean:define
  id=myBean
  value=%= SomeConstantsHolderClass.CONSTANT_STRING + 
SomeConstantsHolderClass.CONSTANT_STRING % /


html:form action=%= action %
   


It's not exactly what I expected, but it's better solution than mine. Ideally I thought 
about complete aviodance of % and % tags. I wish to use only Struts tags in order 
to concatenate two strings and put them as an action property for html:form tag. Is 
it possible?

I thought that using % and % in Struts-driven applications is rather bad idea for common things. Such form action with parameter is probably common thing... 
 

I've never put a parameter in a form's action attribute--why would you 
want to do that? Wouldn't it be much cleaner to use a hidden form field 
with the appropriate parameter name?


So your original example would be (minus whatever silly syntax mistakes 
because I'm groggy):


html:form action=createDictionaryEntity
 html:hidden property=dictionary/
 !-- ... --
/html:form

and whatever loads the form puts the appropriate dictionaryId value into 
the ActionForm?


Dave



[OT] Re: bean traversal question

2005-07-28 Thread Dave Newton

Werner Punz wrote:

I tried to move over a similar mechanism in Struts, but basically 
failed due to time constraints, which I cannot resolve by technical 
means ;-)


If you were Really Good you could. Probably not a pure software 
solution, though, especially if any space-time distortion is involved.


Dave



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



RE: Filtering bean properties

2005-07-28 Thread Johnson, Kaerstin
You could use JSTL if you'd like to check for whether you should print
the column out - something like: 

c:if test=${myParameter==true}tdprint my stuff here/td
/c:if 


Im not sure how to do it with just struts, someone else might know that.




-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Konrad Billewicz
Sent: Thursday, July 28, 2005 2:47 PM
To: user@struts.apache.org
Subject: Filtering bean properties

I have a report with a huge number of columns (about 150). In the prior
form 
user can choose some of them. My current task is to show only choosen
columns in 
the report. I'm unexpectedly uncertain how to do it elegantly (using, of
course, 
Struts). The current version of this huge result page (showing all
colums) is 
similar to this:

table
tr
tdbAgreement type/b/td
tdbAgreement symbol/b/td

!-- many, many (about 150) other columns) --

/tr

logic:iterate name=treaties id=treaty scope=request

tr
td
bean:write name=treaty property=agreementType/
/td
td
bean:write name=treaty property=agreementSymbol/
/td

!-- many, many (150 too) values, mostly String and Date objects  --

/tr

In my opinion reports are quite common, so it should be a quite common
problem. 
How would you handle it?

Best regards,
Konrad Billewicz



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




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



Re: bean traversal question

2005-07-28 Thread Michael Jouravlev
On 7/28/05, Werner Punz [EMAIL PROTECTED] wrote:
 Actually I was thinking also along the lines of having some kind of
 garbage collecting mechanism.
 I did something like that in JSF very easy (reprogrammed parts of the
 x:saveState)
 the trick was to push the object into the session with some kind of key
 which stores the current and the old session and at the end of each
 rendering cycle (which is the problem because struts behaves totally
 different)
 
 
 I basically dumped the objects from the old url and pushed the newly
 registrated ones into the central object storage.
 
 That trick worked very well, because you have clear distinctive phases
 in JSF which mark the before assigning the data part and the after
 rendering part of the request and you already have a save and restore
 mechanism on component level which utilizes those two phases.

You can do the same in Struts. Well, in Struts Dialogs ;-) which like
JSF also has distinctive phases and stores state on server. Actually,
I am going to implement this feature.

The idea is that an action is a web resource. An action can have
multiple states and can reder different pages. The fact that action
mapping can have only one corresponding action form, works pretty
well. I stick all data that I use in a resource, into action form and
set form scope to session. Then I can have a wizard (controlled by a
single action), or a login/logout component. Once I leave that action,
I can simply remove the action form from the session.

I will have to define subsession groups, and each action mapping would
be able to participate in one or more subsessions. Once I leave a
subsession, I can remove an action form with all its corresponding
data.

On a side note, I cannot get why storing data in an action form is
considered wrong, while directly accessing session is OK. I think
quite opposite. I prefer to stick data related to an action, into
action form. It is more controlled, more visible, and then I can
simply remove one action form object from the session to clear the
whole tree.

Michael.

--
Struts Dialogs
http://struts.sourceforge.net/strutsdialogs

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



Re: String concatenation

2005-07-28 Thread Konrad Billewicz
Dave Newton newton at pingsite.com writes:

 I've never put a parameter in a form's action attribute--why would you 
 want to do that? Wouldn't it be much cleaner to use a hidden form field 
 with the appropriate parameter name?
 
 So your original example would be (minus whatever silly syntax mistakes 
 because I'm groggy):
 
 html:form action=createDictionaryEntity
   html:hidden property=dictionary/
   !-- ... --
 /html:form
 
 and whatever loads the form puts the appropriate dictionaryId value into 
 the ActionForm?

I wish to pass the dictionary variable using GET - make it visible in the URL. 

Secondly, this action (createDictionaryEntity) can be accessed both from form 
and from link (using a href=...). I wish to have one, clear method of 
passing parameters to it. Of course, I can at first check the request and 
secondly the form (or inversely) but it is not, in my opinion, elegant 
solution. 
I thing it is not compulsory.

Best regards,
Konrad Billewicz



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



Re: bean traversal question

2005-07-28 Thread Werner Punz

Michael Jouravlev wrote:


On a side note, I cannot get why storing data in an action form is
considered wrong, while directly accessing session is OK. I think


Well it is quite the opposite in JSF... using the session is
sort of a secure source of getting heavy beating (which is half right 
but too extreme), while the so called backend beans are combined

controller/nmodel objects which basically are kept over all phases
of the rendering cycle.

The no use of session if possible results in such things like 
x:saveState which serializes everything to pass data over the

cycle boundaries without having to pass parameters.
An interesting approach if you ask me, but puts too much emphasis on the
serialisation mechanism, a mixed form would be better, where you can 
chose one way or the other.




quite opposite. I prefer to stick data related to an action, into
action form. It is more controlled, more visible, and then I can
simply remove one action form object from the session to clear the
whole tree.

Well a combind form, controller approach is closer to classical UIs than 
the way struts does it. Although I can see the logic behind the approach 
of struts in a http context, it is sort of confusing.




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



RE: Filtering bean properties

2005-07-28 Thread Adrian_Rios
This is the easiest and cleanest way to do this.

If not you could do it with JavaScript, but then again, not the best way!

__

Senior Programmer Analyst, Tax Distributed Systems Development

Tax  Compliance Development, ADP IT

Phone: (909) 592-6411 Ext. 3863

e-mail: [EMAIL PROTECTED]



-Original Message-
From: Johnson, Kaerstin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 28, 2005 12:03 PM
To: Struts Users Mailing List
Subject: RE: Filtering bean properties


You could use JSTL if you'd like to check for whether you should print
the column out - something like: 

c:if test=${myParameter==true}tdprint my stuff here/td
/c:if 


Im not sure how to do it with just struts, someone else might know that.




-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Konrad Billewicz
Sent: Thursday, July 28, 2005 2:47 PM
To: user@struts.apache.org
Subject: Filtering bean properties

I have a report with a huge number of columns (about 150). In the prior
form 
user can choose some of them. My current task is to show only choosen
columns in 
the report. I'm unexpectedly uncertain how to do it elegantly (using, of
course, 
Struts). The current version of this huge result page (showing all
colums) is 
similar to this:

table
tr
tdbAgreement type/b/td
tdbAgreement symbol/b/td

!-- many, many (about 150) other columns) --

/tr

logic:iterate name=treaties id=treaty scope=request

tr
td
bean:write name=treaty property=agreementType/
/td
td
bean:write name=treaty property=agreementSymbol/
/td

!-- many, many (150 too) values, mostly String and Date objects  --

/tr

In my opinion reports are quite common, so it should be a quite common
problem. 
How would you handle it?

Best regards,
Konrad Billewicz



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




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

-
This message and any attachments are intended only for the use of the
addressee and may contain information that is privileged and confidential.
If the reader of the message is not the intended recipient or an authorized
representative of the intended recipient, you are hereby notified that any
dissemination of this communication is strictly prohibited. If you have
received this communication in error, notify the sender immediately by
return email and delete the message and any attachments from your system.



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



Re: Filtering bean properties

2005-07-28 Thread Dave Newton

Konrad Billewicz wrote:


How would you handle it?
 

If the columns are all formatted the same (or even if they're not and 
I'm feeling saucy) I might consider writing a custom tag that does the 
entire report (maybe outputting XML for easy format changes? I dunno) or 
iterating over a collection of columns to show and using existing or 
custom tags to output the appropriate value or table cell.


Or I might just have a million c:if... tags, but I really hate JSP 
pages like that.


Dave



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



bean:write format

2005-07-28 Thread BHansard
Has Anyone used the format attribute to format currency?

I have a property in an ActionForm which will hold a dollar figure and want
to format when displaying.

ie.


listPrice = 930

Need to Display $930.00


or

listPrice = 1299.9

Needs to Display $1,299.90


I have attempted the following

bean:write name=myForm property=listPrice format=\\$\\d+\\.\\d\\d/

but that prints

\$\D+\930.\d\d

not exactly what I was hoping for :)

Re: bean:write format

2005-07-28 Thread BHansard

Never mind was using regular _expression_ formatting,  Needed to use  format=$###,000.00
[EMAIL PROTECTED]








[EMAIL PROTECTED] 
07/28/2005 03:58 PM

Please respond to
Struts Users Mailing List user@struts.apache.org








To
user@struts.apache.org


cc



Subject
bean:write format








Has Anyone used the format attribute to format currency?

I have a property in an ActionForm which will hold a dollar figure and want
to format when displaying.

ie.


listPrice = 930

Need to Display $930.00


or

listPrice = 1299.9

Needs to Display $1,299.90


I have attempted the following

bean:write name=myForm property=listPrice format=\\$\\d+\\.\\d\\d/

but that prints

\$\D+\930.\d\d

not exactly what I was hoping for :)



Re: Filtering bean properties

2005-07-28 Thread Ed Griebel
You could have a collection/array of fields that needed to be
displayed. You would iterate on each record in the result set. For
each row, you would then iterate thru the collection of field names,
using the field name as a key to the record bean. I'd do it
something like below, though there may be some syntax errors
(particularly the c:out line, it's from memory). Again, this only
works if your records are key/value pairs (e.g. a Map) that can be
evaluated by the JSTL and EL.

c:set var=fieldList value=${myFieldList}/
c:set var=records value=${myRecordList}/
...
!-- print out record header --
tr
c:forEach var=field value=${fieldList}
  thc:out value=${field}//th
/c:forEach
/tr
c:forEach var=record items=${records}
  tr
c:forEach var=field items=${fieldList}
  tdc:out value=${record[field]}//td
/c:forEach
  /tr
/c:forEach
...
-ed

On 7/28/05, Dave Newton [EMAIL PROTECTED] wrote:
 Konrad Billewicz wrote:
 
 How would you handle it?
 
 
 If the columns are all formatted the same (or even if they're not and
 I'm feeling saucy) I might consider writing a custom tag that does the
 entire report (maybe outputting XML for easy format changes? I dunno) or
 iterating over a collection of columns to show and using existing or
 custom tags to output the appropriate value or table cell.
 
 Or I might just have a million c:if... tags, but I really hate JSP
 pages like that.
 
 Dave
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: [OT] Hibernate vs. iBatis vs. POJO

2005-07-28 Thread netsql

Hernandez, Mariano wrote:

we use EJBs, although I and a colleague
have tried to persuade our architech to use ANYTHING other than EJBs. 



Consider having a email Dear Achitect, thanks for meeting w/ us, we 
brought you some good reasons not to use EJB; we understand you do want 
to use them. -- just in case it heads south.




--

.V

People are conversing... without posting their email or filling up their
mail box.
roomity.com http://roomity.com/launch.jsp

No sign up to read or search this Rich Internet App.


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



Re: bean traversal question

2005-07-28 Thread Michael Jouravlev
On 7/28/05, Werner Punz [EMAIL PROTECTED] wrote:
 Michael Jouravlev wrote:
 
  On a side note, I cannot get why storing data in an action form is
  considered wrong, while directly accessing session is OK. I think
 
 Well it is quite the opposite in JSF... using the session is
 sort of a secure source of getting heavy beating (which is half right
 but too extreme), while the so called backend beans are combined
 controller/nmodel objects which basically are kept over all phases
 of the rendering cycle.
 
 The no use of session if possible results in such things like
 x:saveState which serializes everything to pass data over the
 cycle boundaries without having to pass parameters.

Ahem, actually I am all in for sessions. I just don't see why it
storing stuff in an action form with session scope is universally
frowned upon, while sticking same stuff directly into session is OK
;-)

Michael

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



Re: bean traversal question

2005-07-28 Thread Rick Reumann

Michael Jouravlev wrote the following on 7/28/2005 4:30 PM:


Ahem, actually I am all in for sessions. I just don't see why it
storing stuff in an action form with session scope is universally
frowned upon, while sticking same stuff directly into session is OK
;-)


Most seem to frown on both scenarios. Personally, I like the Session:) 
The concept of the session cleanup tool has been talked about so many 
times on this list, but I've yet to see an easy implementation of it. 
For me, I'd rather use the Session until some manager starts complaining 
that the app has performance issues (and even then I'd probably add more 
RAM vs throw away my reliance on the Session:)


For a wizard like Werner initially described, I'd use a Session based 
form in a heart-beat. I use session scoped forms and they work wonderfully.


--
Rick

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



Re: bean traversal question

2005-07-28 Thread Rick Reumann

Werner Punz wrote the following on 7/28/2005 11:46 AM:


There are some ways to handle this
a) You can dump anything into the session, which means you run into 
memory problems in the long run.


I use this solution and have yet to run into any sort of memory 
problems. Resources aren't 'that' expensive. Use the Session unless you 
find out you have performance issues.



b) you can put everything into hidden fields, which means you have 
myriads of hidden fields, which is slow and error prone to implement.


Maintenance nightmare.



c) You can try to add the stuff manually to the session and remove it 
later, which also is problematic in case of an error because then you 
have a mem leak caused, by a tangeling object in the session.


Above is talked about a lot on this list, but have yet to see a good 
implementation of it. I think it will be a difficult undertaking and 
could be a pain to configure. The control mechanism will have to figure 
out when and what to clear out of the Session at any given time. Say the 
user clicks on some other link.. that path(I'm assuming) will have to be 
checked to see if it's safe to remove x number of Session based objects. 
I've tossed around with the idea of associating certain 'paths' with a 
Session scoped action form and as each request passes through the main 
filter it would check the path and based on the path and certain objects 
in scope certain ones would be be removed. Seemed like such a pain 
though so I gave up before I even really started on it:)



--
Rick

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



Re: bean traversal question

2005-07-28 Thread Ed Griebel
Rick-

I'm faced with this same problem on a new project and have been
thinking along these same lines. What kind of issues have you run
into? The kind of things that I see being a problem is specifying
which sets of actions are associated with what items in a session, and
which sets of actions are resumable and which ones clear state if one
navigates away from the path. Oh yeah, and the general mechanism used
to store information, is it one big bean or a session, but that's
almost trivial compared to the other things I mentioned.

Note I've purposefully avoided mentioning the W [wizard] word :-)

-ed

On 7/28/05, Rick Reumann [EMAIL PROTECTED] wrote:
 Werner Punz wrote the following on 7/28/2005 11:46 AM:
 
  c) You can try to add the stuff manually to the session and remove it
  later, which also is problematic in case of an error because then you
  have a mem leak caused, by a tangeling object in the session.
 
 Above is talked about a lot on this list, but have yet to see a good
 implementation of it. I think it will be a difficult undertaking and
 could be a pain to configure. The control mechanism will have to figure
 out when and what to clear out of the Session at any given time. Say the
 user clicks on some other link.. that path(I'm assuming) will have to be
 checked to see if it's safe to remove x number of Session based objects.
 I've tossed around with the idea of associating certain 'paths' with a
 Session scoped action form and as each request passes through the main
 filter it would check the path and based on the path and certain objects
 in scope certain ones would be be removed. Seemed like such a pain
 though so I gave up before I even really started on it:)
 
 
 --
 Rick


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



Re: bean traversal question

2005-07-28 Thread erikweber
1) I use session-scoped ActionForms with extra fields plenty (in search 
scenarios for example, where the form is for search, where the search is 
related to a product, and where you want to hang on to the product details as 
the search results change) and couldn't care less who frowns upon it. Why do 
you care?

2) Implementing a session cleanup manager is much easier if you *do* 
associate keys with paths (path == scenario/set of related use cases) and if 
you nest the attributes in Maps. Remove the base Map, remove everything. Remove 
a scenario-level Map, remove all attributes associated with that scenario. 
Remove a higher-level Map, remove attributes associated only with one use case 
or view. I use a request processor extension, where I'm already tracking user 
navigation. Cleaning up the session is a related operation. I usually don't 
bother to clean up at the page/use case level, but rather at the scenario 
level. When a user is done with that scenario, I remove that scenario's Map. 
This is of course, implemented by removing everything that doesn't pertain to 
the current scenario (usually triggered by a return to a home/base page).

Erik
 

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



Re: bean traversal question

2005-07-28 Thread Michael Jouravlev
On 7/28/05, Ed Griebel [EMAIL PROTECTED] wrote:
 Rick-
 
 I'm faced with this same problem on a new project and have been
 thinking along these same lines. What kind of issues have you run
 into?

I am interested too ;)

 The kind of things that I see being a problem is specifying
 which sets of actions are associated with what items in a session, and
 which sets of actions are resumable and which ones clear state if one
 navigates away from the path.

I think it should be pretty easy. An action mapping can belong to one
or several subsessions. This can be defined in action element of
config file. In my case ;) I have pretty coarse actions, I base them
on DispatchAction (actually SelectAction, but whatever). One action
contains a component, and serves all requests to this component, and
displays all pages of this component. It can be a Login component, or
CRUD component, or a wizard. So, correlating a component to action to
data that is used by it is easy.

In some cases, say in one version of CRUD sample, I may have two
actions which work with the same set of data. In this case both
actions would correspond to one subsession.

Once I load any other action which does not correspond to this
subsession, I can safely remove the CRUD action form with all stuff
sitting in it from the session. One line of code. Ok, two lines ;) On
next request RequestProcessor will call RequestUtils.createActionForm
which will create fresh instance if needed. Voila. Note that this
works even with Back button, because I use no-store pages, which are
reloaded on Back. Reload calls actio outside of subsession, and
subsession is removed. This will fail only if a user will go to a
completely different site, so at most application will keep *one*
object hanging in the session. I don't care ;) Note I've purposefully
avoided mentioning the F [flow] word.

One of my design ideas (which probably are stolen from someone whom
I've purposefully avoided mentioning too) is  that flow is not needed.
Each component like login, or menu or subscriptions or language
selection (these are from MailReader) should be totally independent,
but stateful. Flow only has to be supported for small sections, like a
wizard, which fits fully into one action.

Why application flow should not be needed? Because flow ties your
hands and does not allow to easily develop reusable components. Say,
you have flow: welcome - choose language - login - main menu -
subscriptions. What if you get to main menu, then go back, log out,
and then navigate to main menu again? Should flow control engine throw
an exception, notifying you that you broke flow? Nah. Instead, main
menu simply checks can it be shown or not (logged in or logged out).
If it can, the it shows itself, if not, it goes to login page.

Generic application flow is a bad thing, small action-scoped wizards rule! ;-))

Michael.

--
Struts dialogs, components, controls, wizards and other good stuff
http://struts.sourceforge.net/strutsdialogs

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



Re: bean traversal question

2005-07-28 Thread Rick Reumann

Ed Griebel wrote the following on 7/28/2005 5:11 PM:

Rick-

I'm faced with this same problem on a new project and have been
thinking along these same lines. What kind of issues have you run
into? 


I really haven't run into many problems when I use a Session based form 
for a wizard approach. Since you can only start the wizard typically at 
a particular entry point, you just make sure the session scoped form is 
a fresh new one at that point.  I'm lazy though and don't implement a 
clean-up mechanism.


--
Rick

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



htnm:base rewrites anchor tag

2005-07-28 Thread Shekhar Jain
I have a jsp page which in which I am using the html:base at the top
of the page. However I find that then all the links to anchor tags get
rewrriten with the jsp page. Is there any way to prevent this from
happening

Shekhar Jain

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



Re: bean traversal question

2005-07-28 Thread Michael Jouravlev
On 7/28/05, Rick Reumann [EMAIL PROTECTED] wrote:
 Ed Griebel wrote the following on 7/28/2005 5:11 PM:
  Rick-
 
  I'm faced with this same problem on a new project and have been
  thinking along these same lines. What kind of issues have you run
  into?
 
 I really haven't run into many problems when I use a Session based form
 for a wizard approach. Since you can only start the wizard typically at
 a particular entry point, you just make sure the session scoped form is
 a fresh new one at that point.  I'm lazy though and don't implement a
 clean-up mechanism.

Wizard should be handled by *one* action, then cleanup would be
simple. Have you found time to look at my stuff? ;-)

Michael.

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



Re: htnm:base rewrites anchor tag

2005-07-28 Thread Dave Newton

Shekhar Jain wrote:


I have a jsp page which in which I am using the html:base at the top
of the page. However I find that then all the links to anchor tags get
rewrriten with the jsp page. Is there any way to prevent this from
happening
 

Are the links-to-anchor-tags struts tags? If so, perhaps consider using 
straight html tag if you don't need the struts tags' functionality; one 
point of html:base is to allow html:link tags to rewrite appropriately.


(Or don't use html:base?)

Dave



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



Re: htnm:base rewrites anchor tag

2005-07-28 Thread Shekhar Jain
No  I'm just using a plain a href=#top ... to go to the top of the page 

Shekhar

On 7/28/05, Dave Newton [EMAIL PROTECTED] wrote:
 Shekhar Jain wrote:
 
 I have a jsp page which in which I am using the html:base at the top
 of the page. However I find that then all the links to anchor tags get
 rewrriten with the jsp page. Is there any way to prevent this from
 happening
 
 
 Are the links-to-anchor-tags struts tags? If so, perhaps consider using
 straight html tag if you don't need the struts tags' functionality; one
 point of html:base is to allow html:link tags to rewrite appropriately.
 
 (Or don't use html:base?)
 
 Dave
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: bean traversal question

2005-07-28 Thread Rick Reumann

Michael Jouravlev wrote the following on 7/28/2005 6:48 PM:


Wizard should be handled by *one* action, then cleanup would be
simple. Have you found time to look at my stuff? ;-)


Sorry Michael I have not:( Send me the link again.

But, that being said, where clean up becomes a problem is when the user 
goes to some other action? I agree one Action helps but what if they 
click on some other link from your menu that goes to some other Action? 
In other words they don't 'officially' quit the wizard flow. That's when 
it becomes a bit of a pain (assuming you care to clean up:)



--
Rick

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



Re: Problem with Dyna Form

2005-07-28 Thread Laurie Harper

Kade Jeevan Kumar wrote:

Hi All,
 
My requirement is to generate a set of dynamic rows(with checkbox and combo box) at client side using JSP and Struts 1.1.

As of now, i am generating the above stuff using java script.
How can i use Dyna Form to meet the above requirement (or) suggest me other way 
if u have any solution for this.


JSP / Struts are server-side, not client-side. If what you need is to be 
able to add rows to a page without making another request to the server 
each time, you'll need to stick with a Javascript solution.


If what you want to do is generate a page with a number of rows generated 
dynamically at request time, you have a range of options. If that's what 
you need you have a wide range of options ;-) Can you explain your 
requirements in more detail?


L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: htnm:base rewrites anchor tag

2005-07-28 Thread Dave Newton

Shekhar Jain wrote:

No  I'm just using a plain a href=#top ... to go to the top of the page 
 


I think you need to look at what the html base... tag does.

http://www.faqs.org/docs/htmltut/linking/_BASE.html

Dave



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



Re: multipart request issues

2005-07-28 Thread Laurie Harper

Carl Smith wrote:

I am having issues to get the request parameters from a multipart request, le 
me explain my problem first:

Our flow of process is:

(1) a multipart request is submitted to a struts action (let's say 
updateTableAction.do) using POST

(2) the multipart request is processed by ActionServlet.process() method

(3) in our processPreprocess method, which overrides processPreprocess in 
RequestProcessor.java from struts,

we need the parameters from this multipart request thus I am doing this:

CommonsMultipartRequestHandler commonMultiPartHandler = new CommonsMultipartRequestHandler(); 




try {

commonMultiPartHandler.handleRequest(request);

}catch(Exception e){

// some handling

}

Hashtable ht = commonMultiPartHandler.getTextElements(); // thus I get the 
parameters from the request

(4) however, all the fields/parameters in multipart request are no longer there 
in the updateTableAction.do

Can you help me find out why this is happening? One theory is that a multipart 
request can't be parsed twice. Is this correct, if it is correct, do you have 
any alternative?


That's certainly true; once the request has been consumed (parsed) it can't 
be parsed again since the data is no longer there. I don't know the normal 
flow of RequestProcessor but I assume you need to store the result of 
handleRequest() in the same way as Struts normally does -- probably using 
an HttpRequestWrapper. If that's not normally handled in 
processPreprocess(), you'll need to also override whichever method in 
RequestProcessor does handle it.


L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: bean traversal question

2005-07-28 Thread Shekhar Jain
What we have done is kept all forms in session as form. That way if
the user jumps to another set of pages and discards halfway tru the
current process the form session variable just gets reused and we
don't have to worry too much about cleanup

Shekhar

On 7/28/05, Rick Reumann [EMAIL PROTECTED] wrote:
 Michael Jouravlev wrote the following on 7/28/2005 6:48 PM:
 
  Wizard should be handled by *one* action, then cleanup would be
  simple. Have you found time to look at my stuff? ;-)
 
 Sorry Michael I have not:( Send me the link again.
 
 But, that being said, where clean up becomes a problem is when the user
 goes to some other action? I agree one Action helps but what if they
 click on some other link from your menu that goes to some other Action?
 In other words they don't 'officially' quit the wizard flow. That's when
 it becomes a bit of a pain (assuming you care to clean up:)
 
 
 --
 Rick
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: UrlValidator (why not use java.net.URL?)

2005-07-28 Thread Laurie Harper
I'd guess the reason is to make it easier to keep the client- and 
server-side validation in sync. java.net.URL is, obviously, not available 
to the client-side validation. The Commons Validator list is probably the 
right place to follow this up.


L.

Marc Logemann wrote:


Hi,

after looking into the code of UrlValidator and moreover looking into a 
similar class in Tapestry which is no longer active as it seems, i 
wonder why commons-validator UrlValidator is using Regex so much. 
Wouldnt it be enough to just use java.net.URL and let this class do the 
verification? Of course i am not quite sure how it deals non-schema URLs 
but for complete URLs to verifiy, its perhaps a better choice.


Perhaps this one is for the developer list but i try it here first ;-)




Lindholm, Greg wrote:


I encountered this awhile back but didn't have time to investigate.
As a workaround I use the localhost IP address 127.0.0.1 but it
would be nice to get this fixed.
 


-Original Message-
From: Marc Logemann [mailto:[EMAIL PROTECTED] Sent: Thursday, July 
28, 2005 8:33 AM

To: user@struts.apache.org
Subject: UrlValidator

Hi,

can it be that UrlValidator from Commons-Validator doesnt validate 
URLs with localhost in it?


The following URL - http://localhost:8081/context/jsp/versand_1.jsp







--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: bean traversal question

2005-07-28 Thread Michael Jouravlev
On 7/28/05, Rick Reumann [EMAIL PROTECTED] wrote:
 Michael Jouravlev wrote the following on 7/28/2005 6:48 PM:
 
  Wizard should be handled by *one* action, then cleanup would be
  simple. Have you found time to look at my stuff? ;-)
 
 Sorry Michael I have not:( Send me the link again.

No rush :) Though you might like it, because it uses session. On the
other hand, you may hate it, because it uses DispatchAction flavor ;)

Project link: 
http://struts.sourceforge.net/strutsdialogs

Login/Logout/Signup combo component: 
http://www.superinterface.com/wizard/signupWizard.do

Signup Wizard only:
http://www.superinterface.com/strutsdialog/wizardaction.do

All samples:
http://www.superinterface.com/strutsdialog/index.htm

 But, that being said, where clean up becomes a problem is when the user
 goes to some other action? I agree one Action helps but what if they
 click on some other link from your menu that goes to some other Action?
 In other words they don't 'officially' quit the wizard flow. That's when
 it becomes a bit of a pain (assuming you care to clean up:)

No pain. You just have to decide, do you want to allow people to leave
wizard in the middle and then come back, you you do not. If you do,
then you leave it as it is, so when they come back to the same
component, they would see same page and same data. If you don't want
to keep it, then trash the wizard. This should be set per component.

There should be set of policies. For example, if you navigate to an
action which is not part of any subsession (or scenario, I like this
word), do you trash all existing scenarios or you keep them?

The downside of my components, is that there can be only one instance
of every component per session. Wicket guys, for example, use
versions. But their version usage is not very smart, they simply
create new version each time a component is accessed. I need to think
of better way of creating of several versions to be used either on one
page, or in different browser windows. But I am not sure that this is
possible...

Michael.

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



Re: bean traversal question

2005-07-28 Thread Michael Jouravlev
On 7/28/05, Michael Jouravlev [EMAIL PROTECTED] wrote:
 There should be set of policies. For example, if you navigate to an
 action which is not part of any subsession (or scenario, I like this
 word), do you trash all existing scenarios or you keep them?

If you look at Spring Web Flow, you would see that they allow to
define huge app-sized flows and subflows. This is madness, and I do
not favor this. I think it is much easier not to have a flow at all,
and instead to define single-level peer components (resources,
actions, scenarios, whatever you call them). If you need a wizard,
make it one action.

The idea of subflows is do you allow certain set of actions in certain
state or not. State is the keyword. If state is used uniformly in
application, subflows would not be needed, just set or clear the
state. Right... Essentially, flow with sublows is a hierarchical
state. I guess I need to think of something generic app-wide state
management.

Michael.

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



Re: String concatenation

2005-07-28 Thread Laurie Harper

Konrad Billewicz wrote:

Dave Newton newton at pingsite.com writes:
I've never put a parameter in a form's action attribute--why would you 
want to do that? Wouldn't it be much cleaner to use a hidden form field 
with the appropriate parameter name?


So your original example would be (minus whatever silly syntax mistakes 
because I'm groggy):


html:form action=createDictionaryEntity
 html:hidden property=dictionary/
 !-- ... --
/html:form

and whatever loads the form puts the appropriate dictionaryId value into 
the ActionForm?


I wish to pass the dictionary variable using GET - make it visible in the URL. 

Secondly, this action (createDictionaryEntity) can be accessed both from form 
and from link (using a href=...). I wish to have one, clear method of 
passing parameters to it. Of course, I can at first check the request and 
secondly the form (or inversely) but it is not, in my opinion, elegant solution. 
I thing it is not compulsory.


Firstly, you can combine get with forms; if you use method=GET the hidden 
parameter Dave suggested will show up in the URL. Either way, you wouldn't 
have to 'check the request and secondly the form' since GET and POST 
parameters are both accessed the same way, though request.getParameter() or 
via your form bean.


If you really still want to construct the URL with a query parameter, 
though, you have a few options. Using JSTL:


  html:form action=createDictionaryEntity.do?
dictionary=${requestScope['dictionaryId'}

Alternatively you might be able to do something along the lines of (off the 
top of my head; check the docs for syntax):


  c:url var=action value=createDictionaryEntity.do
c:param name=dictionary
  bean:write name=dictionaryId scope=request/
  %= dictionaryId %
/c:param
  /c:url
  html:form action=% action %

But that still uses JSTL tags; I don't know if you can get to the same 
result with only Struts tags an on EL or runtime expressions.


L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: Merging form properties

2005-07-28 Thread Laurie Harper

Wendy Smoak wrote:

From: Cadariu, Mihai [EMAIL PROTECTED]

I have two instances of the same form bean class, both containing some
properties filled, the rest being null. I would like to copy the non-null
properties from one form bean to the other. I tried using the
PropertyUtils.copyProperties or BeanUtils.copyProperties but they copy all
properties, whether they are null or not. Is there a way to tweak the
copying, so that only non-null values are overwritten?


I haven't done it, but you can use a BeanInfo class to control what
properties are exposed:
   http://java.sun.com/docs/books/tutorial/javabeans/beaninfo/


That wont work, though, if you don't know at design time which properties 
you need to copy and which to ignore. My first thought if that's an issue 
would be to describe() the source bean into a map, filter the null valued 
properties, then populate() the target bean. Seems a bit long-winded 
though. It might be worth asking on the BeanUtils list.


L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: Merging form properties

2005-07-28 Thread Dave Newton

Laurie Harper wrote:


Wendy Smoak wrote:


I haven't done it, but you can use a BeanInfo class to control what
properties are exposed:
   http://java.sun.com/docs/books/tutorial/javabeans/beaninfo/


That wont work, though, if you don't know at design time which 
properties you need to copy and which to ignore.


Is that true? I glanced briefly at the tutorial and it wasn't 
immediately clear to me exactly when the BeanInfo stuff was used: if in 
the getPropertyDescriptors method you checked the values for null and 
only returned those that weren't null would this work?


Dave



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



Re: Merging form properties

2005-07-28 Thread Wendy Smoak

From: Dave Newton [EMAIL PROTECTED]

if in the getPropertyDescriptors method you checked the values for null 
and only returned those that weren't null would this work?


That's what I was thinking... but looking at the BeanInfo interface, you 
don't have access to the bean itself, so as Laurie said you would have to 
know in advance which properties to expose.  Never mind, then. :)


You should probably ask on commons-user... I bet there's a simple way to do 
this.   (The next thing that comes to mind is subclassing BeanUtilsBean and 
overriding the copyProperty method to make it ignore properties for which 
the incoming value is null.  Would that work?)


--
Wendy Smoak 




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



Re: [OT] saving stats from session when session destroyed

2005-07-28 Thread Van
On 7/25/05, Frank W. Zammetti [EMAIL PROTECTED] wrote:
 SessionListener is what you want.
 
 Here's an example from one of my apps (condensed for space)... it is used
 to delete a temporary PDF that may have been generated for the user when
 they log off:
 
 import company.app.User;
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionEvent;
 import javax.servlet.http.HttpSessionListener;
 public class MySessionListener implements HttpSessionListener {
  public synchronized void sessionCreated(HttpSessionEvent se) {
  }
  public synchronized void sessionDestroyed(HttpSessionEvent se) {
HttpSession sess = se.getSession();
User user = (User)sess.getAttribute(user);
String userID = user.getUserID();
AppHelpers.deletePDF(userID);
  }
 }

I could be losing my mind, but, I swear that I tried this technique
once and by the time the sessionDestroyed() method was called, I was
not able to get any of the session attributes back anymore. For
various reasons, the webapps I develop need to be deployable in a
Servlet 2.3 environment. Is this something where the behavior changed
for the better in Servlet 2.4 versus 2.3?

-Van

-- 
- Mike Van Riper
  [EMAIL PROTECTED]

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



Re: Path like urls with objects' OIDs: /objects/object/17/198/4 possible?

2005-07-28 Thread Laurie Harper

This might be useful:

http://article.gmane.org/gmane.comp.jakarta.struts.user/110666/match=

Tomasz Nazar wrote:



Hi!

I like the idea (pattern) of having actions named in a path/menu-like
way.

Say: /context/employees/emplyee?id=17

But: I'd like to have something more prettier:

Say: /context/emplyee/17

Or even more: /context/archive/1998/employee/tomasz/tasks/7


Can you point me where to look for this? Is there any standard
option for that; some URL pattern rewriting or God knows what.

Do I have to write my own implementation of some method/class and
then parse the url, set proper parameters and pass over to Struts
(dispatcher?) ?

Thanks in advance - Tomasz





--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: [OT] saving stats from session when session destroyed

2005-07-28 Thread Frank W. Zammetti
Nope, not as far as I know... in fact, I just implemented a listener 
today that does some maintenace-type things like the code below, and it 
works fine, that's under Tomcat 5.5.28 I believe... spec 2.3 as I tecall?


sessionDestroyed() would be all but useless if you couldn't get at the 
attributes, I would be utterly shocked if the spec changed in that 
way... I'd bet you saw either a bad implementation, or you actually ARE 
losing your mind :) (not to worry, wherever yours is, mine is right 
behind it!)


Frank

Van wrote:

On 7/25/05, Frank W. Zammetti [EMAIL PROTECTED] wrote:


SessionListener is what you want.

Here's an example from one of my apps (condensed for space)... it is used
to delete a temporary PDF that may have been generated for the user when
they log off:

import company.app.User;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
public class MySessionListener implements HttpSessionListener {
public synchronized void sessionCreated(HttpSessionEvent se) {
}
public synchronized void sessionDestroyed(HttpSessionEvent se) {
  HttpSession sess = se.getSession();
  User user = (User)sess.getAttribute(user);
  String userID = user.getUserID();
  AppHelpers.deletePDF(userID);
}
}



I could be losing my mind, but, I swear that I tried this technique
once and by the time the sessionDestroyed() method was called, I was
not able to get any of the session attributes back anymore. For
various reasons, the webapps I develop need to be deployable in a
Servlet 2.3 environment. Is this something where the behavior changed
for the better in Servlet 2.4 versus 2.3?

-Van



--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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



Re: Merging form properties

2005-07-28 Thread Laurie Harper

Wendy Smoak wrote:


From: Dave Newton [EMAIL PROTECTED]

if in the getPropertyDescriptors method you checked the values for 
null and only returned those that weren't null would this work?



That's what I was thinking... but looking at the BeanInfo interface, you 
don't have access to the bean itself, so as Laurie said you would have 
to know in advance which properties to expose.  Never mind, then. :)


You should probably ask on commons-user... I bet there's a simple way to 
do this.   (The next thing that comes to mind is subclassing 
BeanUtilsBean and overriding the copyProperty method to make it ignore 
properties for which the incoming value is null.  Would that work?)


For what it's worth, I think I just realized I need to solve the same 
problem, so I'll try and remember to post here if I come up with a nice 
solution. If you get anything from commons-user drop me a note ;-)


L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Where can I find taglibs

2005-07-28 Thread Paul Goepfert
I want to write a web app  with  jsp/struts.  I know that there should 
be a struts tag library for this.  Where can I find it?


Thanks,

-Paul

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



Re: [OT] saving stats from session when session destroyed

2005-07-28 Thread Van
On 7/28/05, Frank W. Zammetti [EMAIL PROTECTED] wrote:
 Nope, not as far as I know... in fact, I just implemented a listener
 today that does some maintenace-type things like the code below, and it
 works fine, that's under Tomcat 5.5.28 I believe... spec 2.3 as I recall?

I believe that Tomcat 4.x was at spec 2.3 level and Tomcat 5.x is at
spec 2.4 level. In any case, I'm using a Jetty 4.2.x container which
I'm absolutely certain only has spec 2.3 support.

 
 sessionDestroyed() would be all but useless if you couldn't get at the
 attributes, I would be utterly shocked if the spec changed in that
 way... I'd bet you saw either a bad implementation, or you actually ARE
 losing your mind :) (not to worry, wherever yours is, mine is right
 behind it!)

I totally agree, but, all I was able to get was the jsessionid. It
turns out we had a database table for auditing purposes already. So, I
was able to stick the jsessionid into the login audit entry for the
user. This allowed me to determine the user associated with session
just destroyed so that I could add an audit table entry for the
matching logout for that user too.

Believe me, I wouldn't have gone to all that trouble if the session
data was available for me to get to the user attribute in the session.

This has stirred my curiosity. I'll give it another go for my current
project (we weren't using Jetty on the previous project) and report
back.

-Van

 
 Frank
 
 Van wrote:
  On 7/25/05, Frank W. Zammetti [EMAIL PROTECTED] wrote:
 
 SessionListener is what you want.
 
 Here's an example from one of my apps (condensed for space)... it is used
 to delete a temporary PDF that may have been generated for the user when
 they log off:
 
 import company.app.User;
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionEvent;
 import javax.servlet.http.HttpSessionListener;
 public class MySessionListener implements HttpSessionListener {
  public synchronized void sessionCreated(HttpSessionEvent se) {
  }
  public synchronized void sessionDestroyed(HttpSessionEvent se) {
HttpSession sess = se.getSession();
User user = (User)sess.getAttribute(user);
String userID = user.getUserID();
AppHelpers.deletePDF(userID);
  }
 }
 
 
  I could be losing my mind, but, I swear that I tried this technique
  once and by the time the sessionDestroyed() method was called, I was
  not able to get any of the session attributes back anymore. For
  various reasons, the webapps I develop need to be deployable in a
  Servlet 2.3 environment. Is this something where the behavior changed
  for the better in Servlet 2.4 versus 2.3?
 
  -Van
 
 
 --
 Frank W. Zammetti
 Founder and Chief Software Architect
 Omnytex Technologies
 http://www.omnytex.com
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
- Mike Van Riper
  [EMAIL PROTECTED]

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



Re: Where can I find taglibs

2005-07-28 Thread Frank W. Zammetti
The Struts taglibs currently ship with the main Struts distribution. 
Download Struts and you get the taglibs.


FYI, the development branch has them separated out now as a separate 
sub-project.  I'm not sure how they are intended to be distributed, but 
for now it doesn't really matter.


Frank

Paul Goepfert wrote:
I want to write a web app  with  jsp/struts.  I know that there should 
be a struts tag library for this.  Where can I find it?


Thanks,

-Paul

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




.



--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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



Re: [OT] saving stats from session when session destroyed

2005-07-28 Thread Frank W. Zammetti

Van wrote:

I believe that Tomcat 4.x was at spec 2.3 level and Tomcat 5.x is at
spec 2.4 level. In any case, I'm using a Jetty 4.2.x container which
I'm absolutely certain only has spec 2.3 support.


I'd bet your right about Tomcat... of course, either of us could go look 
it up in 10 seconds :)  Let's stick to the suppositions though, they're 
more fun :)



Believe me, I wouldn't have gone to all that trouble if the session
data was available for me to get to the user attribute in the session.


Interesting... I'd bet it was a peculiarity of the container's spec 
implementation.  Did you say it was Jetty at that time too?  I'm not at 
all familiar with Jetty, so it's just a guess.



This has stirred my curiosity. I'll give it another go for my current
project (we weren't using Jetty on the previous project) and report
back.


Please do... I'd be intersted to know the answer as well :)


-Van


Frank


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



Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Tamas Szabo

Hi Rick,


That would probably be a good idea to use two filters vs doing it all 
in one. Although it could also be nice to see all that happens for 
each request by looking in just one filter vs two.


I like this idea because in my opinion filters should do small tasks. 
This way they can be used separately or they can be combined

in a chain to achieve some more complicated functionality.
For example Frank's JWP could have a filter which limits the number of 
sessions for a configurable max value and another filter
which checks for a session timeout. If the session timeout occurs it can 
redirect to a configurable page.
This way you have two filters which provide functionality that can be 
used separately or they can be combined.
And I don't think that it will be confusing for someone to look at two 
filters. They don't have to check the code.
The filters are black-boxes and you have to look just in the web.xml to 
know what is going on.
You will see that first all requests are filtered to limit the sessions 
and then that expired sessions are redirected by

the second filter.

2) I noticed a lot of odd behavior when the server was shut down and 
the pages were still up. For example, if the user was left on a page 
that displayed a log off link and the server was restarted, when 
they then clicked on log off (which calls session invalidate) it 
would decrement the sessionCounter to -1. I'm not sure how 
sessionDestroyed could get called before sessionCreated, but I guess 
it can? My hack here was to do a check for sessionCount being less 
than 0 and if so reset it to 0.



This is strange. What kind of webcontainer do you use?
At first glance it seems like your web container has a 'feature' to 
serialize sessions on stop and to recreate them when you start the 
server again.
In this case the sessionCounter would be set to 0 on restart but the 
session would be recreated = no sessionCreated() executed, just

sessionDestroyed() on logout...



Possibly that is what is happening. The scenario where I noticed this 
was using JBoss (Tomcat as the app server in JBoss).



I've just checked it and Tomcat has this feature.
However you must configure Tomcat to never recover your sessions!
I'm afraid that your check if sessionCount is less than 0 is just not 
enough.

Ex:
User A uses the app
Tomcat is restarted
User B comes in and gets a new session (sessionCount becomes 1 which is 
the max allowed)
User A tries to use the app and he has a recovered and unflagged 
session. sessionCreated will not be executed and nothing

will prevent the user A to use the app while user B is using it.

If you put a META-INF/context.xml in your WAR with the following content:

Context

Manager class=org.apache.catalina.session.StandardManager pathname= /

/Context

you should be ok.

The Manager can be also configured to limit the sessions with the 
maxActiveSessions attribute :-D
So if it was not a problem for you to tie your implementation to Tomcat 
then everything would be easier.
You set the maxActiveSessions attribute to 1,  and in the filter when 
you execute request.getSession you
catch the IllegalStateException thrown by Tomcat. If it's thrown you 
redirect to appInUse.jsp

You can forget about the SessionListener, you won't need it.

However, I would like to have a general solution for this and since we 
took the time to think it over

we could have this code somewhere so it will be reusable in the future.

For example Frank's JWP would be a great place to include these filters, 
if he accepted to include

them in his project.


Regards,
Tamas

p.s. the open question: you want a Tomcat specific solution or a general 
one?




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



Re: JSF is the beginning of the end of Struts !!!

2005-07-28 Thread Steve Raeburn

Michael / Jack / Thingamabob,

Struts is licensed in such a way that if you are unhappy with the way it 
is being managed, you are quite free to fork the code and continue to 
develop it in whatever way *you* see fit.


I suspect you'd make a lot of people very happy if you went away and did 
that.


Steve

Dakota Jack wrote:


Struts could live by improving in ways unlikely with the present
management.  The people in charge of Struts these days are really
interested in something else.  Unless the baton passes to those
actively building something, Struts likely will either die from be
non-competitive with like products or from being turned into something
it is not, like JSF, Shale, Clay, Dirt.

On 7/26/05, Greg Reddin [EMAIL PROTECTED] wrote:
 


Interesting this discussion would come up now.  I've been in and out of
Struts for about 5 years.  I'm now coming back in and taking interest in
JSF/Shale, etc.  A few of points to think about:

1.  Struts will someday die.  If it doesn't, then we've seen the end of
technology advancement.  If those of us who love Struts and what it
provides want to continue to have influence going forward, we have to be
 ready to embrace the next thing that's better than Struts and add
value there.  Staying with something because of familiarity is typically
the road to becoming a dinosaur in technology.

2.  I only started studying JSF seriously about 2 weeks ago. From what
I've seen it takes the best things Struts offers and brings them into a
somewhat cleaner package.  Those things are:

*  Nice HTML tag library.
*  Auto-populating of form beans.
*  Simple controller interface.

It also expands on these things by making the view easier to develop,
less restriction on how form beans and controllers are developed, and
some other really interesting services that I've only begun to play
with.  To sum it up, using JSF out of the box I can do most of what I
can with Struts, only quicker and with less code.  I see JSF as the next
step of Struts.  But it's still not complete.  I'm only beginning to see
what Shale adds to JSF and am following Shale with great interest.

3.  PHP.  I've done some PHP over the last couple years.  I'm by no
means an expert, but I do know my way around somewhat.  The whole time
I've caught myself thinking if I was in Java I'd have a better way to do
just about everything.  But most of the better way is because of the
J2EE APIs, Struts, and Tiles.  The language is a bit more cumbersome
than Java and it's much more difficult to modularize.  I find PHP is
easier (to me) if I don't try to make things elegant, but just spew
code to some extent.  I finally found a CMS to use as a Struts-like
framework, but I still find Java/Struts and now JSF to be better,
cleaner, and more modular.  I am now trying to figure out a way to do my
future on-the-side consulting in Java instead of PHP.

I think another of PHPs success factors has to do with its acceptance
from the open source community.  Somehow Java has had a somewhat tainted
reputation due to the lack of a truly open complete implementation --
and probably some are just bitter that Sun hasn't opened the whole thing
up.  I don't personally have anything to contribute to that debate, but
I suspect it's a factor in why PHP has been so widely embraced on the
web compared to Java.

So all in all, it doesn't much matter to me if JSF supercedes Struts.
If it's better, then it should.  If we get behind Shale it think we can
have our cake and eat it too.

BTW, for JSF info, try MyFaces.  Their Getting Started section points to
some pretty good tutorials.  In short testing I've found the myfaces
implementation to be pretty stable.  I'm actually surprised Craig is not
listed as a contributor to that project.

That's my 50 cents.
Greg

Daniel Perry wrote:
   


Sorry for the OT postings.

My point was that you cant compare usage of PHP with Struts.

The number of Struts sites (or even java sites) will never overtake the
number of PHP sites for the reasons i pointed out (although... zend are
doing their best to kill off php by trying to move it into the enterprise
arena and tying it with java).  But for those same reasons, comparing the
two is useless.

As for JSF... It seems like a nice idea, but i havnt fully got my head round
it.  I cant see it killing off struts in the short term (just look at daily
rate of postings on this list!!!) I do like the idea of replacing struts
html tags with JSF.  I certainly think JSTL/EL are nicer than the logic
tags.

I now have a dilema... I'm just about to start on another project.  What
technologies do i use?

I guess i'll probably stick with struts.  Though i may dabble with JSF a
bit.

Can anyone recommend any good resources? Sure a google search provides tons
of information... but which is any good?

Daniel.


 


-Original Message-
From: Mark Benussi [mailto:[EMAIL PROTECTED]
Sent: 26 July 2005 10:38
To: 'Struts Users Mailing List'
Subject: RE: Re: JSF is the beginning of 

Re: probably a cleaner way... testing for just one user

2005-07-28 Thread Frank W. Zammetti

Tamas Szabo wrote:
For example Frank's JWP would be a great place to include these filters, 
if he accepted to include

them in his project.


I would absolutely accept them, so long as they work :)  And frankly, 
right now I'm trying to figure out why my formerly working version of 
the session limiting stuff isn't working any longer, so I'd be even MORE 
inclined to accept them now :)


The session timeout filter I'm not as sure about only because it seems 
redundant... isn't there a way to do that already built in to the spec? 
 Weird... I'm looking at a web.xml reference right now and I don't see 
anything that allows you to set a page to redirect to when a session 
times out... can that really be the case?  You CAN redirect to a 
specific page based on an HTTP error code, do you maybe get a specific 
code when a session times out?


If there isn't a way to do this, then yeah, such a filter would be an 
excellent (and one would think easy!) addition.


In any case, feel perfectly free to lob any additions to JWP you like my 
way.  There's no way in the world I can do it all alone :)


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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



  1   2   >