Any Takers ?RE: Struts Validator and Select boxes

2004-03-26 Thread Janarthan Sathiamurthy
Any help/takers ?

-Original Message-
From: Janarthan Sathiamurthy 
Sent: Thursday, March 25, 2004 10:16 PM
To: [EMAIL PROTECTED]
Subject: Struts Validator and Select boxes


Hi,

I am using Struts validator.
One page of mine has dates displayed as MM  DD .
All the above 3 are displayed in seprate combo/select boxes.
I need to do some custom validations on these fields.
I wrote a custom class for the same 
Looks like - 
   public static boolean validateDates(Object bean,
ValidatorAction validatorAction,
Field field, ActionErrors errors,
HttpServletRequest request)
   {
  String actionType = ValidatorUtil.getValueAsString(bean,
 
field.getVarValue(actionType)); // A hidden form field
  String fromMonth = ValidatorUtil.getValueAsString(bean,
field.getProperty());
  String fromDay = ValidatorUtil.getValueAsString(bean,
  field.getVarValue(fromDay));
  String fromYear = ValidatorUtil.getValueAsString(bean,
   field.getVarValue(fromYear));
  String toMonth = ValidatorUtil.getValueAsString(bean,
  field.getVarValue(toMonth));
  String toDay = ValidatorUtil.getValueAsString(bean,
field.getVarValue(toDay));
  String toYear = ValidatorUtil.getValueAsString(bean,
 field.getVarValue(toYear));

  System.out.println(actionType  + actionType);
  System.out.println(fromMonth  + fromMonth);
  System.out.println(fromDay  + fromDay);
  System.out.println(fromYear  + fromYear);
  System.out.println(toMonth  + toMonth);
  System.out.println(toDay  + toDay);
  System.out.println(toYear  + toYear);

  return true;
   }

O/P of the above code - 
actionType searchPage
fromMonth 2
fromDay null
fromYear null
toMonth null
toDay null
toYear null

It also gives me No Name Specified error.
Point to note is that the all other fields other than 'actionType' are select boxes. 
It gives a null for all the field types that are of html:select.
Is this a known BUG or am i going wrong somewhere ? 


Error LOG -
Mar 25, 2004 9:53:11 PM org.apache.commons.validator.ValidatorUtil getValueAsString
SEVERE: No name specified
java.lang.IllegalArgumentException: No name specified
at 
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:721)
at 
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at 
org.apache.commons.validator.ValidatorUtil.getValueAsString(ValidatorUtil.java:121)
at 
com.mot.servicetools.util.OCSReportsDateValidator.validateDates(OCSReportsDateValidator.j
ava:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:454)
at org.apache.commons.validator.Validator.validateField(Validator.java:544)
at org.apache.commons.validator.Validator.validate(Validator.java:582)
at 
org.apache.struts.validator.DynaValidatorActionForm.validate(DynaValidatorActionForm.java
:125)
at 
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.jav
a:1053)
at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:6310)
at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at 
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:36
22)
at 

Re: Struts tag problem (bean:message and bean:write)

2004-03-26 Thread Dmitrii CRETU
Hello Marco,

maybe this will help (using struts-el):

bean-el:message key='prompt.productType.${product.productType}'/


Dima.


Thursday, March 25, 2004, 6:02:54 PM, you wrote:

MM Hi all,
MM I was wondering if anyone of you have a solution
MM For this dilemma.
MM I have a collectin of product DTOs to show on my jsp. One of 
MM DTO's property is, let's say, the type, which is listed in number.
MM (let's say, 10 or 20).
MM ON the DTO I will have the value 10,20 ecc but on the jsp I have to
MM display
MM The corresponding string (let's say, HouseProduct or Car or something
MM else) which is listed in application.resources.

MM I am looping thru the collection using logic:iterate, and
MM as I have found out myself, following code does not work

MM bean:message key='prompt.productType.bean:write name=product
MM property=productType'/


MM basically in app.resources I will have
MM prompt.productType.10=HouseProduct
MM prompt.productType.20=Car

MM etc..

MM above, I am outputting the message   prompt.productType.(productType)

MM how can I solve my dilemma, keeping in mind that I am using also
MM logic:iterate to loop thru the collection?

MM With best regards
MM marco


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



-- 
Best regards,
 Dmitriimailto:[EMAIL PROTECTED]



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



RE: Handling Date objects in ActionForm gracefully

2004-03-26 Thread Freddy Villalba Arias
As someone with good experience in MVC-based applications but a newbie
to Struts, what I understand from this discussion is that the
recommended implementation would have to comply, at least, with this
guidelines:

- The conversion code is encapsulated in a separate class (I suppose one
converter class per each String, Target Data Type combination
required, right?).

- Passes all (String) parameters to a Business Object that encapsulates
the use case (I mean, the logic) and, from within that BO, use the
corresponding converter classes for getting the actual data object to
flow around (i.e. be eventually get-ed or set-ed from the DAOs/DTOs, bla
bla bla...)

I'm I right here or am I missing any other IMPORTANT aspect(s)?

STILL, there is something I don't get: how would you implement /
encapsulate then the opposite direction for data conversion; in other
words:

- Convert from original data types towards String (another method in
the same converter class?)

- Map (set) some (non-String) data object into the corresponding String
property on the form bean.

Thanks,
Freddy.

-Mensaje original-
De: Mark Lowe [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 26 de marzo de 2004 0:59
Para: Sreenivasa Chadalavada; Struts Users Mailing List
Asunto: Re: Handling Date objects in ActionForm gracefully

You deal with the conversion else where but not in the form bean, you  
can argue about it or just believe me. The action form sits between the

view and the action, the date conversion goes on between the action and

the model.

Your approach isn't that bad its just not to the MVC pattern that  
struts follows (not that its the only one).

Create a date convertion util class or something.

If you dont want to take my word for it here's what craig had to say  
albeit in response to a different question

snippet
As the original designer of Struts :-), I must point out that the  
design of
ActionForm (and the recommendation that form bean properties be  
Strings) is
***very*** deliberate.  The reason this is needed is obvious when you  
consider
the following use case:

* You have an input form that, say, accepts only integers.

* Your form bean property is of type int.

* The user types 1b3 instead of 123, by accident.

* Based on experience with any garden variety GUI application,
   the user will expect that they receive an error message,
   plus a redisplay of the form ***WITH THE INCORRECT VALUES
   THAT WERE ENTERED DISPLAYED SO THE USER CAN CORRECT THEM***.

* The current Struts environment will throw an exception
   due to the conversion failure.

* The suggested solution will ***hopelessly*** confuse the
   nature of a form bean, which is part of the VIEW tier, with
   model beans that have native data types.

Struts does not include any sort of user interface component model  
where the
details of conversion are hidden inside the user interface component.   
If that
is what you are after, you should look at a *real* user interface  
component
model (such as using JavaServer Faces with a Struts application).   
Corrupting
the functionality of a form bean to *pretend* that it is a user  
interface
component is only going to create complications for the world.
/snippet

I hope this helps

Mark

On 25 Mar 2004, at 21:26, Sreenivasa Chadalavada wrote:


 Application Tier is strongly typed.

 So if the field is a java.util.Date in the database, then the data  
 object will have the method

 public DataObject{
         public java.util.Date getAsOfDate()
         public void setAsOfDate(java.util.Date asOfDate) methods.
 }

 My Action form is:

 public MyActionForm extends ActionForm{
         public DataObject getDataObject();
         public void setDataObject(DataObject dataObject);
 }

 My jsp contains

 html:text property=dataObject.asOfDate/

 This will fail if the user does not enter any date. I want the  
 (changed) struts framework to handle that.

 I did not want to create a new method with type String for every Date

 field

 Hope this explanation helps !!

 Thanks and Regards,
  Sree/-


   

--- 
 -
  This is a PRIVATE message. If you are not the intended recipient,  
 please delete without copying and kindly advise us by e-mail of the  
 mistake in delivery. NOTE: Regardless of content, this e-mail shall  
 not operate to bind CSC to any order or other contract unless pursuant

 to explicit written agreement or government initiative expressly  
 permitting the use of e-mail for such purpose.
   

--- 
 -





 Mark Lowe mark.lowe
  @boxstuff.com

 03/25/2004 03:17 PM
 Please respond to Struts Users Mailing List

        
         To:        Struts Users Mailing List  
 [EMAIL PROTECTED]
         cc:        
         Subject:        Re: Handling Date objects in ActionForm  
 gracefully



 Ask yourself why are you trying to convert 

RE: Handling Date objects in ActionForm gracefully

2004-03-26 Thread anuj . upadhyay


+1
I also suggest this approach to keep the date as string during posts and convert
them to date object when porcessing the entered dates, surely not in the Form.

Depends on  what you really want to achieve. Would suggest the KISS rule..:-)





Robert Taylor [EMAIL PROTECTED] on 03/25/2004 08:53:31 PM

Please respond to Struts Users Mailing List [EMAIL PROTECTED]

To:   Struts Users Mailing List [EMAIL PROTECTED]
cc:(bcc: Anuj Upadhyay/Jeppesen/TMC)

Subject:  RE: Handling Date objects in ActionForm gracefully



+1

 -Original Message-
 From: Mark Lowe [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 25, 2004 2:36 PM
 To: Struts Users Mailing List
 Subject: Re: Handling Date objects in ActionForm gracefully


 Have it as a string and convert it to a date or calendar when you pass
 it back to the model.


 On 25 Mar 2004, at 20:28, Sreenivasa Chadalavada wrote:

  All,
 
  We are facing a problem when we define java.util.Date field in
  ActionForm.
 
  Is there any way to override the default behavior provided by Struts?
 
  I very much appreciate your help!!
 
  Thanks and Regards,
  Sree/-
 
 
  ---
  -
  This is a PRIVATE message. If you are not the intended recipient,
  please
  delete without copying and kindly advise us by e-mail of the mistake in
  delivery. NOTE: Regardless of content, this e-mail shall not operate to
  bind CSC to any order or other contract unless pursuant to explicit
  written agreement or government initiative expressly permitting the
  use of
  e-mail for such purpose.
  ---
  -


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


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








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



Re: html inside an action

2004-03-26 Thread ruben
Hi,
thanks everybody for the responses, they help us a lot to make a 
decision, i think that it could be better solution trying to do my 
requirements with tags , but i need that an import could load a resource 
dinamycally, something like these 

c:import url=${sessionScope.SomeVariable} /

and SomeVariable has a String with the name of the resource,
is this possible? i try to do but it doesn't work ...
thanks a lot,
Brendan Richards wrote:

There's also jakarkta commons-httpclient

http://jakarta.apache.org/commons/httpclient/

-Original Message-
From: Qureshi, Affan [mailto:[EMAIL PROTECTED] 
Sent: 25 March 2004 17:04
To: Struts Users Mailing List
Subject: RE: html inside an action

HttpUnit is also a neat tool which might help. Have a JSP generate the
HTML and access that using HttpUnit (or a simple URLConnection/Socket
for that matter). And you can get the generated HTML in your Action. 

I hope I understand you this time.

-Original Message-
From: ruben [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 10:54 AM
To: Struts Users Mailing List
Subject: Re: html inside an action
hi
Those are my requirements, i have to convert objects to html, in my 
action and get this html in a String, i thought that the jsp is a good 
way to do this,
I want the code that   jsp generate (that is sent to the browser) on my 
action , is it possible? thanks a lot ,
Regards.

Qureshi, Affan wrote:

So why cant you use simple JSTL or struts-EL tags to do it? Ideally you 
shouldn't be doing any client-side stuff in your Actions.
A cleaner approach would be to use Custom Tags to have the HTML 
generation code and you can call them from your JSPs. (Remember that 
JSPs are not sent to the browser, it is the code they generate that is 
sent to the client browser).
Or maybe I dont understand your requirements.

Regards.

-Original Message-
From: ruben [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 10:19 AM
To: Struts Users Mailing List
Subject: Re: html inside an action
Qureshi, Affan wrote:



 

What part of JSP do you want to generate? Is it Java code in the JSP 
that you want to generate or static HTML/JavaScript? You might want to
   

 

look at Tag Libraries as well.

-Original Message-
From: ruben [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 10:00 AM
To: Struts Users Mailing List
Subject: html inside an action
hi!
how can i get the output generate in a .jsp inside an action like it 
was a resource that i can process(a String or something else)???
thanks a lot in advance.

PD: I need to call jasper compiler or something similar? what can i do
   

 

that? thanks

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


 
   

hi, thanks for the response, i want the code generated 
(HTML/javascript), it's like redirect the output to a resource that i 
can process in the action instead of send to the navigator,
thanks a lot

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


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



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


Re: Handling Date objects in ActionForm gracefully

2004-03-26 Thread Mark Lowe
I think the way of going about converting is pretty open, either have 
some conversion utils between the web tier and the model. I tend to do 
it in the action and then when things get long or i need the code again 
move it out into  a util class or like you're saying make my model util 
classes deal with strings (this makes a lot of sense as then other 
front ends can be plugged on).

Talk of MVC aside (after all MVC is a broader issue than the particular 
pattern that struts is based on) why piss about dealing with all sorts 
of errors and exceptions being thrown in the place where its hardest to 
deal with them?

You can and people do use different types for form beans, but I just 
don't see the point. Date comes up often and lets face it dates are 
more user friendly as dropdown menus rather than free text, so  
getDay() , getMonth() and getYear() IMO are a simpler way of going 
about things. Then have methods in you model that create a date based 
on that, or have a util class in the web tier as you can deal with 
validating the three values. Perhaps even have a date that's in you 
form bean but is set and got (passed participle of get) via string 
flavors day, month and year.

Not sure if this works but I think the idea is valid (corrections 
welcome).

public class SomeForm extends ActionForm {

	private Calendar aDate = Calender.instance();

public String getDay() {
int d = aDate.get(Calendar. DAY_OF_MONTH);
return Integer.toString(d);
}
public void setDay(String day) {
aDate.set(Calendar.DAY_OF_MONTH,Integer.parseInt(day));
}
...
protected Date getAdate() {
return dDate.getTime();
}
}
This way come checking and comparing values before can be done, before 
passing anything up to you model. Many folk would say that this should 
be done in the model, but i'd say situations where you need to check if 
a user has entered a valid date (e.g. expire and from dates with a 
credit card).

This functionality will want to be produced even if you change the 
model , if you wanted to demo your web tier on its own (without a model 
e.g acme ltd credit card form)  and therefore doing it ONLY in the 
model would be limited.

Very much IMO and I'm not MVC guru, but that's my understanding.

On 26 Mar 2004, at 09:43, Freddy Villalba Arias wrote:

As someone with good experience in MVC-based applications but a newbie
to Struts, what I understand from this discussion is that the
recommended implementation would have to comply, at least, with this
guidelines:
- The conversion code is encapsulated in a separate class (I suppose 
one
converter class per each String, Target Data Type combination
required, right?).

- Passes all (String) parameters to a Business Object that encapsulates
the use case (I mean, the logic) and, from within that BO, use the
corresponding converter classes for getting the actual data object to
flow around (i.e. be eventually get-ed or set-ed from the DAOs/DTOs, 
bla
bla bla...)

I'm I right here or am I missing any other IMPORTANT aspect(s)?

STILL, there is something I don't get: how would you implement /
encapsulate then the opposite direction for data conversion; in other
words:
- Convert from original data types towards String (another method in
the same converter class?)
- Map (set) some (non-String) data object into the corresponding String
property on the form bean.
Thanks,
Freddy.
-Mensaje original-
De: Mark Lowe [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 26 de marzo de 2004 0:59
Para: Sreenivasa Chadalavada; Struts Users Mailing List
Asunto: Re: Handling Date objects in ActionForm gracefully
You deal with the conversion else where but not in the form bean, you
can argue about it or just believe me. The action form sits between the
view and the action, the date conversion goes on between the action and

the model.

Your approach isn't that bad its just not to the MVC pattern that
struts follows (not that its the only one).
Create a date convertion util class or something.

If you dont want to take my word for it here's what craig had to say
albeit in response to a different question
snippet
As the original designer of Struts :-), I must point out that the
design of
ActionForm (and the recommendation that form bean properties be
Strings) is
***very*** deliberate.  The reason this is needed is obvious when you
consider
the following use case:
* You have an input form that, say, accepts only integers.

* Your form bean property is of type int.

* The user types 1b3 instead of 123, by accident.

* Based on experience with any garden variety GUI application,
   the user will expect that they receive an error message,
   plus a redisplay of the form ***WITH THE INCORRECT VALUES
   THAT WERE ENTERED DISPLAYED SO THE USER CAN CORRECT THEM***.
* The current Struts environment will throw an exception
   due to the conversion failure.
* The suggested solution will 

RE: problem with module

2004-03-26 Thread Colm Garvey
I've just finished fixing what I think is the same problem you guys have
been
having i.e. switching modules on Struts 1.1

First, make sure you have the most recent release build of struts, as I had
problems
with earler 1.1 builds on weblogic 8.1

I originally started with the simple-module-switching application to get
things going and I
had to make a few modifications to get it working.

You can download it from http://www.garvey.ie/struts/multimod.zip and
hopefully you will be
able to spot where things are going wrong.

Hope this helps,

Colm

-Original Message-
From: ruben [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 15:22
To: Struts Users Mailing List
Subject: Re: problem with module


Daniel wrote:

If someone know the solution help us..


- Original Message -
From: Daniel [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 11:01 AM
Subject: Re: problem with module




Hi I have the the same problem, but in other situation, I using popups
windows of other modules, if you find the solution tell me , if I find the
solution I tell you...

- Original Message -
From: ruben [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 6:19 AM
Subject: problem with module




hi everybody, excuse me for my english,
that is the scenario,
 i've got 2 modules, default and mod1, i call from mod1 an action that
load a page with  2 iframes, that load a page resource, these resources
are in the /page context, struts add /mod1 to the context, and i have to
use a SwitchAction. My problem is when load a form that is in the page
resource,i've got a ServletException: Cannot retrieve mapping for action
/GestionUbicacion,
i try to prepend /mod1 but i've got the same error, does anybody know
the way to slove this?
thanks a lot.




-
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]



hi, i solve this. I do the next thing that i found in the archives ...

http://www.mail-archive.com/[EMAIL PROTECTED]/msg96007.html

i change the module before call the page, and it seems to work in this
scenario,





-
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: Handling Date objects in ActionForm gracefully

2004-03-26 Thread Joe Hertz

Since I just wrestled greatly with this particular beast, my $.02 follows.

Subclass whatever flavor of ActionForm you use, and give it a method with a 
footprint like-

java.util.Date StringToDate(String) 
{
}

This way you can do something like this in your action:

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
  Myform mf = (Myform) form;
  BizObject bo = new BizObject();
  String dateText = mf.getDateString();
  bo.setDate(mf.StringToDate(dateText);
  // etc
}

This works very well unless internationalizing your app because the converter 
needs a DateFormat defined to read the String correctly. And I am, so I need 
to come up with something.

I don't suppose there is a version of BeanUtils that lets the user pass a 
DateFormat into copyProperties :-)???

-Joe


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Friday, March 26, 2004 3:58 AM
 To: Struts Users Mailing List
 Subject: RE: Handling Date objects in ActionForm gracefully
 
 
 
 
 +1
 I also suggest this approach to keep the date as string 
 during posts and convert them to date object when porcessing 
 the entered dates, surely not in the Form.
 
 Depends on  what you really want to achieve. Would suggest 
 the KISS rule..:-)
 
 
 
 
 
 Robert Taylor [EMAIL PROTECTED] on 03/25/2004 08:53:31 PM
 
 Please respond to Struts Users Mailing List 
 [EMAIL PROTECTED]
 
 To:   Struts Users Mailing List [EMAIL PROTECTED]
 cc:(bcc: Anuj Upadhyay/Jeppesen/TMC)
 
 Subject:  RE: Handling Date objects in ActionForm gracefully
 
 
 
 +1
 
  -Original Message-
  From: Mark Lowe [mailto:[EMAIL PROTECTED]
  Sent: Thursday, March 25, 2004 2:36 PM
  To: Struts Users Mailing List
  Subject: Re: Handling Date objects in ActionForm gracefully
 
 
  Have it as a string and convert it to a date or calendar 
 when you pass 
  it back to the model.
 
 
  On 25 Mar 2004, at 20:28, Sreenivasa Chadalavada wrote:
 
   All,
  
   We are facing a problem when we define java.util.Date field in 
   ActionForm.
  
   Is there any way to override the default behavior provided by 
   Struts?
  
   I very much appreciate your help!!
  
   Thanks and Regards,
   Sree/-
  
  
   
 
   ---
   -
   This is a PRIVATE message. If you are not the intended recipient,
   please
   delete without copying and kindly advise us by e-mail of 
 the mistake in
   delivery. NOTE: Regardless of content, this e-mail shall 
 not operate to
   bind CSC to any order or other contract unless pursuant 
 to explicit
   written agreement or government initiative expressly 
 permitting the
   use of
   e-mail for such purpose.
   
 --
 -
   -
 
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

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



How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Martin Alley
Hi,

Suppose I've got a web based form that posts data to an action, and I
have that action protected by container form based authorization - how
does the ActionForm data get through.

I have a situation like this, and my ActionForm is empty after I've been
through the form-based login page.

One could say - stick the input form in the constrained area also, so
the login page doesn't come between the input form and the action that
processes it - but this is actually occurring when a session times out
whilst sitting at the input form.

Thanks
Martin




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



RE: Handling Date objects in ActionForm gracefully

2004-03-26 Thread Freddy Villalba Arias
Mark, didn't mean to be pedantic... just wanted to prevent everybody
from going through all the (obvious / basic / simple) details and just
go to the important stuff. Neither am I an MVC guru.

In any case, thanx everybody 4 your help.

Regards,
Freddy.


-Mensaje original-
De: Mark Lowe [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 26 de marzo de 2004 10:24
Para: Struts Users Mailing List
Asunto: Re: Handling Date objects in ActionForm gracefully

I think the way of going about converting is pretty open, either have 
some conversion utils between the web tier and the model. I tend to do 
it in the action and then when things get long or i need the code again 
move it out into  a util class or like you're saying make my model util 
classes deal with strings (this makes a lot of sense as then other 
front ends can be plugged on).

Talk of MVC aside (after all MVC is a broader issue than the particular 
pattern that struts is based on) why piss about dealing with all sorts 
of errors and exceptions being thrown in the place where its hardest to 
deal with them?

You can and people do use different types for form beans, but I just 
don't see the point. Date comes up often and lets face it dates are 
more user friendly as dropdown menus rather than free text, so  
getDay() , getMonth() and getYear() IMO are a simpler way of going 
about things. Then have methods in you model that create a date based 
on that, or have a util class in the web tier as you can deal with 
validating the three values. Perhaps even have a date that's in you 
form bean but is set and got (passed participle of get) via string 
flavors day, month and year.

Not sure if this works but I think the idea is valid (corrections 
welcome).

public class SomeForm extends ActionForm {

private Calendar aDate = Calender.instance();

public String getDay() {
int d = aDate.get(Calendar. DAY_OF_MONTH);
return Integer.toString(d);
}

public void setDay(String day) {
aDate.set(Calendar.DAY_OF_MONTH,Integer.parseInt(day));
}
...
protected Date getAdate() {
return dDate.getTime();
}
}

This way come checking and comparing values before can be done, before 
passing anything up to you model. Many folk would say that this should 
be done in the model, but i'd say situations where you need to check if 
a user has entered a valid date (e.g. expire and from dates with a 
credit card).

This functionality will want to be produced even if you change the 
model , if you wanted to demo your web tier on its own (without a model 
e.g acme ltd credit card form)  and therefore doing it ONLY in the 
model would be limited.

Very much IMO and I'm not MVC guru, but that's my understanding.

On 26 Mar 2004, at 09:43, Freddy Villalba Arias wrote:

 As someone with good experience in MVC-based applications but a newbie
 to Struts, what I understand from this discussion is that the
 recommended implementation would have to comply, at least, with this
 guidelines:

 - The conversion code is encapsulated in a separate class (I suppose 
 one
 converter class per each String, Target Data Type combination
 required, right?).

 - Passes all (String) parameters to a Business Object that
encapsulates
 the use case (I mean, the logic) and, from within that BO, use the
 corresponding converter classes for getting the actual data object
to
 flow around (i.e. be eventually get-ed or set-ed from the DAOs/DTOs, 
 bla
 bla bla...)

 I'm I right here or am I missing any other IMPORTANT aspect(s)?

 STILL, there is something I don't get: how would you implement /
 encapsulate then the opposite direction for data conversion; in other
 words:

 - Convert from original data types towards String (another method in
 the same converter class?)

 - Map (set) some (non-String) data object into the corresponding
String
 property on the form bean.

 Thanks,
 Freddy.

 -Mensaje original-
 De: Mark Lowe [mailto:[EMAIL PROTECTED]
 Enviado el: viernes, 26 de marzo de 2004 0:59
 Para: Sreenivasa Chadalavada; Struts Users Mailing List
 Asunto: Re: Handling Date objects in ActionForm gracefully

 You deal with the conversion else where but not in the form bean, you
 can argue about it or just believe me. The action form sits between
the

 view and the action, the date conversion goes on between the action
and

 the model.

 Your approach isn't that bad its just not to the MVC pattern that
 struts follows (not that its the only one).

 Create a date convertion util class or something.

 If you dont want to take my word for it here's what craig had to say
 albeit in response to a different question

 snippet
 As the original designer of Struts :-), I must point out that the
 design of
 ActionForm (and the recommendation that form bean properties be
 Strings) is
 ***very*** deliberate.  The reason this is needed is obvious when you
 consider
 the following use case:

Re: i18n with Japanese characters and tags....

2004-03-26 Thread atchy
Thank you for your assist, Mr. Jason
(B
(BJason Lea [EMAIL PROTECTED] wrote:
(B
(B He was saying it 'can' display Japanese characters. The example doesn't
(B have any Japanese characters in in (if i remember correctly), but if
(B they are put into the properties files for the locale they will be
(B displayed.
(B
(BYep. The example app was written as a good example for i18n, so it does 
(Bnot contain any language specific characters directly in the JSPs to 
(Bshare a JSP with many languages.
(BThe messages resource files contain them.
(B
(B
(B You should look into that http://www.anassina.com/struts/i18n/i18n.html
(B page as it explains a lot.
(B 
(B I think the main problem is you have the Japanese characters already
(B converted into HTML in your application as yuo have them in the format
(B #12495;. When you use a bean to write it out, the bean tried to escape
(B any characters that are significant to HTML, and the '' character is
(B one of them. That is why it replaces your '' with 'amp;'. The bean is
(B trying to help by displaying the text you provided in HTML so that it
(B will appear as #12495; on the page. The 'filter=false' stops it doing
(B this, but also means if you have some other characters like '' in your
(B text then they won't be escaped and could cause the page to be rendered
(B incorrectly.
(B
(Bcarlo,
(BThe behavior of bean:write is correct and proper.
(B
(BWhen you write Japanese in your message resource files, you should not 
(Buse the HTML numeric character 
(Breferences(http://www.w3.org/TR/html401/charset.html#h-5.3.1).
(BOr if you insist on using #x, set filter=false.
(B
(B
(BAs I and Jason said, the most common way is, write Japanese characters 
(Binto message resource files directly (using a text editor and input 
(Bmethod that can handle Japanese) and convert using native2ascii.
(B
(B
(B
(B When I display Japanese characters on my pages I store them in Japanese
(B in a .properties file, then use native2ascii to convert those japanese
(B characters into the Java Unicode properties file format of \u. When
(B java reads them in, the actual unicode character is passed around in
(B java and output directly into the html page. The page encoding is set to
(B UTF-8, and the browser can display it correctly. The bean:write will
(B also still escape the characters that need it such as '' and ''. This
(B also means I am not dealing with HTML formatting inside my Java code,
(B and can happily store the same characters in files, databases etc or
(B output to another device instead of HTML.
(B 
(B -- 
(B Jason Lea
(B 
(B 
(B 
(B carlo latasa wrote:
(B 
(B I just checked the example application and did not see anything on Japanese 
(B characters. I'm at:
(B http://localhost:8080/struts-example/tour.do
(B
(BStruts try to choose language encoding according to your browser setting.
(BSo if you are not in Japanese environment, you should change your 
(Bbrowser language.
(B
(BSee 
(B 5. Test it out using a browser that let's you select default languages: 
(Bof
(B http://www.anassina.com/struts/i18n/i18n.html
(B
(BIn this case, you should choose "Japanese[ja]".
(BThen you will see Japanese characters (if your browser has suitable 
(Bfonts).
(B
(B
(BGood luck!
(B
(B
(B
(BYoshinori Ashizawa
(B
(B
(B 
(B Did you mean that if I were to just take this code and modify it to display 
(B these characters? Or is the example somewhere else?
(B 
(B 
(B   
(B 
(B From: [EMAIL PROTECTED]
(B Reply-To: "Struts Users Mailing List" [EMAIL PROTECTED]
(B To: "Struts Users Mailing List" [EMAIL PROTECTED]
(B Subject: Re: i18n with Japanese characters and tags
(B Date: Tue, 23 Mar 2004 16:12:20 +0900
(B 
(B Carlo,
(B 
(B Have you checked the example application included in Struts1.1(or
(B current CVS)? It can show Japanese characters correctly without any
(B special implementations.
(B I think it will be a help for your problem.
(B 
(B The most frequent mistake in such case is lack of unicode escape
(B to their message resource files.
(B Don't forget "native2ascii" when you make your resource files.
(B 
(B see also : http://www.anassina.com/struts/i18n/i18n.html
(B 
(B 
(B Yoshinori Ashizawa
(B Ja-Jakarta Project  www.jajakarta.org
(B 
(B 
(B carlo latasa" [EMAIL PROTECTED] wrote:
(B 
(B 
(B 
(B Hello,
(B 
(B I'm trying to show Japanese characters on my jsp pages however the ""
(B character of the charset is coming back as amp; which is preventing the
(B characters from being displayed correctly. They look like:
(B $B%-%+%9%O(B
(B 
(B Note, the bean:write tag renders the characters correctly when the 
(B   
(B 
(B filter
(B 
(B 
(B attribute is set to "false".
(B 
(B I've got a struts application using both Tomcat and Jrun and I've set my
(B controller element of the struts-config.xml as:
(B 
(B controller contentType="text/html; 

Re: Handling Date objects in ActionForm gracefully

2004-03-26 Thread Mark Lowe
Freddy. No, you misunderstood if you thought I was responding with any 
hostility whatsoever.

There is a general problem where input would be better validated in the 
web tier so it can be decoupled from the model. So times comparing two 
dates would be useful and so on. But i think its also try to say that 
using anything but strings for user input will lead to problems.

And my suggestion could well be incorrect, I was putting it out there 
to see what response it would provoke.

Cheers Mark

On 26 Mar 2004, at 10:51, Freddy Villalba Arias wrote:

Mark, didn't mean to be pedantic... just wanted to prevent everybody
from going through all the (obvious / basic / simple) details and just
go to the important stuff. Neither am I an MVC guru.
In any case, thanx everybody 4 your help.

Regards,
Freddy.
-Mensaje original-
De: Mark Lowe [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 26 de marzo de 2004 10:24
Para: Struts Users Mailing List
Asunto: Re: Handling Date objects in ActionForm gracefully
I think the way of going about converting is pretty open, either have
some conversion utils between the web tier and the model. I tend to do
it in the action and then when things get long or i need the code again
move it out into  a util class or like you're saying make my model util
classes deal with strings (this makes a lot of sense as then other
front ends can be plugged on).
Talk of MVC aside (after all MVC is a broader issue than the particular
pattern that struts is based on) why piss about dealing with all sorts
of errors and exceptions being thrown in the place where its hardest to
deal with them?
You can and people do use different types for form beans, but I just
don't see the point. Date comes up often and lets face it dates are
more user friendly as dropdown menus rather than free text, so
getDay() , getMonth() and getYear() IMO are a simpler way of going
about things. Then have methods in you model that create a date based
on that, or have a util class in the web tier as you can deal with
validating the three values. Perhaps even have a date that's in you
form bean but is set and got (passed participle of get) via string
flavors day, month and year.
Not sure if this works but I think the idea is valid (corrections
welcome).
public class SomeForm extends ActionForm {

	private Calendar aDate = Calender.instance();

public String getDay() {
int d = aDate.get(Calendar. DAY_OF_MONTH);
return Integer.toString(d);
}
public void setDay(String day) {
aDate.set(Calendar.DAY_OF_MONTH,Integer.parseInt(day));
}
...
protected Date getAdate() {
return dDate.getTime();
}
}
This way come checking and comparing values before can be done, before
passing anything up to you model. Many folk would say that this should
be done in the model, but i'd say situations where you need to check if
a user has entered a valid date (e.g. expire and from dates with a
credit card).
This functionality will want to be produced even if you change the
model , if you wanted to demo your web tier on its own (without a model
e.g acme ltd credit card form)  and therefore doing it ONLY in the
model would be limited.
Very much IMO and I'm not MVC guru, but that's my understanding.

On 26 Mar 2004, at 09:43, Freddy Villalba Arias wrote:

As someone with good experience in MVC-based applications but a newbie
to Struts, what I understand from this discussion is that the
recommended implementation would have to comply, at least, with this
guidelines:
- The conversion code is encapsulated in a separate class (I suppose
one
converter class per each String, Target Data Type combination
required, right?).
- Passes all (String) parameters to a Business Object that
encapsulates
the use case (I mean, the logic) and, from within that BO, use the
corresponding converter classes for getting the actual data object
to
flow around (i.e. be eventually get-ed or set-ed from the DAOs/DTOs,
bla
bla bla...)
I'm I right here or am I missing any other IMPORTANT aspect(s)?

STILL, there is something I don't get: how would you implement /
encapsulate then the opposite direction for data conversion; in other
words:
- Convert from original data types towards String (another method in
the same converter class?)
- Map (set) some (non-String) data object into the corresponding
String
property on the form bean.

Thanks,
Freddy.
-Mensaje original-
De: Mark Lowe [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 26 de marzo de 2004 0:59
Para: Sreenivasa Chadalavada; Struts Users Mailing List
Asunto: Re: Handling Date objects in ActionForm gracefully
You deal with the conversion else where but not in the form bean, you
can argue about it or just believe me. The action form sits between
the
view and the action, the date conversion goes on between the action
and
the model.

Your approach isn't that bad its just not to the MVC pattern that
struts follows 

RE: Handling Date objects in ActionForm gracefully

2004-03-26 Thread Freddy Villalba Arias
Cool!

No offence, Mark. In part, it's my fault since English is not my native
tongue and sometimes the same word translated into other language
changes the connotation of a phrase. Sh*t happens! :)

I believe yours is a valid approach (in fact, was one of the options I
was considering for the project we're about to begin). In any case, I'd
appreciate if you or anybody else would share any other views / opinions
about this issue (s) -- or any other related...

Peace, and thanx again everybody.
Freddy.

-Mensaje original-
De: Mark Lowe [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 26 de marzo de 2004 11:05
Para: Struts Users Mailing List
Asunto: Re: Handling Date objects in ActionForm gracefully

Freddy. No, you misunderstood if you thought I was responding with any 
hostility whatsoever.

There is a general problem where input would be better validated in the 
web tier so it can be decoupled from the model. So times comparing two 
dates would be useful and so on. But i think its also try to say that 
using anything but strings for user input will lead to problems.

And my suggestion could well be incorrect, I was putting it out there 
to see what response it would provoke.

Cheers Mark

On 26 Mar 2004, at 10:51, Freddy Villalba Arias wrote:

 Mark, didn't mean to be pedantic... just wanted to prevent everybody
 from going through all the (obvious / basic / simple) details and just
 go to the important stuff. Neither am I an MVC guru.

 In any case, thanx everybody 4 your help.

 Regards,
 Freddy.


 -Mensaje original-
 De: Mark Lowe [mailto:[EMAIL PROTECTED]
 Enviado el: viernes, 26 de marzo de 2004 10:24
 Para: Struts Users Mailing List
 Asunto: Re: Handling Date objects in ActionForm gracefully

 I think the way of going about converting is pretty open, either have
 some conversion utils between the web tier and the model. I tend to do
 it in the action and then when things get long or i need the code
again
 move it out into  a util class or like you're saying make my model
util
 classes deal with strings (this makes a lot of sense as then other
 front ends can be plugged on).

 Talk of MVC aside (after all MVC is a broader issue than the
particular
 pattern that struts is based on) why piss about dealing with all sorts
 of errors and exceptions being thrown in the place where its hardest
to
 deal with them?

 You can and people do use different types for form beans, but I just
 don't see the point. Date comes up often and lets face it dates are
 more user friendly as dropdown menus rather than free text, so
 getDay() , getMonth() and getYear() IMO are a simpler way of going
 about things. Then have methods in you model that create a date based
 on that, or have a util class in the web tier as you can deal with
 validating the three values. Perhaps even have a date that's in you
 form bean but is set and got (passed participle of get) via string
 flavors day, month and year.

 Not sure if this works but I think the idea is valid (corrections
 welcome).

 public class SomeForm extends ActionForm {

   private Calendar aDate = Calender.instance();

   public String getDay() {
   int d = aDate.get(Calendar. DAY_OF_MONTH);
   return Integer.toString(d);
   }

   public void setDay(String day) {
   aDate.set(Calendar.DAY_OF_MONTH,Integer.parseInt(day));
   }
   ...
   protected Date getAdate() {
   return dDate.getTime();
   }
 }

 This way come checking and comparing values before can be done, before
 passing anything up to you model. Many folk would say that this should
 be done in the model, but i'd say situations where you need to check
if
 a user has entered a valid date (e.g. expire and from dates with a
 credit card).

 This functionality will want to be produced even if you change the
 model , if you wanted to demo your web tier on its own (without a
model
 e.g acme ltd credit card form)  and therefore doing it ONLY in the
 model would be limited.

 Very much IMO and I'm not MVC guru, but that's my understanding.

 On 26 Mar 2004, at 09:43, Freddy Villalba Arias wrote:

 As someone with good experience in MVC-based applications but a
newbie
 to Struts, what I understand from this discussion is that the
 recommended implementation would have to comply, at least, with
this
 guidelines:

 - The conversion code is encapsulated in a separate class (I suppose
 one
 converter class per each String, Target Data Type combination
 required, right?).

 - Passes all (String) parameters to a Business Object that
 encapsulates
 the use case (I mean, the logic) and, from within that BO, use the
 corresponding converter classes for getting the actual data object
 to
 flow around (i.e. be eventually get-ed or set-ed from the DAOs/DTOs,
 bla
 bla bla...)

 I'm I right here or am I missing any other IMPORTANT aspect(s)?

 STILL, there is something I don't get: how would you implement /
 encapsulate then the opposite 

Global locale in Struts web applications?

2004-03-26 Thread Jan Normann Nielsen
Hello

I have multiple Struts web applications deployed within Jetty but the 
locale that Struts saves in the session is not shared between the 
contexts. I guess that is to be expected. But how do I create a 
work-around for this problem? I need the applications to share the 
locale so that if you change the locale in one of them, it is also 
changed in the others.

Best regards,
Jan Nielsen
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Pls help me in configuring common logger

2004-03-26 Thread sougata
Hi Van
I am not using simple logger.I am using apache's  commons logger.Pls le me
know how to do it
Thanks
Sougata

-Original Message-
From: Van Riper, Mike [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 12:38 PM
To: 'Struts Users Mailing List'
Subject: RE: Pls help me in configuring common logger


 -Original Message-
 From: sougata [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 25, 2004 9:15 PM
 To: Struts Users Mailing List
 Subject: Pls help me in configuring common logger


 Hi Guys
 I am facing a problem in configuration apaches common logger using
 weblogic8.1.I want to send all my log message to a perticular
 file.I am
 using Common logger for my logging message.How to configure
 Pls let me know

The simple logger that is included in the commons logging package doesn't
support logging to a file, just to the console. You need to understand that
it is primarily intended to provide the common logging API (the simple
logger is included just to get you started) and then you configure it to use
whatever logging facility under the covers that you want to. Most people use
log4j, but, you could also use the native logging support in JDK 1.4 or
greater.

I recommend configuring to use log4j. I also recommend taking the time to
read the short intro manual to log4j found here:

http://tinyurl.com/3hlrq

I recently posted the contents of a simple log4j configuration file that
does have an example of the necessary configuration to write log messages
both to the console and to file. Check the list archives for a recent post
on logging by me. I use this setup with Tomcat and Weblogic. The one
configuration difference I found is that Weblogic doesn't like relative file
paths for location of log files and Tomcat handles that just fine.

Good luck, Van

Mike Van Riper
Silicon Valley Struts User Group
http://www.baychi.org/bof/struts/

P.S. You can either remove the commons logging properties file or explicitly
configure it to use log4j. As long as you setup log4j properly in your
runtime environment, the commons logging logic will use it by default unless
you have a commons logging properties file that explicitly specifies a
different logger implementation.

 Thanks
 Sougata

-
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]



[OT] WSAD problems with Struts

2004-03-26 Thread Oliver Thiel
Hi,


I read that some of you had some problems to run 
Struts apps on WSAD and as I run into that problem
too i wanted to know how you solved it!

I as far as I understand some turned of different validations
including the on concerning Struts, but where couldn't 
fide the right place to do that!

And are their any outher traps that has to be solved?



Thank and have a nice weekend
Oliver

-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz


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



Re: [OT] WSAD problems with Struts

2004-03-26 Thread Susan Bradeen
Oliver,

What version of WSAD are you running? What problems are you having 
specifically?

Validation is controlled through the menu option Window  Preferences  
Validation

Susan Bradeen

Oliver Thiel [EMAIL PROTECTED] wrote on 03/26/2004 08:09:34 AM:

 Hi,
 
 
 I read that some of you had some problems to run 
 Struts apps on WSAD and as I run into that problem
 too i wanted to know how you solved it!
 
 I as far as I understand some turned of different validations
 including the on concerning Struts, but where couldn't 
 fide the right place to do that!
 
 And are their any outher traps that has to be solved?
 
 
 
 Thank and have a nice weekend
 Oliver
 
 -- 
 +++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz 
+++
 100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
 
 
 -
 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] WSAD problems with Struts

2004-03-26 Thread Rouven Gehm
Which version of WSAD are you using ?
I don't have problems with 5.0 + updates or 5.1.

Rouven


- Original Message -
From: Oliver Thiel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 2:09 PM
Subject: [OT] WSAD problems with Struts


 Hi,


 I read that some of you had some problems to run
 Struts apps on WSAD and as I run into that problem
 too i wanted to know how you solved it!

 I as far as I understand some turned of different validations
 including the on concerning Struts, but where couldn't
 fide the right place to do that!

 And are their any outher traps that has to be solved?



 Thank and have a nice weekend
 Oliver

 --
 +++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
 100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz


 -
 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: How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Martin Alley
Well I've just simplified by login form  - plain html - no struts stuff
going on.

I've also simplified the filter so detects a fresh logon and starts a
session accordingly - no longer any redirecting to LoginAction.

However the critical behaviour is still the same - existingCustomerForm
- the one I need to survive the login process still ends up getting
trashed.

I'm wondering if I have to make every form (that might span a session
timeout) part of the login page so that it stays alive - this sounds
like a ridiculous solution.  Has anyone else got a solution?

Thanks
Martin

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 09:41
To: [EMAIL PROTECTED]
Subject: How does ActionForm data pass through container called form
based login page?

Hi,

Suppose I've got a web based form that posts data to an action, and I
have that action protected by container form based authorization - how
does the ActionForm data get through.

I have a situation like this, and my ActionForm is empty after I've been
through the form-based login page.

One could say - stick the input form in the constrained area also, so
the login page doesn't come between the input form and the action that
processes it - but this is actually occurring when a session times out
whilst sitting at the input form.

Thanks
Martin




-
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] WSAD problems with Struts

2004-03-26 Thread Oliver Thiel
Hi,


I have to use: WebSphere Studio Application Developer (Windows)  Version:
5.1.0

I developed my app with the StrutsStudio, as it is not that complex. But
know I have 
to run it on WSAD and run into different problems:

a. WSAD did not like the validation.XML 
   (so deleted it cause I did not use it anyway)

b. I use iBatis for the DB stuff and iBatis needs a newer JDOM version. 
   (so I integrated that and the coresponding DTDs for iBatis, as I was 
not able to referenc it from the net)

so far everything seams to work, but know I got some straing error messages,

that i did not define my ibatis xml  files correctly?!?

But the same app works fine on a Tomcat-Server!


I read in Hubert Rabago mail:
 Just as I suspected.  I'm forced to use WSAD where I work, 
 and I've turned
 off a whole bunch of validations by it, including Struts.  It 
 complains of a
 lot of things that either it doesn't know about or it's just 
 plain wrong
 about.  Fortunately, I only have to run the app there, and 
 not have to do any
 serious coding with it.  My teammates aren't as fortunate, though.


And thought that this could be a way to solve my problem, but did 
not find the right spot to enabel the validation.



Greetings
Oliver




DAMM I allways thougt that using Java would enable me 
to create  a *.war fiel and run it on any Java-application Server! 



 Oliver,
 
 What version of WSAD are you running? What problems are you having 
 specifically?
 
 Validation is controlled through the menu option Window  Preferences  
 Validation
 
 Susan Bradeen
 
 Oliver Thiel [EMAIL PROTECTED] wrote on 03/26/2004 08:09:34 AM:
 
  Hi,
  
  
  I read that some of you had some problems to run 
  Struts apps on WSAD and as I run into that problem
  too i wanted to know how you solved it!
  
  I as far as I understand some turned of different validations
  including the on concerning Struts, but where couldn't 
  fide the right place to do that!
  
  And are their any outher traps that has to be solved?
  
  
  
  Thank and have a nice weekend
  Oliver
  
  -- 
  +++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz 
 +++
  100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
  
  
  -
  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]
 

-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz


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



RE: How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Joe Germuska
At 1:59 PM + 3/26/04, Martin Alley wrote:
Well I've just simplified by login form  - plain html - no struts stuff
going on.
I've also simplified the filter so detects a fresh logon and starts a
session accordingly - no longer any redirecting to LoginAction.
However the critical behaviour is still the same - existingCustomerForm
- the one I need to survive the login process still ends up getting
trashed.
I'm wondering if I have to make every form (that might span a session
timeout) part of the login page so that it stays alive - this sounds
like a ridiculous solution.  Has anyone else got a solution?
It may be a little ridiculous, but if the security implementation 
doesn't pass along form data when it forwards to the intended 
destination, then there's not much you can do about it.

I'm assuming that the container is intercepting before Struts ever 
gets a chance to create an ActionForm based on the submission, so I 
don't think that making them session scoped is likely to help.

This probably doesn't constitute a solution, but perhaps extending 
the session timeout would help a bit.  Perhaps you could come up with 
some kind of javascript hack which calls a URL against the struts app 
periodically to keep the session alive?

Joe
--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
-- Jef Raskin

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


Re: Pls help me in configuring common logger

2004-03-26 Thread roy-strutsuser
On 26 Mar 2004 13:59:25 -, struts-user-digest-help wrote
 Re: Pls help me in configuring common logger
   109791 by: sougata

sougata, if you're using Log4j you need to add a file called
commons-logging.properties file under your WEB-INF/classes directory.  In that
file you need one line:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

Its been my experience that the commons logger does not actually default to
Log4j if its available.

Here is an example of a log4j.properties file:
log4j.rootLogger=ERROR, A1, A2

log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=[file path]
log4j.appender.A2.append=true
log4j.appender.A2.layout=org.apache.log4j.PatternLayout 
log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

The first one is configured for standard out.  The second one writes logs to a
file [file path].  This file should also go under WEB-INF/classes

Roy.

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



Re: html inside an action

2004-03-26 Thread Niall Pemberton
I posted a tag (StoreTag) which will store the generated html from a jsp in
a bean, then in your action you can get the RequestDispatchter and do an
include:

Details in the following messages:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg94956.html
http://www.mail-archive.com/[EMAIL PROTECTED]/msg94935.html


Niall

- Original Message - 
From: ruben [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 3:59 PM
Subject: html inside an action


 hi!
 how can i get the output generate in a .jsp inside an action like it was
 a resource that i can process(a String or something else)???
 thanks a lot in advance.

 PD: I need to call jasper compiler or something similar? what can i do
 that? thanks


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






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



RE: How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Martin Alley
Hi Joe,

I might be able to put some general code in the login form (as a jsp)
that puts all form data present in the previous page into the login form
so it could be passed on, but that will still leave the problem of the
method becomes GET instead of POST.

I'm really hoping there's a more elegant solution - after this
technology's been around for a while!

Thanks
Martin

-Original Message-
From: Joe Germuska [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 14:21
To: Struts Users Mailing List
Subject: RE: How does ActionForm data pass through container called form
based login page?

At 1:59 PM + 3/26/04, Martin Alley wrote:
Well I've just simplified by login form  - plain html - no struts stuff
going on.

I've also simplified the filter so detects a fresh logon and starts a
session accordingly - no longer any redirecting to LoginAction.

However the critical behaviour is still the same - existingCustomerForm
- the one I need to survive the login process still ends up getting
trashed.

I'm wondering if I have to make every form (that might span a session
timeout) part of the login page so that it stays alive - this sounds
like a ridiculous solution.  Has anyone else got a solution?

It may be a little ridiculous, but if the security implementation 
doesn't pass along form data when it forwards to the intended 
destination, then there's not much you can do about it.

I'm assuming that the container is intercepting before Struts ever 
gets a chance to create an ActionForm based on the submission, so I 
don't think that making them session scoped is likely to help.

This probably doesn't constitute a solution, but perhaps extending 
the session timeout would help a bit.  Perhaps you could come up with 
some kind of javascript hack which calls a URL against the struts app 
periodically to keep the session alive?

Joe
-- 
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
   Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
 -- Jef Raskin

-
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: How does ActionForm data pass through container called form b ased login page?

2004-03-26 Thread Pady Srinivasan

This is the only solution I can think of:

public class RedirectServletRequest extends HttpServletRequest {
public RedirectServletRequest(HttpServletRequest req) {
this.request = req;
}

public String getParameter(String name) {
if ( request.getParameter(name) == null ) {
String paramVal = (String)request.getSession().

getAttribute(TEMP_SAVED_PARAM);

request.getSession().removeAttribute(TEMP_SAVED_PARAM);
return paramVal;
}
return (String)request.getParameter(name);
}

// override all other methods using the delegate request
}

public class RedirectActionServlet extends ActionServlet {
public void doPost(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
public void doGet(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
}

public class LoginFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) 
throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest)request;
ServletContext context = filterConfig.getServletContext();

If ( !loggedIn ) {
// save all parameters to session
// save current URI as REDIRECT_URI in session
// redirect to login action
}
}

public class LoginAction extends Action {

public void execute(...) {
// do login 
// login success
// redirect to REDIRECT_URI
}
}



Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 8:59 AM
To: 'Struts Users Mailing List'
Subject: RE: How does ActionForm data pass through container called form
based login page?

Well I've just simplified by login form  - plain html - no struts stuff
going on.

I've also simplified the filter so detects a fresh logon and starts a
session accordingly - no longer any redirecting to LoginAction.

However the critical behaviour is still the same - existingCustomerForm
- the one I need to survive the login process still ends up getting
trashed.

I'm wondering if I have to make every form (that might span a session
timeout) part of the login page so that it stays alive - this sounds
like a ridiculous solution.  Has anyone else got a solution?

Thanks
Martin

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 09:41
To: [EMAIL PROTECTED]
Subject: How does ActionForm data pass through container called form
based login page?

Hi,

Suppose I've got a web based form that posts data to an action, and I
have that action protected by container form based authorization - how
does the ActionForm data get through.

I have a situation like this, and my ActionForm is empty after I've been
through the form-based login page.

One could say - stick the input form in the constrained area also, so
the login page doesn't come between the input form and the action that
processes it - but this is actually occurring when a session times out
whilst sitting at the input form.

Thanks
Martin




-
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 email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

__
This e-mail has been scanned by the Heroix e-mail security system
__

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



Re: Struts Validator and Select boxes

2004-03-26 Thread Niall Pemberton
Posting whats in your validation.xml for the form and the bit of your jsp
with your select fields would be helpfull.

If you take the fromDay as an example, you are using
field.getVarValue(fromDay)  - if you don't have a var defined in your
validation.xml for fromDay then that would cause the No Name Specified
error - same goes for fromYear, toMonth, toDay and toYear.

As for getting nulls, looks to me again that whats specified for the vars
in your validation.xml doesn't tie up with the names specified on your form.

From your code I would expect something like the following in your
validation.xml

form.
field 
varvar-namefromDay/var-name
  var-valueformFromDay/var-value
/var
varvar-namefromYear/var-name
  var-valueformFromYear/var-value
/var
varvar-nametoMonth/var-name
  var-valueformToMonth/var-value
/var
varvar-nametoDay/var-name
  var-valueformToDay/var-value
/var
varvar-nametoYear/var-name
  var-valueformToYear/var-value
/var
/field
/form

Do you have the properties in your form correct (i.e in this example
formFromDay, formFromYear, formToMonth, formToDay, formToYear).

Niall


- Original Message - 
From: Janarthan Sathiamurthy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: Struts Validator and Select boxes


Hi,

I am using Struts validator.
One page of mine has dates displayed as MM  DD .
All the above 3 are displayed in seprate combo/select boxes.
I need to do some custom validations on these fields.
I wrote a custom class for the same
Looks like -
   public static boolean validateDates(Object bean,
ValidatorAction validatorAction,
Field field, ActionErrors errors,
HttpServletRequest request)
   {
  String actionType = ValidatorUtil.getValueAsString(bean,

field.getVarValue(actionType)); // A hidden form field
  String fromMonth = ValidatorUtil.getValueAsString(bean,

field.getProperty());
  String fromDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromDay));
  String fromYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromYear));
  String toMonth = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toMonth));
  String toDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toDay));
  String toYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toYear));

  System.out.println(actionType  + actionType);
  System.out.println(fromMonth  + fromMonth);
  System.out.println(fromDay  + fromDay);
  System.out.println(fromYear  + fromYear);
  System.out.println(toMonth  + toMonth);
  System.out.println(toDay  + toDay);
  System.out.println(toYear  + toYear);

  return true;
   }

O/P of the above code -
actionType searchPage
fromMonth 2
fromDay null
fromYear null
toMonth null
toDay null
toYear null

It also gives me No Name Specified error.
Point to note is that the all other fields other than 'actionType' are
select boxes. It gives a null for all the field types that are of
html:select.
Is this a known BUG or am i going wrong somewhere ?


Error LOG -
Mar 25, 2004 9:53:11 PM org.apache.commons.validator.ValidatorUtil
getValueAsString
SEVERE: No name specified
java.lang.IllegalArgumentException: No name specified
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:721)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80
1)
at
org.apache.commons.validator.ValidatorUtil.getValueAsString(ValidatorUtil.ja
va:121)
at
com.mot.servicetools.util.OCSReportsDateValidator.validateDates(OCSReportsDa
teValidator.j
ava:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:4
54)
at
org.apache.commons.validator.Validator.validateField(Validator.java:544)
at
org.apache.commons.validator.Validator.validate(Validator.java:582)
at
org.apache.struts.validator.DynaValidatorActionForm.validate(DynaValidatorAc
tionForm.java
:125)
at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.j
ava:942)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at 

RE: How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Joe Germuska
I might be able to put some general code in the login form (as a jsp)
that puts all form data present in the previous page into the login form
so it could be passed on, but that will still leave the problem of the
method becomes GET instead of POST.
I'm really hoping there's a more elegant solution - after this
technology's been around for a while!
Yeah, but there are some basic limitations to the container managed 
security model, and I haven't heard any signs that they are being 
addressed.  For example, container managed security doesn't allow you 
to present a login form to a user as a component of any page besides 
the single registered form, and it doesn't allow you to server 
resources from one path with two different states, user authorized 
or not authorized...  Both of those are standard in modern webapps, 
but there's no clean way to handle them using container managed 
security.  (I saw a JDJ article last year that had some work 
arounds...)

So that said, it may not be surprising that the container managed 
security model also has no support for continuing the flow of request 
data to the originally requested URL after logging in.

Joe

--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
-- Jef Raskin

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


RE: How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Martin Alley
Paddy,

Looks like you've been here before!! :-)

It'll take me a bit of time to digest this, but I'll have a look.

Does this actually work for you?

Thanks
Martin

-Original Message-
From: Pady Srinivasan [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 15:21
To: Struts Users Mailing List
Subject: RE: How does ActionForm data pass through container called form
based login page?


This is the only solution I can think of:

public class RedirectServletRequest extends HttpServletRequest {
public RedirectServletRequest(HttpServletRequest req) {
this.request = req;
}

public String getParameter(String name) {
if ( request.getParameter(name) == null ) {
String paramVal = (String)request.getSession().

getAttribute(TEMP_SAVED_PARAM);

request.getSession().removeAttribute(TEMP_SAVED_PARAM);
return paramVal;
}
return (String)request.getParameter(name);
}

// override all other methods using the delegate request
}

public class RedirectActionServlet extends ActionServlet {
public void doPost(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
public void doGet(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
}

public class LoginFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) 
throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest)request;
ServletContext context = filterConfig.getServletContext();

If ( !loggedIn ) {
// save all parameters to session
// save current URI as REDIRECT_URI in session
// redirect to login action
}
}

public class LoginAction extends Action {

public void execute(...) {
// do login 
// login success
// redirect to REDIRECT_URI
}
}



Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 8:59 AM
To: 'Struts Users Mailing List'
Subject: RE: How does ActionForm data pass through container called form
based login page?

Well I've just simplified by login form  - plain html - no struts stuff
going on.

I've also simplified the filter so detects a fresh logon and starts a
session accordingly - no longer any redirecting to LoginAction.

However the critical behaviour is still the same - existingCustomerForm
- the one I need to survive the login process still ends up getting
trashed.

I'm wondering if I have to make every form (that might span a session
timeout) part of the login page so that it stays alive - this sounds
like a ridiculous solution.  Has anyone else got a solution?

Thanks
Martin

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 09:41
To: [EMAIL PROTECTED]
Subject: How does ActionForm data pass through container called form
based login page?

Hi,

Suppose I've got a web based form that posts data to an action, and I
have that action protected by container form based authorization - how
does the ActionForm data get through.

I have a situation like this, and my ActionForm is empty after I've been
through the form-based login page.

One could say - stick the input form in the constrained area also, so
the login page doesn't come between the input form and the action that
processes it - but this is actually occurring when a session times out
whilst sitting at the input form.

Thanks
Martin




-
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 email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__

__
This e-mail has been scanned by the Heroix e-mail security system
__

-
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: How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Martin Alley
I think I need to do some simple test cases - with and without struts.

Martin

-Original Message-
From: Joe Germuska [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 15:20
To: Struts Users Mailing List
Subject: RE: How does ActionForm data pass through container called form
based login page?

I might be able to put some general code in the login form (as a jsp)
that puts all form data present in the previous page into the login
form
so it could be passed on, but that will still leave the problem of the
method becomes GET instead of POST.

I'm really hoping there's a more elegant solution - after this
technology's been around for a while!

Yeah, but there are some basic limitations to the container managed 
security model, and I haven't heard any signs that they are being 
addressed.  For example, container managed security doesn't allow you 
to present a login form to a user as a component of any page besides 
the single registered form, and it doesn't allow you to server 
resources from one path with two different states, user authorized 
or not authorized...  Both of those are standard in modern webapps, 
but there's no clean way to handle them using container managed 
security.  (I saw a JDJ article last year that had some work 
arounds...)

So that said, it may not be surprising that the container managed 
security model also has no support for continuing the flow of request 
data to the originally requested URL after logging in.

Joe


-- 
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
   Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
 -- Jef Raskin

-
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: How does ActionForm data pass through container called form b ased login page?

2004-03-26 Thread Pady Srinivasan

We were going to implement this today or early next week :-)...looking at
the code, I feel you don't need to extend ActionServlet at all. Instead the
filter will create the request before forwarding to the ActionServlet.

public class LoginFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) 
throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest)request;
ServletContext context = filterConfig.getServletContext();

If ( !loggedIn ) {
// save all parameters to session
// save current URI as REDIRECT_URI in session
// redirect to login action
} else if ( redirectUriIsSet ) {
RedirectServletRequest newreq = new

RedirectServletRequest(request);
Chain.doFilter(newreq, response);
}
}

Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 10:35 AM
To: 'Struts Users Mailing List'
Subject: RE: How does ActionForm data pass through container called form
based login page?

Paddy,

Looks like you've been here before!! :-)

It'll take me a bit of time to digest this, but I'll have a look.

Does this actually work for you?

Thanks
Martin

-Original Message-
From: Pady Srinivasan [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 15:21
To: Struts Users Mailing List
Subject: RE: How does ActionForm data pass through container called form
based login page?


This is the only solution I can think of:

public class RedirectServletRequest extends HttpServletRequest {
public RedirectServletRequest(HttpServletRequest req) {
this.request = req;
}

public String getParameter(String name) {
if ( request.getParameter(name) == null ) {
String paramVal = (String)request.getSession().

getAttribute(TEMP_SAVED_PARAM);

request.getSession().removeAttribute(TEMP_SAVED_PARAM);
return paramVal;
}
return (String)request.getParameter(name);
}

// override all other methods using the delegate request
}

public class RedirectActionServlet extends ActionServlet {
public void doPost(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
public void doGet(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
}

public class LoginFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) 
throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest)request;
ServletContext context = filterConfig.getServletContext();

If ( !loggedIn ) {
// save all parameters to session
// save current URI as REDIRECT_URI in session
// redirect to login action
}
}

public class LoginAction extends Action {

public void execute(...) {
// do login 
// login success
// redirect to REDIRECT_URI
}
}



Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 8:59 AM
To: 'Struts Users Mailing List'
Subject: RE: How does ActionForm data pass through container called form
based login page?

Well I've just simplified by login form  - plain html - no struts stuff
going on.

I've also simplified the filter so detects a fresh logon and starts a
session accordingly - no longer any redirecting to LoginAction.

However the critical behaviour is still the same - existingCustomerForm
- the one I need to survive the login process still ends up getting
trashed.

I'm wondering if I have to make every form (that might span a session
timeout) part of the login page so that it stays alive - this sounds
like a ridiculous solution.  Has anyone else got a solution?

Thanks
Martin

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 09:41
To: [EMAIL PROTECTED]
Subject: How does ActionForm data pass through container called form
based login page?

Hi,

Suppose I've got a web based form that posts data to an action, and I
have that action protected by container form based authorization - how
does the ActionForm data get through.

I have a situation like this, and my ActionForm is empty after I've been
through the form-based login page.

One could say - stick the input form in the constrained area also, so
the login page doesn't come between the input form and the action that
processes it - but this is actually occurring when a session times 

RE: How does ActionForm data pass through container called form based login page?

2004-03-26 Thread Martin Alley
I'll be very interested to here the outcome...

Thanks
Martin


-Original Message-
From: Pady Srinivasan [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 16:07
To: Struts Users Mailing List
Subject: RE: How does ActionForm data pass through container called form
based login page?


We were going to implement this today or early next week :-)...looking
at
the code, I feel you don't need to extend ActionServlet at all. Instead
the
filter will create the request before forwarding to the ActionServlet.

public class LoginFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) 
throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest)request;
ServletContext context = filterConfig.getServletContext();

If ( !loggedIn ) {
// save all parameters to session
// save current URI as REDIRECT_URI in session
// redirect to login action
} else if ( redirectUriIsSet ) {
RedirectServletRequest newreq = new

RedirectServletRequest(request);
Chain.doFilter(newreq, response);
}
}

Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 10:35 AM
To: 'Struts Users Mailing List'
Subject: RE: How does ActionForm data pass through container called form
based login page?

Paddy,

Looks like you've been here before!! :-)

It'll take me a bit of time to digest this, but I'll have a look.

Does this actually work for you?

Thanks
Martin

-Original Message-
From: Pady Srinivasan [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 15:21
To: Struts Users Mailing List
Subject: RE: How does ActionForm data pass through container called form
based login page?


This is the only solution I can think of:

public class RedirectServletRequest extends HttpServletRequest {
public RedirectServletRequest(HttpServletRequest req) {
this.request = req;
}

public String getParameter(String name) {
if ( request.getParameter(name) == null ) {
String paramVal = (String)request.getSession().

getAttribute(TEMP_SAVED_PARAM);

request.getSession().removeAttribute(TEMP_SAVED_PARAM);
return paramVal;
}
return (String)request.getParameter(name);
}

// override all other methods using the delegate request
}

public class RedirectActionServlet extends ActionServlet {
public void doPost(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
public void doGet(HttpServletRequest request, ...) {
process(new RedirectActionServlet(request), response);
}
}

public class LoginFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse response,
   FilterChain chain) 
throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest)request;
ServletContext context = filterConfig.getServletContext();

If ( !loggedIn ) {
// save all parameters to session
// save current URI as REDIRECT_URI in session
// redirect to login action
}
}

public class LoginAction extends Action {

public void execute(...) {
// do login 
// login success
// redirect to REDIRECT_URI
}
}



Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 8:59 AM
To: 'Struts Users Mailing List'
Subject: RE: How does ActionForm data pass through container called form
based login page?

Well I've just simplified by login form  - plain html - no struts stuff
going on.

I've also simplified the filter so detects a fresh logon and starts a
session accordingly - no longer any redirecting to LoginAction.

However the critical behaviour is still the same - existingCustomerForm
- the one I need to survive the login process still ends up getting
trashed.

I'm wondering if I have to make every form (that might span a session
timeout) part of the login page so that it stays alive - this sounds
like a ridiculous solution.  Has anyone else got a solution?

Thanks
Martin

-Original Message-
From: Martin Alley [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2004 09:41
To: [EMAIL PROTECTED]
Subject: How does ActionForm data pass through container called form
based login page?

Hi,

Suppose I've got a web based form that posts data to an action, and I
have that action protected by container form based authorization - how
does the ActionForm data get through.

I have a situation like this, 

[OT] JTA, JDBC and data persistence

2004-03-26 Thread Freddy Villalba Arias
Hello everybody,

 

An off-topic question (it's Friday, I hope you accept it!):

 

I want to implement a Business Object Model on top of many DAOs. Those
BOs will be - obviously - related to each other (mainly 1:n and m:n
relationships).

 

I must implement this in such way that, when - for example - deleting a
BO that has 3 children associated (therefore, those must be deleted as
well), it's is possible to do so atomically. That is, I need to be able
to delimit the beginning and the end of the transaction that spans the
delete operation on those 4 objects.

 

I want this to be as transparent and elegant as possible. I believe
the right choice for solving this is using JTA objects (that is XA
objects) instead of plain JDBC. I've been reading the API and some
papers regarding JTA; I have a fundamental doubt:

 

Does JTA allows me to delimit (and perform) 2 independent, yet
concurrent transactions??? For instance: 2 users that click the delete
button at the same time (it's a web application).

 

I haven't seen anything like a transaction ID or similar on any example
I've examined. Is this issue transparent to me? Is JTA able, in any way,
to differentiate the Transaction begun from each user's corresponding
instance of the respective BO (the one they wanted to delete... i.e. the
father, not its children)???

 

I'd appreciate any light you can shed on this matter.

 

Thanks and regards,

Freddy.



Accessing Struts beans with keys defined in the Globals class

2004-03-26 Thread Denis Laroche
Hello everybody,

I hope it's not a trivial question.

I'm trying to access the current Locale from a JSP page. The key to 
access the Locale is stored in variable 
org.apache.struts.Globals.LOCALE_KEY. So what I did is to look up the 
value of the variable in the source file org.apache.struts.Globals.java 
and used that value in a JSP page like this:

${sessionScope['org.apache.struts.action.LOCALE']}

It works but I'm wondering if there's a more direct way, maybe using one 
of the tags provided by the Struts framework, to access beans stored 
under keys defined in Globals.java.

Thanks in advance for any help.

--
Denis Laroche
Pratt  Whitney Canada, Test Facilities
phone 450-677-9411 ext. 5224
pager 514-853-9863
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Calling Class Methods

2004-03-26 Thread Nizeyimana Zabulon
let say your class' name is A and your static method
is aaa();
all you hava to do is A.aaa(); 

 --- Sunny [EMAIL PROTECTED] a écrit :  How can i
invoke static methods of a Class without
 instantiating it in 
 struts
 
 

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






Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! 
Messenger sur http://fr.messenger.yahoo.com

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



Re: Dynaform Type Conversion

2004-03-26 Thread Joe Germuska
--- Joe Hertz [EMAIL PROTECTED] wrote:
  Does Struts provide a method where I provide it the name of the bean
  defined
  in the struts-config.xml and it return me an instance of the appropriate
  class, with all the dyna properties set up?
At 3:19 PM -0800 3/25/04, Hubert Rabago wrote:
It does for the nightly build and Struts 1.2.0, though I can't recall the
name of the method.  For pre-1.2, you'll need to write code to do that.
There was a thread that discussed this, with the last few messages (of that
thread) still coming in today.  Just look for that.  Richard Yee pasted code
there on how to instantiate a Dyna Bean.  I also pointed to an archive where
I pasted the code I use in my apps to instantiate a Dyna Bean.
Right now, you can look up a FormBeanConfig object from a 
ModuleConfig, and then you can use the FormBeanConfig and the 
ActionServlet to get a new ActionForm instance from RequestUtils. 
This does not go through the request/session scope searching that 
Struts uses when it processes the request parameters into a populated 
ActionForm.

Given the fact that this has come up three or four times in the last 
week, it seems clear that it's time to expose a simple method that 
takes a form bean name and a scope and either finds or creates that 
form bean.  I'm just waiting for a few things to settle down -- 
there's going to be a Struts 1.2.1 release pretty soon now, and we 
have to move the CVS repository to a new location as part of Struts 
becoming a top-level Apache project...  but that stuff should get 
straightened out in the next week or two.

Joe

--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
-- Jef Raskin

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


Why there is no getHeader(String headerName) and getHeaders() met hod in HttpServletResponse?

2004-03-26 Thread Zhang, Larry (L.)
Folks, this may be an off topic question, but I am curious to understand why.

We know that Http protocol has features such as Headers. Both response and request 
have HTTP headers. It is easy to get the headers in J2EE from a HttpServletRequest 
objects using getHeader() and/or getHeaders() methods, however, there is no 
corresponding methods in HttpServletResponse. What is the reasoning behind this design?

Thanks.

Larry Zhang

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



RE: access variable value in html tag

2004-03-26 Thread Steltner, Joern
Hallo together,

Thx, for the help. I installed the Tomcat v5.x engine and now it's working
like you guys suggested without EL. 

Regards
Joern

-Original Message-
From: Brian Buchanan [mailto:[EMAIL PROTECTED] 
Sent: Dienstag, 23. März 2004 15:12
To: Struts Users Mailing List
Subject: RE: access variable value in html tag


The Struts-EL is what I'd recommend, which supports exactly what you want to
do, unless you're into (Tomcat 5 and the) JSP 2.0 then you'd just do:
option value=${accounts.number}${accounts.number}/option

Otherwise I _think_ I've done this nastiness and it worked, but I might have
been doing it with plain HTML (non-struts tags):

html:option value=c:out value=${accounts.number}/c:out
value=${accounts.number}//html:option

._.

-Original Message-
From: Steltner, Joern [mailto:[EMAIL PROTECTED]
Sent: Friday, March 19, 2004 7:28 AM
To: [EMAIL PROTECTED]
Subject: access variable value in html tag


Dear,

I'm not an expert in Struts and Java. I need some simple help:

html:select property=no_account
 c:forEach var=accounts items=${Accounts} varStatus=status
  html:option value=c:out
value=${accounts.number}/html:option
 /c:forEach
/html:select

Everything works fine, but at ??? mark I would like take
account.no_account like ${accounts.number}, but it doesn't work. May someone
can give me a small note about the right syntax to get the value from
accounts.number as text in the quotes.

Thanks

Regards
J. Steltner



-
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]



help with modules

2004-03-26 Thread Bruce Christie
Hello,

I am playing around with modules and things work pretty nicely =
except

I have a tiles template that reads in a menu.jsp from the default =
WEB-INF.  The links to the actions are prepended with the module. (i.e. =
html:link action =3Dmodule1/dosomething.do/. )

This works fine expect that once I am in the correct module the link =
then points to  module1/module1/dosomething.do.  Is there a way that the =
link tag can be used so that it will drop the module prefix when I am in =
the module asscoiated with the action?

I think I read something about adding a module @ to the link tag but DTD =
complains.

Thanks
Bruce

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



Re: Why there is no getHeader(String headerName) and getHeaders() met hod in HttpServletResponse?

2004-03-26 Thread Richard Yee
Larry,
I'll go out on a limb here and say that since the
response is being generated on the server by a servlet
or JSP, there is no need for getHeader() or
getHeaders() methods because the developer is setting
them. The HttpServletResponse interface has
addHeader() and addXXXHeader() methods to add headers
to the response. There is also the containsHeader()
method which returns a boolean.

-Richard

--- Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
 Folks, this may be an off topic question, but I am
 curious to understand why.
 
 We know that Http protocol has features such as
 Headers. Both response and request have HTTP
 headers. It is easy to get the headers in J2EE from
 a HttpServletRequest objects using getHeader()
 and/or getHeaders() methods, however, there is no
 corresponding methods in HttpServletResponse. What
 is the reasoning behind this design?
 
 Thanks.
 
 Larry Zhang
 

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


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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



Re: Accessing Struts beans with keys defined in the Globals class

2004-03-26 Thread Nizeyimana Zabulon
try this
session.getAttribute(Globals.LOCALE_KEY);














 --- Denis Laroche [EMAIL PROTECTED] a écrit : 
Hello everybody,
 
 I hope it's not a trivial question.
 
 I'm trying to access the current Locale from a JSP
 page. The key to 
 access the Locale is stored in variable 
 org.apache.struts.Globals.LOCALE_KEY. So what I did
 is to look up the 
 value of the variable in the source file
 org.apache.struts.Globals.java 
 and used that value in a JSP page like this:
 
 ${sessionScope['org.apache.struts.action.LOCALE']}
 
 It works but I'm wondering if there's a more direct
 way, maybe using one 
 of the tags provided by the Struts framework, to
 access beans stored 
 under keys defined in Globals.java.
 
 Thanks in advance for any help.
 
 -- 
 Denis Laroche
 Pratt  Whitney Canada, Test Facilities
 phone 450-677-9411 ext. 5224
 pager 514-853-9863
 [EMAIL PROTECTED]
 
 

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






Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! 
Messenger sur http://fr.messenger.yahoo.com

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



Re: Global locale in Struts web applications?

2004-03-26 Thread Nizeyimana Zabulon
try change the scope of the le locale from session
to application


 --- Jan Normann Nielsen [EMAIL PROTECTED] a
écrit :  Hello
 
 I have multiple Struts web applications deployed
 within Jetty but the 
 locale that Struts saves in the session is not
 shared between the 
 contexts. I guess that is to be expected. But how do
 I create a 
 work-around for this problem? I need the
 applications to share the 
 locale so that if you change the locale in one of
 them, it is also 
 changed in the others.
 
 Best regards,
 Jan Nielsen
 
 

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






Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! 
Messenger sur http://fr.messenger.yahoo.com

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



Re: [OT] JTA, JDBC and data persistence

2004-03-26 Thread Bill Siggelkow
Freddy, I think you only need to look into using JTA and XA transactions 
if you are spanning multiple data sources (databases).  If you are not, 
then I would look into using an Object-relational mapping tool like 
Hibernate or OJB to do what you want to do.  These tools usually provide 
 support for transactions, in addition to providing a mapping layer for 
your objects.

Freddy Villalba Arias wrote:
Hello everybody,

 

An off-topic question (it's Friday, I hope you accept it!):

 

I want to implement a Business Object Model on top of many DAOs. Those
BOs will be - obviously - related to each other (mainly 1:n and m:n
relationships).
 

I must implement this in such way that, when - for example - deleting a
BO that has 3 children associated (therefore, those must be deleted as
well), it's is possible to do so atomically. That is, I need to be able
to delimit the beginning and the end of the transaction that spans the
delete operation on those 4 objects.

 

I want this to be as transparent and elegant as possible. I believe
the right choice for solving this is using JTA objects (that is XA
objects) instead of plain JDBC. I've been reading the API and some
papers regarding JTA; I have a fundamental doubt:
 

Does JTA allows me to delimit (and perform) 2 independent, yet
concurrent transactions??? For instance: 2 users that click the delete
button at the same time (it's a web application).
 

I haven't seen anything like a transaction ID or similar on any example
I've examined. Is this issue transparent to me? Is JTA able, in any way,
to differentiate the Transaction begun from each user's corresponding
instance of the respective BO (the one they wanted to delete... i.e. the
father, not its children)???
 

I'd appreciate any light you can shed on this matter.

 

Thanks and regards,

Freddy.




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


Re: Accessing Struts beans with keys defined in the Globals class

2004-03-26 Thread Denis . Laroche

Thanks,

but is there a way to do it without using Java code directly in the JSP
page?



   
   
  Nizeyimana   
   
  Zabulon  To:  Struts Users Mailing List 
[EMAIL PROTECTED]
  [EMAIL PROTECTED] cc:  
  
   Subject: Re: Accessing Struts beans 
with keys defined in the Globals class 
  03/26/2004 11:43 
   
  AM   
   
  Please respond   
   
  to Struts Users  
   
  Mailing List 
   
   
   
   
   




try this
session.getAttribute(Globals.LOCALE_KEY);














 --- Denis Laroche [EMAIL PROTECTED] a écrit : 
Hello everybody,

 I hope it's not a trivial question.

 I'm trying to access the current Locale from a JSP
 page. The key to
 access the Locale is stored in variable
 org.apache.struts.Globals.LOCALE_KEY. So what I did
 is to look up the
 value of the variable in the source file
 org.apache.struts.Globals.java
 and used that value in a JSP page like this:

 ${sessionScope['org.apache.struts.action.LOCALE']}

 It works but I'm wondering if there's a more direct
 way, maybe using one
 of the tags provided by the Struts framework, to
 access beans stored
 under keys defined in Globals.java.

 Thanks in advance for any help.

 --
 Denis Laroche
 Pratt  Whitney Canada, Test Facilities
 phone 450-677-9411 ext. 5224
 pager 514-853-9863
 [EMAIL PROTECTED]



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







Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez
Yahoo! Messenger sur http://fr.messenger.yahoo.com

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







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



Re: [OT] JTA, JDBC and data persistence

2004-03-26 Thread ian_d_stewart
Freddy,

You may want to take a look at Hibernate (http://www.hibernate.org), if you
haven't done so already.

Hibernate is a persistence mechanism which utilizes XML mappings to map
Java objects to relational database schemas, and does support cascading
deletes, amoung other things.


HTH,
Ian



   

Freddy Villalba Arias

[EMAIL PROTECTED]   To: [EMAIL PROTECTED]   
  
matica.escc:  

  Subject: [OT] JTA, JDBC and data 
persistence 
03/26/2004 10:59 AM

Please respond to  

Struts Users Mailing  

List  

   

   





Hello everybody,



An off-topic question (it's Friday, I hope you accept it!):



I want to implement a Business Object Model on top of many DAOs. Those
BOs will be - obviously - related to each other (mainly 1:n and m:n
relationships).



I must implement this in such way that, when - for example - deleting a
BO that has 3 children associated (therefore, those must be deleted as
well), it's is possible to do so atomically. That is, I need to be able
to delimit the beginning and the end of the transaction that spans the
delete operation on those 4 objects.



I want this to be as transparent and elegant as possible. I believe
the right choice for solving this is using JTA objects (that is XA
objects) instead of plain JDBC. I've been reading the API and some
papers regarding JTA; I have a fundamental doubt:



Does JTA allows me to delimit (and perform) 2 independent, yet
concurrent transactions??? For instance: 2 users that click the delete
button at the same time (it's a web application).



I haven't seen anything like a transaction ID or similar on any example
I've examined. Is this issue transparent to me? Is JTA able, in any way,
to differentiate the Transaction begun from each user's corresponding
instance of the respective BO (the one they wanted to delete... i.e. the
father, not its children)???



I'd appreciate any light you can shed on this matter.



Thanks and regards,

Freddy.







This transmission may contain information that is privileged, confidential and/or 
exempt from disclosure under applicable law. If you are not the intended recipient, 
you are hereby notified that any disclosure, copying, distribution, or use of the 
information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. 
If you received this transmission in error, please immediately contact the sender and 
destroy the material in its entirety, whether in electronic or hard copy format. Thank 
you.


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



FW: newbie html-el question

2004-03-26 Thread Bender, James
 I am trying to display a value from a requestAttribute in an html-el:text
 ... but I can't get it to work.  Here is my code:
 
 html-el:text: property=searchType
 value=%=request.getAttribute(searchType)%/
 
 I recieve the error:
 
 Attribute searchType has no value
 
 Someone told me I have to do something more like this:
 
 html-el:text property=searchType value=${searchType}/
 
 but where would I define the variable searchType that is accessed there?
 I tried defining a local string variable called searchType hoping its
 value would be passed in, but no luck.  Just hitting a wall on what I'm
 hoping is a pretty simple issue.  I googled this one for a while with no
 luck before coming here.  Thanks!,
 
 Jim


This e-mail transmission contains information that is confidential and may be 
privileged.   It is intended only for the addressee(s) named above. If you receive 
this e-mail in error, please do not read, copy or disseminate it in any manner. If you 
are not the intended recipient, any disclosure, copying, distribution or use of the 
contents of this information is prohibited. Please reply to the message immediately by 
informing the sender that the message was misdirected. After replying, please erase it 
from your computer system. Your assistance in correcting this error is appreciated.

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



Re: How to display a bean property with html markup?

2004-03-26 Thread Bill Siggelkow
And if you wanted to use JSTL you would use:
c:out value=${info.infoName} escapeXml=false/
Bill Siggelkow

Anybody knows how to display a bean property with html
markup properly in the output. I have the JSP snippet
code as follows:
HTML

abcdefg bean:write name=info property=infoName /


bean:write name=info property=infoName filter=false/

filter=false tells the tag not to replace things like  with lt;.
That's what you want to hppen in this case.
--
Tim Slattery
[EMAIL PROTECTED]


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


Re: [OT] WSAD problems with Struts

2004-03-26 Thread ian_d_stewart
You can also override the global Validation preferences within the
Validation portion of the Project Properties.


Ian



   
   
Susan Bradeen  
   
[EMAIL PROTECTED]   To: Struts Users Mailing List 
[EMAIL PROTECTED] 
nding.com   cc:   
   
 Subject: Re: [OT] WSAD problems with 
Struts  
03/26/2004 
   
08:35 AM   
   
Please respond 
   
to Struts 
   
Users Mailing  
   
List  
   
   
   
   
   




Oliver,

What version of WSAD are you running? What problems are you having
specifically?

Validation is controlled through the menu option Window  Preferences 
Validation

Susan Bradeen

Oliver Thiel [EMAIL PROTECTED] wrote on 03/26/2004 08:09:34 AM:

 Hi,


 I read that some of you had some problems to run
 Struts apps on WSAD and as I run into that problem
 too i wanted to know how you solved it!

 I as far as I understand some turned of different validations
 including the on concerning Struts, but where couldn't
 fide the right place to do that!

 And are their any outher traps that has to be solved?



 Thank and have a nice weekend
 Oliver

 --
 +++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz
+++
 100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz


 -
 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 transmission may contain information that is privileged, confidential and/or 
exempt from disclosure under applicable law. If you are not the intended recipient, 
you are hereby notified that any disclosure, copying, distribution, or use of the 
information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. 
If you received this transmission in error, please immediately contact the sender and 
destroy the material in its entirety, whether in electronic or hard copy format. Thank 
you.


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



RE: newbie html-el question

2004-03-26 Thread Slattery, Tim - BLS
 
 I am trying to display a value from a requestAttribute in an 
 html-el:text ... but I can't get it to work.  Here is my code:
 
 html-el:text: property=searchType 
 value=%=request.getAttribute(searchType)%/
 
 I recieve the error:
 
 Attribute searchType has no value
 
 Someone told me I have to do something more like this:
 
html-el:text property=searchType value=${searchType}/

That's exactly what you should be doing
 
 but where would I define the variable searchType that is accessed 
 there?

searchType should be saved as an attribute of (preferably) your request
object. Actually, a local variable should also work, you can define it using
the c:set... JSTL tag.

Actually, you shouldn't need to specify a value here at all. The
html-el:text... tag will get the default value from your form bean.


--
Tim Slattery
[EMAIL PROTECTED]


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



RE: newbie html-el question

2004-03-26 Thread Wendy Smoak
From: Bender, James [mailto:[EMAIL PROTECTED] 
 I am trying to display a value from a requestAttribute in 
an html-el:text
 ... but I can't get it to work.  Here is my code:
 html-el:text: property=searchType
 value=%=request.getAttribute(searchType)%/
 
 I recieve the error:
 Attribute searchType has no value
 Someone told me I have to do something more like this:
 html-el:text property=searchType value=${searchType}/
 
 but where would I define the variable searchType that is 
 accessed there?

You wouldn't, you'd set the property of the Form bean and let Struts
handle it.  

If you need to pre-populate the form, you do that in the Action by
calling setSearchType() on your Form bean.  Then when you forward to the
JSP, Struts will fill in the value.

Can you explain more about your situation?  I'm making some assumptions
that may not be correct.

In general there's no need to touch the 'value' attribute of the tags
that render HTML form elements.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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



[OT] SELECT ... LIKE with iBatis

2004-03-26 Thread Andy Engle
Hi all,

I am trying to write a SELECT ... LIKE %whatever% statement with
iBatis but I can't seem to get it to work, nor can I find a clear
explanation of how to do this.  Does anybody have a code snippet they
could share with me of how to do this?

Thanks in advance.


Andy


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



Re: Accessing Struts beans with keys defined in the Globals class

2004-03-26 Thread Joe Germuska
At 1:03 PM -0500 3/26/04, [EMAIL PROTECTED] wrote:
Thanks,

but is there a way to do it without using Java code directly in the JSP
page?
In this cases there is not, although this has been discussed just 
today on struts-dev:
http://article.gmane.org/gmane.comp.jakarta.struts.devel/18429/

In short, you're right that there should be a way, but it hasn't been 
done yet.  Feel free to come join in the discussion!

Joe

--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
-- Jef Raskin

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


Re: [OT] SELECT ... LIKE with iBatis

2004-03-26 Thread Ronald Rotteveel
Hi Andy,

we have a same kind of statement in our xml file and it looks like this:

codesnippet
mapped-statement name=statementName result-map=result
 SELECT * FROM tbl_name WHERE column_name LIKE '%';
/mapped-statement
/codesnippet

Pay attention to the single quotes around the %-sign!

Good luck!

Cheers,

Ronald

- Original Message - 
From: Andy Engle [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 7:47 PM
Subject: [OT] SELECT ... LIKE with iBatis


 Hi all,
 
 I am trying to write a SELECT ... LIKE %whatever% statement with
 iBatis but I can't seem to get it to work, nor can I find a clear
 explanation of how to do this.  Does anybody have a code snippet they
 could share with me of how to do this?
 
 Thanks in advance.
 
 
 Andy
 
 
 -
 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: Pls help me in configuring common logger

2004-03-26 Thread Van Riper, Mike
Sougata,

I can point you in the right direction, but, I don't have time to spell
everything out for you. I think you need to do some work on your own reading
the commons logging docs. You need to  understand the commons logging
package and how to configure it to use log4j or the native logging
facilities in JDK 1.4. When I mentioned the simple logger, I was referring
to this implementation of org.apache.commons.logging.Log:

  org.apache.commons.logging.impl.SimpleLog

If you are using the commons logging package, it has a properties file you
can use to specify which Log interface implementation to use. I could be
wrong, but, when this file is not provided my experience has been that it
will automatically detect the presence of a properly configured log4j and
instantiate a org.apache.commons.logging.impl.Log4JLogger. If a properly
configured log4j is not detected, it will default back to the SimpleLog
implementation.

Good Luck, Van

 -Original Message-
 From: sougata [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 26, 2004 4:12 AM
 To: Struts Users Mailing List; [EMAIL PROTECTED]
 Subject: RE: Pls help me in configuring common logger
 
 
 Hi Van
 I am not using simple logger.I am using apache's  commons 
 logger.Pls le me
 know how to do it
 Thanks
 Sougata
 
 -Original Message-
 From: Van Riper, Mike [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 26, 2004 12:38 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Pls help me in configuring common logger
 
 
  -Original Message-
  From: sougata [mailto:[EMAIL PROTECTED]
  Sent: Thursday, March 25, 2004 9:15 PM
  To: Struts Users Mailing List
  Subject: Pls help me in configuring common logger
 
 
  Hi Guys
  I am facing a problem in configuration apaches common logger using
  weblogic8.1.I want to send all my log message to a perticular
  file.I am
  using Common logger for my logging message.How to configure
  Pls let me know
 
 The simple logger that is included in the commons logging 
 package doesn't
 support logging to a file, just to the console. You need to 
 understand that
 it is primarily intended to provide the common logging API (the simple
 logger is included just to get you started) and then you 
 configure it to use
 whatever logging facility under the covers that you want to. 
 Most people use
 log4j, but, you could also use the native logging support in 
 JDK 1.4 or
 greater.
 
 I recommend configuring to use log4j. I also recommend taking 
 the time to
 read the short intro manual to log4j found here:
 
 http://tinyurl.com/3hlrq
 
 I recently posted the contents of a simple log4j 
 configuration file that
 does have an example of the necessary configuration to write 
 log messages
 both to the console and to file. Check the list archives for 
 a recent post
 on logging by me. I use this setup with Tomcat and Weblogic. The one
 configuration difference I found is that Weblogic doesn't 
 like relative file
 paths for location of log files and Tomcat handles that just fine.
 
 Good luck, Van
 
 Mike Van Riper
 Silicon Valley Struts User Group
 http://www.baychi.org/bof/struts/
 
 P.S. You can either remove the commons logging properties 
 file or explicitly
 configure it to use log4j. As long as you setup log4j properly in your
 runtime environment, the commons logging logic will use it by 
 default unless
 you have a commons logging properties file that explicitly specifies a
 different logger implementation.
 
  Thanks
  Sougata
 
 -
 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: Why there is no getHeader(String headerName) and getHeaders() met hod in HttpServletResponse?

2004-03-26 Thread Zhang, Larry (L.)
Richard,

Thanks for your answers. I think that makes great sense; though I still think to have 
getHeader() or getHeaders() may be helpful when doing debug for response object.

Larry

-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 12:06 PM
To: Struts Users Mailing List
Subject: Re: Why there is no getHeader(String headerName) and
getHeaders() met hod in HttpServletResponse?


Larry,
I'll go out on a limb here and say that since the
response is being generated on the server by a servlet
or JSP, there is no need for getHeader() or
getHeaders() methods because the developer is setting
them. The HttpServletResponse interface has
addHeader() and addXXXHeader() methods to add headers
to the response. There is also the containsHeader()
method which returns a boolean.

-Richard

--- Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
 Folks, this may be an off topic question, but I am
 curious to understand why.
 
 We know that Http protocol has features such as
 Headers. Both response and request have HTTP
 headers. It is easy to get the headers in J2EE from
 a HttpServletRequest objects using getHeader()
 and/or getHeaders() methods, however, there is no
 corresponding methods in HttpServletResponse. What
 is the reasoning behind this design?
 
 Thanks.
 
 Larry Zhang
 

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


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

-
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: Why there is no getHeader(String headerName) and getHeaders() met hod in HttpServletResponse?

2004-03-26 Thread Yee, Richard K,,DMDCWEST
Larry,
For debugging purposes, the org.apache.soap.util.net.TcpTunnelGui utility is
useful. It's in the Jakarta Soap project jar file. It will let you view the
headers and the markup sent to/from your browser.

-Richard


-Original Message-
From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 26, 2004 11:47 AM
To: 'Struts Users Mailing List'
Subject: RE: Why there is no getHeader(String headerName) and getHeaders()
met hod in HttpServletResponse?


Richard,

Thanks for your answers. I think that makes great sense; though I still
think to have getHeader() or getHeaders() may be helpful when doing debug
for response object.

Larry

-Original Message-
From: Richard Yee [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 12:06 PM
To: Struts Users Mailing List
Subject: Re: Why there is no getHeader(String headerName) and
getHeaders() met hod in HttpServletResponse?


Larry,
I'll go out on a limb here and say that since the
response is being generated on the server by a servlet
or JSP, there is no need for getHeader() or
getHeaders() methods because the developer is setting
them. The HttpServletResponse interface has
addHeader() and addXXXHeader() methods to add headers
to the response. There is also the containsHeader()
method which returns a boolean.

-Richard

--- Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
 Folks, this may be an off topic question, but I am
 curious to understand why.
 
 We know that Http protocol has features such as
 Headers. Both response and request have HTTP
 headers. It is easy to get the headers in J2EE from
 a HttpServletRequest objects using getHeader()
 and/or getHeaders() methods, however, there is no corresponding 
 methods in HttpServletResponse. What is the reasoning behind this 
 design?
 
 Thanks.
 
 Larry Zhang
 

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


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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


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

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



RE: html:options where values have embedded quotes

2004-03-26 Thread Colm Garvey
It might not be sexy, but a fast solution would be to use something
else instead of quotes e.g. ^ or | and then use a
small Javascript replace function to write out the text correctly?

Colm

-Original Message-
From: Doug [mailto:[EMAIL PROTECTED]
Sent: 24 March 2004 23:25
To: Struts Users Mailing List
Subject: Re: html:options where values have embedded quotes


Anyone?

Doug wrote:

 We have some customer-supplied selection options that have double quotes 
 in their values, and Struts 1.1 isn't seeming to handle this correctly.
 
 Best I can tell from the HTML spec, these should be placed on the page 
 as quot; , which will submit them as %22 , which *should* be seen on 
 the server side as double quotes again, right?  And Struts should be 
 able to match that to an existing entry so it can properly set the 
 selected value.
 
 Instead, it seems the options tag isn't escaping the quotes at all 
 (changing them to quot;) and that if we manually do it ourselves, the 
 selected item still isn't being set when the page is reloaded.  IIRC, 
 the tag is just leaving the quotes inside the attribute value, which 
 outputs invalid HTML.
 
 Am I missing something?  Is there a better way to do this?  Thanks.
 
 Doug

-
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: newbie html-el question

2004-03-26 Thread Bender, James
Hi Wendy,

Thanks for responding!  Someone showed me a way to do what I needed to do,
but the way I'm approaching the entire problem may be kludged:

The user can click

Search Attributes | Search Components | Search Templates

I've provided html:link's like these respectively:

doPrepareSearch.do?searchType=attribute |
doPrepareSearch.do?searchType=component |
doPrepareSearch.do?searchType=template

so when they user lands on my form, I want to prepopulate the search type
based on what they chose.  If they submit a search with bad data, then I'd
want the SearchForm's (extends ActionForm) validate() method to send the
back to the search form, this time keeping their most recent entries to the
form field -- if they changed search type for example now it would be
different.  

I am new to Struts and may not be getting a key concept of it's Best
Practices usage.  Does it make sense what I've described?  Thanks again!,

Jim


-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 2:03 PM
To: Struts Users Mailing List
Subject: RE: newbie html-el question


From: Bender, James [mailto:[EMAIL PROTECTED] 
 I am trying to display a value from a requestAttribute in 
an html-el:text
 ... but I can't get it to work.  Here is my code:
 html-el:text: property=searchType
 value=%=request.getAttribute(searchType)%/
 
 I recieve the error:
 Attribute searchType has no value
 Someone told me I have to do something more like this:
 html-el:text property=searchType value=${searchType}/
 
 but where would I define the variable searchType that is 
 accessed there?

You wouldn't, you'd set the property of the Form bean and let Struts
handle it.  

If you need to pre-populate the form, you do that in the Action by
calling setSearchType() on your Form bean.  Then when you forward to the
JSP, Struts will fill in the value.

Can you explain more about your situation?  I'm making some assumptions
that may not be correct.

In general there's no need to touch the 'value' attribute of the tags
that render HTML form elements.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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


This e-mail transmission contains information that is confidential and may be 
privileged.   It is intended only for the addressee(s) named above. If you receive 
this e-mail in error, please do not read, copy or disseminate it in any manner. If you 
are not the intended recipient, any disclosure, copying, distribution or use of the 
contents of this information is prohibited. Please reply to the message immediately by 
informing the sender that the message was misdirected. After replying, please erase it 
from your computer system. Your assistance in correcting this error is appreciated.

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



RE: Populating a Listbox

2004-03-26 Thread Colm Garvey
I've come across this in a few difference manifestations and the best
course of action I've come across is dependant on the number of variations.

If you're only talking about a couple of hundred or less, use a javascript
array to populate the second dropdown on the fly.

If you're dealing with more than that [6,000 in my case :)] then you're
better
off using an onChange event handler on the first dropdown to submit the page
back to itself and use the action to generate the 2nd one from the database.
By default, I set the first dropdown to the 1st value and populate the 2nd
one based on that selection.

HTH

Colm

-Original Message-
From: Nilesh [mailto:[EMAIL PROTECTED]
Sent: 12 February 2004 05:50
To: Struts Users Mailing List
Subject: Populating a Listbox


I need to populate some lisbox from database at runtime.
Also, there are situations when I populate one list box depending upon the
value selected in another listbox, all from database.

I am using DBCP to connect to mySQL

1)Are there any special tags available in Struts?

2)Can any one suggest a most efficient method to do this, so that there is
minimum fetching from database.

Also please let me know the syntax of populating the listbox and the event
on which it is to be populated, since I have never done it before.
A small sample code(If you have tried it earlier) would help more.

Thanks in advance.
Nilesh.


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



RE: .swf file

2004-03-26 Thread Colm Garvey
Just the same as any other hyperlink you create with Flash.
Just point your hyperlink to nameoflink.do instead of nameoflink.jsp

Colm

-Original Message-
From: Jignesh Patel [mailto:[EMAIL PROTECTED]
Sent: 24 March 2004 18:02
To: [EMAIL PROTECTED]
Subject: .swf file


Dear Friends,
Can anybody explain me how to use .swf file as a button in struts framework.

-Jignesh

-
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: blocking bookmarked actions

2004-03-26 Thread Colm Garvey
Or wrap the whole app up in frames. That'll do the trick.

Colm

-Original Message-
From: Mark Shifman [mailto:[EMAIL PROTECTED]
Sent: 24 March 2004 18:32
To: Struts Users Mailing List
Subject: Re: blocking bookmarked actions


where do I do the blocking?  The action I am having problems with is a
LookupDispatchAction and I get this kind of error message

javax.servlet.ServletException: Request[/RechartFiles] does not contain
handler parameter named method

org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.
java:199)

...

Paul McCulloch wrote:

You code code your app to always use http POST, but block GETs. This may
not
be suitable if you've already written the app though!

Paul



-Original Message-
From: Mark Shifman [mailto:[EMAIL PROTECTED]
Sent: 24 March 2004 18:17
To: Struts Users Mailing List
Subject: blocking bookmarked actions


Suppose someone bookmarked an action such as
/yourhost/yourapp/someAction.do and you really want them to only go
through the html pages.

How do your block or catch these actions and redirect them to the
appropriate place?

mas


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





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


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



RE: newbie html-el question

2004-03-26 Thread Wendy Smoak
 From: Bender, James [mailto:[EMAIL PROTECTED] 
 The user can click
 Search Attributes | Search Components | Search Templates
 I've provided html:link's like these respectively:
 doPrepareSearch.do?searchType=attribute |
 doPrepareSearch.do?searchType=component |
 doPrepareSearch.do?searchType=template

When the user clicks one of those, Struts will populate the form
associated with (I assume) PrepareSearchAction.  Does the mapping for
that have a 'name' attribute?  Does that Form have get/setSearchType
methods?

If you need to remember data, it's often easiest to put the Form bean
in session scope.  And you can associate one Form to several different
Actions if it makes sense for your application.  Some people will argue
against session scope, so you may want to consult the archives and see
if their reasons apply to your situation.

 so when they user lands on my form, I want to prepopulate the 
 search type based on what they chose.

That will just magically happen if you let Struts populate the form from
the query string parameter and then use the same Form bean when you
display your HTML form using the JSP.

Rather than confuse the issue, if you still need help, post your
struts-config.xml so we can see what you've got.  

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 


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



Re: [OT] SELECT ... LIKE with iBatis

2004-03-26 Thread Andy Engle
Ronald Rotteveel [EMAIL PROTECTED] wrote:

 Hi Andy,
 
 we have a same kind of statement in our xml file and it looks like
 this:

 mapped-statement name=statementName result-map=result
  SELECT * FROM tbl_name WHERE column_name LIKE '%';
 /mapped-statement

Right, but I was running into trouble with where to put my #value#. 
Did you have anything like that in there?  I tried stuff like
'%#value#%', %#value#%, and whatever else but it didn't seem to want to
do anything but sit there and look at me.


Andy


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



Re: help with modules

2004-03-26 Thread James Norman
Try adding contextRelative=true to the forwards in your
struts-config.  I remember a similar problem I had a while back, but I'm
not entirely sure this will solve it.  Here is an example of an Action I
had in a struts module I wrote:

action path=/listLoggers
type=com.perceptive.logconfig.actions.GetLoggersAction
name=loggersForm
attribute=loggers
scope=request
validate=false
forward name=success
path=/WEB-INF/logging/listLoggers.jsp redirect=false
contextRelative=true/
/action

-james
 
On Fri, 2004-03-26 at 10:08, Bruce Christie wrote:
 Hello,
 
 I am playing around with modules and things work pretty nicely =
 except
 
 I have a tiles template that reads in a menu.jsp from the default =
 WEB-INF.  The links to the actions are prepended with the module. (i.e. =
 html:link action =3Dmodule1/dosomething.do/. )
 
 This works fine expect that once I am in the correct module the link =
 then points to  module1/module1/dosomething.do.  Is there a way that the =
 link tag can be used so that it will drop the module prefix when I am in =
 the module asscoiated with the action?
 
 I think I read something about adding a module @ to the link tag but DTD =
 complains.
 
 Thanks
 Bruce
 
 -
 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: Dynamic forward in tiles

2004-03-26 Thread Pedro Salgado
On 25/03/2004 13:22, Mariano García [EMAIL PROTECTED]
wrote:

 El mié, 24-03-2004 a las 20:21, Pedro Salgado escribió:
   Below is a reply sent to this mailing list about something very similar to
 what you are looking for.
 
 but there is any way to use dynamic content only using tiles tags? In my
 case, I have a 'setAttribute(serverLocation, Location)' function in an
 Action in order to store a bean with a location information.
 
 Location is a string (an url), so I want to use this url into a tile
 definition, like this:
 
 definition name=tracebox.def.encoderconfig
 extends=tracebox.def.menu
 put name=title value=encoderconfig /
 put name=body value=LOCATION /
 /definition
 
 I think it must be a easy solution, using tile tags.
 

  The way I presented to you is the cleaner one :)

  If you define the put declaration in Tiles it will always be static (at
least for what I understood and read so far).

  If you want to make a tiles attribute dynamic, you must specify and
implement the tiles controller (described in the other mail).

  The not so clean solution is to use a tiles template with a c:import
url='${request.dynamicTilesAttribute}'/ inside.

 what do you think?

  I guess this is not a question of what I think... It is more of how it
works :)
  This could be a nice feature to Tiles though.

  One could implement a Tiles controller that made this possible. You just
needed to parse all of attributes for ${scope.Attribute} values = it would
be inneficient most of the attributes are static. If the put declaration had
a dynamic attribute (true/false) it would certainly much more
interesting/efficient. Maybe I will try and do this on my weekend ;)



Pedro Salgado
  



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



Use JSP Expression Language in custom tags?

2004-03-26 Thread Chan, Jim

Sorry this is not directly related to Struts, but is it possible to use the
expression language in custom tags?  I think you can, but I am not quite
sure how to do it.  Do you get this for free by just upgrading to a JSP 2.0
compliant server?  Or do I have to do something with the custom tags to get
this behaviour.  For example, I want to do my tag to get his behaviour:

car:model description=%=
((Car)request.getAttribute(Honda)).getDescription()% /

   using the EL like this.

car:model description=${ Honda.description } /



RE: Help on struts

2004-03-26 Thread Shoaib
Thanks for your guidance.
You are right , we are in the case where user will come back from search
page.
I will try as you suggested and give feedback.
 
Regards
Shoaib
 
 
 
I guess the first thing to consider is what you mean by come back to
the
previous page.
Do you just mean have the user redirected back to that url when they
have
finished playing with the search? or is it more complex. For example the
previous page is a form, and they are halfway through filling it in when
they need to search, and on completion need to take up where they left
off
with filling it in?
 
In the first case the easiest way (Im assuming there are multiple places
that send you to the search page) might be to have the link to the
search
page add a parameter to the url containing the name of an ActionForward
that
will take the user back to this page.
 
The search page can make note of this forward name, and when the user is
finished searching can look it up and return it as the forward from the
searchs action.
 
-Original Message-
From: Shoaib [mailto:[EMAIL mailto:%5bEMAIL  PROTECTED]
Sent: Saturday, 13 March 2004 14:01
To: 'Struts Users Mailing List'
Subject: Help on struts
 
 
We are using struts 1.1.
 
We have some pages where user is going to have some search icon and if
user clicks on that then he will move to search page where he can search
the value and then come back to the previous page.
 
Can somebody please give some idea how to do it.
 
Regards
Shoaib
 


Tomcat -- JSP -- KeyPairGenerator -- Security Exception

2004-03-26 Thread Michael McGrady
When I am using Tomcat I get a security exception when I try to access a 
java.security.KeyPairGenerator for a Diffie-Hellman key pair.  I don't get 
it with other servers.  Anyone know why this is?

java.security.NoSuchAlgorithmException: DH KeyPairGenerator not available
java.security.Security.getEngineClassName(Security.java:583)
java.security.Security.getEngineClassName(Security.java:594)
java.security.Security.getImpl(Security.java:1043)
java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:146)
org.apache.jsp.TEST_KEYPAIR_jsp._jspService(TEST_KEYPAIR_jsp.java:57)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)





RE: Struts Validator and Select boxes

2004-03-26 Thread Janarthan Sathiamurthy
Hi Niall,

I am attaching the validation.xml and the jsp that i have used.
I have done the exact thing that you had specified earlier before posting
to the mailing list.
I am not clear where i am going wrong.

The Struts-config entry goes like - 
form-bean name=ocsReportForm 
type=org.apache.struts.validator.DynaValidatorActionForm
form-property name=monthFrom type=java.lang.String /
form-property name=dayFrom type=java.lang.String /
form-property name=yearFrom type=java.lang.String /
form-property name=monthTo type=java.lang.String /
form-property name=dayTo type=java.lang.String /
form-property name=yearTo type=java.lang.String /
form-property name=actionType type=java.lang.String /
form-property name=pageNumber type=java.lang.String /
form-property name=numberOfRows type=java.lang.String /
form-property name=dateFrom type=java.lang.String /
form-property name=dateTo type=java.lang.String /
/form-bean

Regards,
Janarthan S

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 8:55 PM
To: Struts Users Mailing List
Subject: Re: Struts Validator and Select boxes


Posting whats in your validation.xml for the form and the bit of your jsp
with your select fields would be helpfull.

If you take the fromDay as an example, you are using
field.getVarValue(fromDay)  - if you don't have a var defined in your
validation.xml for fromDay then that would cause the No Name Specified
error - same goes for fromYear, toMonth, toDay and toYear.

As for getting nulls, looks to me again that whats specified for the vars
in your validation.xml doesn't tie up with the names specified on your form.

From your code I would expect something like the following in your
validation.xml

form.
field 
varvar-namefromDay/var-name
  var-valueformFromDay/var-value
/var
varvar-namefromYear/var-name
  var-valueformFromYear/var-value
/var
varvar-nametoMonth/var-name
  var-valueformToMonth/var-value
/var
varvar-nametoDay/var-name
  var-valueformToDay/var-value
/var
varvar-nametoYear/var-name
  var-valueformToYear/var-value
/var
/field
/form

Do you have the properties in your form correct (i.e in this example
formFromDay, formFromYear, formToMonth, formToDay, formToYear).

Niall


- Original Message - 
From: Janarthan Sathiamurthy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: Struts Validator and Select boxes


Hi,

I am using Struts validator.
One page of mine has dates displayed as MM  DD .
All the above 3 are displayed in seprate combo/select boxes.
I need to do some custom validations on these fields.
I wrote a custom class for the same
Looks like -
   public static boolean validateDates(Object bean,
ValidatorAction validatorAction,
Field field, ActionErrors errors,
HttpServletRequest request)
   {
  String actionType = ValidatorUtil.getValueAsString(bean,

field.getVarValue(actionType)); // A hidden form field
  String fromMonth = ValidatorUtil.getValueAsString(bean,

field.getProperty());
  String fromDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromDay));
  String fromYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromYear));
  String toMonth = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toMonth));
  String toDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toDay));
  String toYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toYear));

  System.out.println(actionType  + actionType);
  System.out.println(fromMonth  + fromMonth);
  System.out.println(fromDay  + fromDay);
  System.out.println(fromYear  + fromYear);
  System.out.println(toMonth  + toMonth);
  System.out.println(toDay  + toDay);
  System.out.println(toYear  + toYear);

  return true;
   }

O/P of the above code -
actionType searchPage
fromMonth 2
fromDay null
fromYear null
toMonth null
toDay null
toYear null

It also gives me No Name Specified error.
Point to note is that the all other fields other than 'actionType' are
select boxes. It gives a null for all the field types that are of
html:select.
Is this a known BUG or am i going wrong somewhere ?


Error LOG -
Mar 25, 2004 9:53:11 PM org.apache.commons.validator.ValidatorUtil
getValueAsString
SEVERE: No name specified
java.lang.IllegalArgumentException: No name specified
at

RE: html:text -- value attribute won't take rtexprvalue

2004-03-26 Thread Wendy Smoak
 From: Bender, James [mailto:[EMAIL PROTECTED] 
  I'm new to Struts and have searched without luck on this one:
  I have an html:text ... that I'm simply trying to put a runtime
  expression into, like
  % String rtexpr = bob; %
  html:text property=searchType value=%=rtexpr %
  And instead of interprestting the rtexprvalue bob, it 
 actually displays
  the string %=rtexpr % as the value on the screen.  If I 
 just type a
  string into the value field, like this:
  html:text property=searchType value=please

James, did you post this on struts-user yet?  Unless there's more to it
than I initially see, I think it belongs over there rather than the
developers list.
If I did it right, the reply-to is set there.

The usual way to do this is to populate the Form property in your Action
code, and then when you forward to the JSP containing the html:text
tag, Struts will render the HTML for the form element, including the
value.  Note that Struts automatically populates the form from the
request attributes when the user submits the form.  I'm not sure whether
you're trying to pre-populate, or to redisplay user input.

This assumes that you are forcing users to go through the Action (not
letting them go directly to the JSP).  More information will help us
here, I'm avoiding answering your actual question since you did say
you're new to Struts...

If you do find yourself needing to pull things out of the
request/session, the Struts-EL tags will be useful-- html-el:text
property=searchType value=${someVal} /

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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