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

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]



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

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

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]



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

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]


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]



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]



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]



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]



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
 


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

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]



Re: is it possible to define a validation that runs only server side or client side (validation.xml )

2004-03-25 Thread ruben
Seyhan BASMACI (Internet Yazilimlari Yetkilisi) wrote:

I have a LoginForm form extends ValidatorForm and I want to decide 
a validaton runs only on the server or client side, (or both )
is there any way to do this_? 

form name=LoginForm
 field property=userno depends=required
   arg0 key=caption.wusernono/
 /field
/form 

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

hi,
if you want to call th javascript validation you only have to call the 
function
validateLoginForm(form); if you don't call this function, client side 
validation is not called.
the case of server side validation is more complex, if you only want to 
call the client side validation and not the server side, you have to 
overwrite the method validate of the ActionForm, and do nothing on it, 
returning null.

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


RE: html:javascript question

2004-03-25 Thread Colm Garvey
And alternatively,

 logic:messagesPresent
 script language=jscriptalert('bean:message
key=global.error.heading/\n\nhtml:messages id=error - bean:write
name=error/\n\n/html:messages')
 /script
/logic:messagesPresent

global.error.heading=An Error(s) has occured:

Colm

-Original Message-
From: Andreas Solarik [mailto:[EMAIL PROTECTED]
Sent: 24 March 2004 15:18
To: 'Struts Users Mailing List'
Subject: AW: html:javascript question


nice one, didn't even occur to me to do this.

Andreas

-Ursprüngliche Nachricht-
Von: Janarthan Sathiamurthy [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 24. März 2004 16:05
An: Struts Users Mailing List
Betreff: RE: html:javascript question


var myMessage = bean:write name=msg /;
alert(myMessage)

-Original Message-
From: Daniel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:23 PM
To: Struts Users Mailing List
Subject: html:javascript question


I want to put the msg inside a javasript alert (popup with error message
),some one know how can I make it ???

font color=red

html:messages id=msg message=true bundle=geral

bean:write name=msg /br

/html:messages

/font


-
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: db error

2004-03-25 Thread McCormack, Chris
Check your database is up before trying to connect to it. If it is and you can ping 
the database from your application server box, then check your spelling in the data 
source definition.

Chris McCormack

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 11:01
To: Struts Users Mailing List
Subject: db error


Hello All,
i am trying to connect a oracle database, and i get this stack trace, can someone 
please tell me what is wrong with it.
!-- stack trace --
javax.servlet.UnavailableException: Initializing application data source 
org.apache.struts.action.DATA_SOURCE
 at 
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at 
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:257)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:569)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:411)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)
 at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
 at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
 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.catalina.startup.Bootstrap.main(Bootstrap.java:203)


!-- end of stack trace --


--- data sources --

data-sources

!-- data-source type=org.apache.commons.dbcp.BasicDataSource --
data-source
set-property property=driverClassName 
value=oracle.jdbc.driver.OracleDriver /
set-property property=url value=jdbc:oracle:thin:oci8:1521:ora9i /
set-property property=username value=*** /
set-property property=password value=*** /
set-property property=autoCommit value=true /
set-property property=maxCount value=4 /
set-property property=minCount value=2 /
set-property property=validationQuery value=SELECT 1+1 from dual /
/data-source

/data-sources


-- code --
ServletContext context = servlet.getServletContext();
DataSource ds = (DataSource) context.getAttribute(Action.DATA_SOURCE_KEY);
//DataSource ds = getDataSource(req);

try {
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(Select tname, tabtype from tab);

if (!rs.wasNull()) {
/**
 * some records where returned
 */
System.err.println(==);
while (rs.next()) {
System.err.println(Table Name:  + rs.getString(1));
System.err.println(TabType:  + rs.getString(2));
System.err.println(--);
}
System.err.println(==);
}


} catch (SQLException e) {
System.err.println(== Error in getting the connection:  + 
e.getMessage());



---end of code --






--
Rajat Pandit  | [EMAIL PROTECTED]
System Analyst

Manchitra Services Pvt. Ltd (www.manchitra.com)
Tel: 011-26232696 / 26232798
Cellphone: 9818247126
B231 / C GK I
New Delhi 


***
This e-mail and its attachments are confidential
and are intended for the above named recipient
only. If this has 

Re: db error

2004-03-25 Thread Rajat Pandit
Thanks chris,
so this is not because of any missing classes or jar files? is this a
connectivity issue? the database server isup and my other applications
sqlplusw can access it.
any pointers?
sorry about read reciept thing in my previous mail.
rajat
- Original Message -
From: McCormack, Chris [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: RE: db error


Check your database is up before trying to connect to it. If it is and you
can ping the database from your application server box, then check your
spelling in the data source definition.

Chris McCormack

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 11:01
To: Struts Users Mailing List
Subject: db error


Hello All,
i am trying to connect a oracle database, and i get this stack trace, can
someone please tell me what is wrong with it.
!-- stack trace --
javax.servlet.UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE
 at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
4)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3420)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:257)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:569
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:411)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
 at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
 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.catalina.startup.Bootstrap.main(Bootstrap.java:203)


!-- end of stack trace --


--- data sources --

data-sources

!-- data-source type=org.apache.commons.dbcp.BasicDataSource --
data-source
set-property property=driverClassName
value=oracle.jdbc.driver.OracleDriver /
set-property property=url
value=jdbc:oracle:thin:oci8:1521:ora9i /
set-property property=username value=*** /
set-property property=password value=*** /
set-property property=autoCommit value=true /
set-property property=maxCount value=4 /
set-property property=minCount value=2 /
set-property property=validationQuery value=SELECT 1+1 from
dual /
/data-source

/data-sources


-- code --
ServletContext context = servlet.getServletContext();
DataSource ds = (DataSource)
context.getAttribute(Action.DATA_SOURCE_KEY);
//DataSource ds = getDataSource(req);

try {
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(Select tname, tabtype from tab);

if (!rs.wasNull()) {
/**
 * some records where returned
 */
System.err.println(==);
while (rs.next()) {
System.err.println(Table Name:  + rs.getString(1));
System.err.println(TabType:  + rs.getString(2));
System.err.println(--);
}
System.err.println(==);
}


} catch (SQLException e

Re: Users, Roles Access Control in Struts Applications - Where to get information?

2004-03-25 Thread Adam Hardy
This might come through twice - if so, sorry.

On 03/25/2004 11:28 AM Tom Bednarz wrote:

1) How are Roles defined? Where are they stored? I don't want these
things stored in a XML file. Is there a way to store these things
in a database? Is there any documentation about a datamodel
(Fields, datatypes etc)


Hi Tom,
for this you should check the different Realm implementations available,
see the docs on jakarta's tomcat website. There is a JDBC realm  that
sounds right for your purposes.


2) How are roles assigned to users or groups of users? Where are
these assignments stored? Basically roles should be assigned to
groups. Users will then join or leave groups with specific
privileges.


This is done at login by tomcat, but such mechanisms should be available
on all containers. The user name is stored in the session (although not
available to you by session.getAttribute(), only
request.getUserPrincipal() or getRemoteUser() ) plus the roles are
stored as an array of strings, e.g. user, admin, super, available again
via the request.isUserInRole() boolean method. Should be
container-independent.

3) What do I need to do in Struts to configure all this? I read
that since 1.1 I can define a role property in ActionMappings. How
and against what is that definition verified? Are there any
standard/basic mechanisms that can be extended ?


Struts checks against request.isUserInRole(). I don't think it's
standard or basic to extend this. However it's open-source, so you could
do whatever you wanted. The same applies to tomcat.


4) Is there any menu system available, that supports roles and can
be integrated in a Struts based application?


Have you checked out struts-menu? I think it's on source-forge, if not
check for the link on the struts website.


5) Are there any special considerations when moving from Struts 1.0
to 1.1? With other words, is the code backward compatible or will
my working code for 1.0 not work anymore on 1.1?


There's an upgrade doc on the struts website. It is /mostly/ backwards
compatible. I've heard of many people just dropping in the new struts
jar to their project and having no problems.
Adam

--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: db error

2004-03-25 Thread McCormack, Chris
It doesnt appear to be a case of missing classes etc

This exception seems pretty descriptive :
UnavailableException: Initializing application data source 
org.apache.struts.action.DATA_SOURCE

It looks like struts cannot physically get a connection to the specified source, so 
a. it doesnt exist 
b. it does exist but your application cannot get to the source (routing issue?)
c. there is a typo in the connection details. 
d. the connection details are setup incorrectly.

there are other factors etc but I would say this is an initial check list.

data-source key=dev.sitea 
set-property property=autoCommit value=true /
set-property property=descriptionvalue=JDBC data 
source/
set-property property=driverClass
value=oracle.jdbc.driver.OracleDriver/
set-property property=maxCount   value=50/
set-property property=minCount   value=2/
set-property property=password   value=**/
set-property property=user   value=**/
set-property property=url
value=jdbc:oracle:thin:@box:1521:db/
/data-source

A minor difference I have noticed is the use of the '@' symbol to reference your box 
in the url parameter.
I have included one that I know works for one of my systems oracle connection.

Chris McCormack

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 11:11
To: Struts Users Mailing List
Subject: Re: db error


Thanks chris,
so this is not because of any missing classes or jar files? is this a
connectivity issue? the database server isup and my other applications
sqlplusw can access it.
any pointers?
sorry about read reciept thing in my previous mail.
rajat
- Original Message -
From: McCormack, Chris [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: RE: db error


Check your database is up before trying to connect to it. If it is and you
can ping the database from your application server box, then check your
spelling in the data source definition.

Chris McCormack

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 11:01
To: Struts Users Mailing List
Subject: db error


Hello All,
i am trying to connect a oracle database, and i get this stack trace, can
someone please tell me what is wrong with it.
!-- stack trace --
javax.servlet.UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE
 at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
4)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3420)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:257)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:569
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:411)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
 at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
 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

Re: db error

2004-03-25 Thread Rajat Pandit
Hello,
i tried your suggestion but i continue getting the same error.

javax.servlet.UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE
 at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)

we are porting a legacy application to struts and i am using now the same
connection URL.

data-source
set-property property=driverClassName
value=oracle.jdbc.driver.OracleDriver /
set-property property=url value=jdbc:oracle:oci8:@ora9i /
set-property property=username value=** /
set-property property=password value=* /
set-property property=autoCommit value=true /
set-property property=maxCount value=4 /
set-property property=minCount value=2 /
set-property property=validationQuery value=SELECT 1+1 from
dual /
/data-source

any futher suggestions o clues? pls help this is urgent.
regards
rajat


- Original Message -
From: McCormack, Chris [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:58 PM
Subject: RE: db error


It doesnt appear to be a case of missing classes etc

This exception seems pretty descriptive :
UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE

It looks like struts cannot physically get a connection to the specified
source, so
a. it doesnt exist
b. it does exist but your application cannot get to the source (routing
issue?)
c. there is a typo in the connection details.
d. the connection details are setup incorrectly.

there are other factors etc but I would say this is an initial check list.

data-source key=dev.sitea 
set-property property=autoCommit value=true
/
set-property property=descriptionvalue=JDBC
data source/
set-property property=driverClass
value=oracle.jdbc.driver.OracleDriver/
set-property property=maxCount   value=50/
set-property property=minCount   value=2/
set-property property=password   value=**/
set-property property=user   value=**/
set-property property=url
value=jdbc:oracle:thin:@box:1521:db/
/data-source

A minor difference I have noticed is the use of the '@' symbol to reference
your box in the url parameter.
I have included one that I know works for one of my systems oracle
connection.

Chris McCormack

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 11:11
To: Struts Users Mailing List
Subject: Re: db error


Thanks chris,
so this is not because of any missing classes or jar files? is this a
connectivity issue? the database server isup and my other applications
sqlplusw can access it.
any pointers?
sorry about read reciept thing in my previous mail.
rajat
- Original Message -
From: McCormack, Chris [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: RE: db error


Check your database is up before trying to connect to it. If it is and you
can ping the database from your application server box, then check your
spelling in the data source definition.

Chris McCormack

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 11:01
To: Struts Users Mailing List
Subject: db error


Hello All,
i am trying to connect a oracle database, and i get this stack trace, can
someone please tell me what is wrong with it.
!-- stack trace --
javax.servlet.UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE
 at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
4)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3420)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:257)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:569

RE: pre-populating DynaValidatorForm

2004-03-25 Thread Takhar, Sandeep
Isn't this assuming there are no modules?

sandeep

-Original Message-
From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 7:11 PM
To: 'Struts Users Mailing List'
Subject: RE: pre-populating DynaValidatorForm


Dean,
Here's the essential code in order to instantiate a DynaActionForm from
within an Action class.

 FormBeanConfig fbc = new FormBeanConfig();
 fbc.setName(myForm);
 DynaActionFormClass dafc =
 DynaActionFormClass.createDynaActionFormClass(fbc);
 DynaActionForm formBean = (DynaActionForm) dafc.newInstance();
 formBean.set(myProperty, someValue);
 request.setAttribute(myDynaForm,formBean);

-Richard
-Original Message-
From: Hubert Rabago [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 23, 2004 7:48 AM
To: Struts Users Mailing List
Subject: Re: pre-populating DynaValidatorForm


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

hth,
Hubert

--- Dean A. Hoover [EMAIL PROTECTED] wrote:
 I am using struts 1.1, and I am directly instantiating a
 DynaValidatorForm in
 my Action class. I am hesitant to embrace struts 1.2 at this time, 
 especially if
 the difference between 1.1 and 1.2 is as large as betwee 1.0 and 1.1. Is 
 there
 some other way to accomplish it?
 
 Dean Hoover
 
 Hubert Rabago wrote:
 
 What version of Struts are you using?  How are you instantiating your 
 Dyna*Form?  Struts 1.1 didn't really have direct support for 
 instantiating DyanForms from an Action object.  Struts 1.2.0/nightly 
 build does.  Is it possible that you're using 1.1 and instantiating the
form incorrectly?
 
   
 


__
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: LookupDispatchAction default

2004-03-25 Thread Brian Sayatovic/AMIG
Well, I tried overriding unspecified and I still get the following (mind 
you that I didn't change the parameter name yet) when I hit 
/admin/list.do:

Error 500: Request[/admin/list] does not contain handler parameter 
named submit 

My unspecified method I simply overrode from DispatchAction to call my 
normal refresh list method:

protected ActionForward unspecified(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response
) {
return this.refreshList(mapping, form, request, response);
}

While the JavaDocs do imply this should work, when I looked in the Struts 
1.1 source, the execute method of LookupDispatchAction generates the erorr 
message I see as soon as request.getParameter(parameterName) returns null. 
 In fact, I can find no reference to 'unspecified' anywhere in 
LookupDispatchAction.

So I think there is a disconnect.  Maybe LookupDispatchAction is broken 
and should be fixed to also use 'unspecified', or maybe its JavaDocs 
should explicitly state that it does not utilize the 'unspecified' 
behavior of its parent class.  Or, maybe I missed something and didn't 
implement correctly?

Regards,
Brian.




Mark Lowe [EMAIL PROTECTED]
03/24/2004 09:21 AM
Please respond to Struts Users Mailing List

 
To: Struts Users Mailing List [EMAIL PROTECTED]
cc: 
Subject:Re: LookupDispatchAction default



unspecified() is the method you want look at the javadoc.

you do need the method name though

/admin/list.do?method

I saw that using submit as the parameter name causes problems so i 
wouldn't use that.

On 24 Mar 2004, at 15:16, Brian Sayatovic/AMIG wrote:

 I'd like to be able to have someone hit my action, /admin/list.do, 
 without
 having to specify a submit paramater.  However, the action is a 
 subclass
 of LookupDispatchAction whci requires that the request parameter be
 supplied.  Looking in the struts source code, it would be nice if the
 LookupDispatchAction could fall back to a default or not consider 
 'null'
 to be a bad value and just use 'null' as a key to the lookup Map.  For
 now, any link or redirect to the page must specify what I consider to 
 be
 the default action -- refresh -- on the URL:
 /admin/list/do?submit=Refresh.

 Is there another way to do this?  Is it worth suggesting that
 LookupDispatchAction support a default or null mapping?

 Regards,
 Brian.


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





RE: Automatically detecting struts-config changes and reload app.

2004-03-25 Thread Pady Srinivasan

I spent  a few hours trying it out yesterday. There is a Tiles ReloadAction
which I tried to set in the struts-config and tried to call it. But it
didn't help. Finally I went with the Tomcat manager ( app reload ). If
Tomcat recognizes class changes ( WEB-INF/classes ), maybe there is a way to
make it recognize struts-config.xml changes.


Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 24, 2004 10:58 PM
To: Struts Users Mailing List
Subject: Re: Automatically detecting struts-config changes and reload app.

I could not understand what is admin mappings. I am using Struts 1.1
downloaded few months ago. There is nothing like admin in struts-config.xml
included with struts-blank.war. If you please explain it it will be usefule.
I presume that it is similar to Tomcat manager application and I have to
reload it every time by pointing the browser to it. I want it to
automatically detect the change and reload the context . What are other
developers doing to reload the context on struts-config change ?.

Antony Paul

- Original Message -
From: Geeta Ramani [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 7:01 PM
Subject: Re: Automatically detecting struts-config changes and reload app.


 Hey Antony:

 Check out the struts admin functionality: Make sure you have the admin
 mappings in your struts-config.xml, then point your browser to
 /yourContext/admin/reload.do and you'll see the magic..:)

 Regards,
 Geeta

 Antony Paul wrote:

  Is it possible to automatically detect changes in struts-config.xml and
  reload the application ?. I know that Log4J(or Tomcat) detects changes
to
  log4j.properties and reload the application.
 
  Antony Paul
 
  -
  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]


__
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: Dynamic forward in tiles

2004-03-25 Thread Mariano García
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.

what do you think?

-- 
  Mariano García González :: Ingeniero de Sistemas

OPTIVA MEDIAPGP 0x89E8E4CE
O'Donnel 29
28010 Madrid (España)
t. +34 91 577 80 57
www.optivamedia.com

© This message is printed on 100% recycled electrons.


signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada	digitalmente


Re: Re[2]: Are you sure?

2004-03-25 Thread [EMAIL PROTECTED]
Hi Dima, list,  


[Dima wrote] 

we tried to use this (form.onsumbit=return f()) but encountered a 

problem: if JavaScript is disabled in browser the submiting goes on 

without confirmation dialogue and other stuff done by JS (wich in 
our 

case was more important). 


We solved this by setting input.type=button instead of submit  
and
submitting the form from JacaScript. But this caused another  
problem
(though less important): now user can not submit form  pressing
Enter being at text input, he must click the button. 


[end of quote] 


Personally, I would not consider this as a problem. I noticed that 
quite some users mistakenly press the Enter key, without yet  
wanting
to submit. 


So I tried your sollution, and it works fine, making the html:submit 
into a html:button, which calls a javascript function which calls 
submit.  

But since the official submit button has now disappeared, pressing 
enter results in the next button being processed by default, which  
is
the cancel button (which I would not want either). So by 
implementing
this, I cannot use html:cancel anymore.


What would be the best sollution for that? I  thought of putting a
javascript function goCancel() under a html:button, which 
does 
this: 

document.myform.action=somenextpage.do; 

document.myform.submit(); 


However I wonder if there are any smarter sollutions. Is there for
example some way to set IsCancelled to true from the jsp, so I can
just use the same actions as i do with submit?


thanks, Rinke




Tuesday, March 23, 2004, 11:43:54 AM, you wrote: 


JS Try with this - 

JS html:form action=/adddate 

JS   name=dateForm 

JS   type=nl.rinke.DateForm  

JS   onsubmit=return areyousure()  


JS Should work 


JS -Original Message- 

JS From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 

JS Sent: Tuesday, March 23, 2004 3:10 PM 

JS To: [EMAIL PROTECTED] 

JS Subject: are you sure? 



JS Hi list,  


JS Still a struts newbie, I try to write an are you sure javascript


JS confirmation box for my submit button.  


JS The question is: how can I prevent the form from being  
submitted 

JS when the user clicks no?  


JS In the Jsp, I put the following code in the head: 


JS SCRIPT LANGUAGE=javascript 

JSfunction areyousure(){ 

JS   var agree = false; 

JS   agree = confirm(are you sure?); 

JS   if(agree){ 

JS  ... some code which is not important 

JS   } 

JS   return agree; 

JS} 

JS /SCRIPT 



JS And the form tag looks like this: 


JS html:form action=/adddate 

JS   name=dateForm 

JS   type=nl.rinke.DateForm  

JS   onsubmit=areyousure()  



JS Whatever the user clicks, yes or no, the form  

JS gets submitted. I want to stop submitting the  

JS form when the user click no. 


JS thanks, Rinke 



JS 

- 

JS To unsubscribe, e-mail: struts-user- 
[EMAIL PROTECTED] 

JS For additional commands, e-mail: 

[EMAIL PROTECTED] 



JS 

- 

JS To unsubscribe, e-mail: struts-user- 
[EMAIL PROTECTED] 

JS For additional commands, e-mail: 

[EMAIL PROTECTED] 




--  

Best regards, 

 Dmitriimailto:[EMAIL PROTECTED] 




- 

To unsubscribe, e-mail: struts-user- 
[EMAIL PROTECTED] For 

additional commands, e-mail: [EMAIL PROTECTED] 


colorparam0100,0100,0100/param--- End of forwarded message
--- 

--- End of forwarded message ---

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



Re: DynaForm Type Conversion

2004-03-25 Thread Hubert Rabago
Take a look at BeanUtils.copyProperties.  By default, though, it doesn't
support conversion of dates, since it wouldn't know how you'd want your dates
formatted.  Check the archives of this list, there's been some discussion on
that.  Another archive you can check is that of the commons-user list.

If you're looking for further reduction in code, take a look at
http://www.rabago.net/struts/formdef which I'm working on.  It's alpha, but
an initial release is coming real soon (and I'm looking for folks to help me
develop/maintain it).

I believe the Struts dev team has plans to include functionality like this in
a future version of Struts.  For now, we either make do with BeanUtils, or do
the conversion ourselves, or through third party plugins like what I'm
working on.  If you feel strongly enough about it, you can rant some more on
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27321 though like I said,
the dev team has plans for supporting this functionality in a future version.
 How near or far into the future might be influenced by user requests.  :)


--- Joe Hertz [EMAIL PROTECTED] wrote:
 
 I have a bean I persist with Hibernate. It's properties are:
 
 2 Floats
 1 Integer (the key)
 2 Dates
 
 Now, relying on my handy dandy copies of Struts KickStart, Struts In
 Action, 
 and all of the Web, I'm apparently supposed to declare these methods in the
 
 Form I am using as Strings since automatic type conversion can fubar them.
 
 But Since the JSP I am using is getting these fields with html:text fields,
 I 
 apparently am supposed to have methods in form to do the type conversion
 for 
 me. Okay, that's light years better than putting this in the business
 layer, 
 but fine.
 
 Is there an Automatic way I can get a DynaBean to do this for me? Maybe a
 Get
 (prop, type) and get(prop, type, value) for the types youd find in
 java.lang?
 
 If not, there should be, because it limits what a DynaBean can do in a big 
 kinda way. Why have a type declaration in the DTD if youre only ever going
 to 
 want to use String and String[] ? :-)
 
 I mean, it's not like I couldnt add such a set of methods to my 
 DynaValidatorActionForm subclass, but what I'd want is for the framework to
 
 use them for me without me needing to know about it. (I dont ask for much,
 do 
 I???).
 
 If not, I'd like to continue to use my Subclassed DynaValidatorActionForm 
 anyway, but I am wondering if it is going to be self-defeating to declare 
 custom getters and setters for properties that are declared in struts
 config? 
 Should I just use it as a non-dyna form?
 
 Maybe I've been up too late (okay, I have) but it's the little things like 
 this that makes me feel like Struts is creating work for me rather than 
 saving me from it. 
 
 
 Tx for indulging my sleepy rant.
 -Joe
 
 

__
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: using html:form with el logic tags

2004-03-25 Thread Takhar, Sandeep
I'm going out on a limb here, but usually I wouldn't do the xml like that with 
html:form since it is unbalanced...

You'll have to find a workaround I think...

sandeep

-Original Message-
From: Simon Pett [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 8:31 AM
To: 'Struts Users Mailing List'
Subject: using html:form with el logic tags



Hi,

Can someone tell me why I get an unbalanced error when I try to optionally
use a form tag? 

org.apache.jasper.JasperException: /pages/common/layouts/layout.jsp(56,1)
The end tag /c:when is unbalanced


tiles:useAttribute name=action/
tiles:useAttribute name=focus/

c:choose
c:when test=${focus != 'na'}
html:form action=${action} focus=${focus}
/c:when
c:otherwise
html:form action=${action}
/c:otherwise
/c:choose

...


Using struts 1.1

Thanks
Simon


-
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: custom tag called with bean properties as attributes

2004-03-25 Thread Hibbs, David
   risc:staaf 
   schaal_nummer=bean:write name=dezeSchaal
 property=schaalNummer/ 

This is a standard tag nesting error.  You can't put tags inside of tag 
attributes.  You CAN put scriptlets, such as your first tag...

   logic:iterate id=dezeSchaal name=%=Risc.BEREKENING%
 property=profielSchalen /

...The key is that you have quotes inside of quotes.  When I need to do 
something similar to what you are, I include the standard name and
property
attributes as used by bean write.  Doing this, your first tag would become

risc:staaf name=dezeSchaal property=schaalNummer /

And in the tag code I can do something like this: 

String schaal_nummer = (String) TagUtils.getRealValueFromBean(
name, property, null, pageContext);

Voila, no nested tags.  Plus it's very easy to read in the JSP.

David Hibbs, ACS
Staff Programmer / Analyst
American National Insurance Company

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



Re: LookupDispatchAction default

2004-03-25 Thread Mark Shifman
Look at the sourc for LookupDispatchAction snippet below:
public ActionForward execute(
   ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
   throws Exception {
   // Identify the request parameter containing the method name
   String parameter = mapping.getParameter();
   if (parameter == null) {
   String message = messages.getMessage(dispatch.handler, 
mapping.getPath());
   throw new ServletException(message);
   }

   // Identify the string to lookup
   String name = request.getParameter(parameter);
   if (name == null) {
   String message =
   messages.getMessage(dispatch.parameter, 
mapping.getPath(), parameter);
   throw new ServletException(message);
   }

It looks for the parameter's value and throws if the name is null so it 
never gets a chance to get to unspecified in Dispatch action.

mas

Brian Sayatovic/AMIG wrote:

Well, I tried overriding unspecified and I still get the following (mind 
you that I didn't change the parameter name yet) when I hit 
/admin/list.do:

   Error 500: Request[/admin/list] does not contain handler parameter 
named submit 

My unspecified method I simply overrode from DispatchAction to call my 
normal refresh list method:

   protected ActionForward unspecified(
   ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response
   ) {
   return this.refreshList(mapping, form, request, response);
   }
While the JavaDocs do imply this should work, when I looked in the Struts 
1.1 source, the execute method of LookupDispatchAction generates the erorr 
message I see as soon as request.getParameter(parameterName) returns null. 
In fact, I can find no reference to 'unspecified' anywhere in 
LookupDispatchAction.

So I think there is a disconnect.  Maybe LookupDispatchAction is broken 
and should be fixed to also use 'unspecified', or maybe its JavaDocs 
should explicitly state that it does not utilize the 'unspecified' 
behavior of its parent class.  Or, maybe I missed something and didn't 
implement correctly?

Regards,
Brian.


Mark Lowe [EMAIL PROTECTED]
03/24/2004 09:21 AM
Please respond to Struts Users Mailing List
   To: Struts Users Mailing List [EMAIL PROTECTED]
   cc: 
   Subject:Re: LookupDispatchAction default



unspecified() is the method you want look at the javadoc.

you do need the method name though

/admin/list.do?method

I saw that using submit as the parameter name causes problems so i 
wouldn't use that.

On 24 Mar 2004, at 15:16, Brian Sayatovic/AMIG wrote:

 

I'd like to be able to have someone hit my action, /admin/list.do, 
without
having to specify a submit paramater.  However, the action is a 
subclass
of LookupDispatchAction whci requires that the request parameter be
supplied.  Looking in the struts source code, it would be nice if the
LookupDispatchAction could fall back to a default or not consider 
'null'
to be a bad value and just use 'null' as a key to the lookup Map.  For
now, any link or redirect to the page must specify what I consider to 
be
the default action -- refresh -- on the URL:
/admin/list/do?submit=Refresh.

Is there another way to do this?  Is it worth suggesting that
LookupDispatchAction support a default or null mapping?
Regards,
Brian.
   



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


 



--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: blocking bookmarked actions

2004-03-25 Thread Mark Shifman
Thanks , I was using jakarta-struts-1.1-rc1 which did the nul parameter 
trapping.
mas

Wendy Smoak wrote:

From: Mark Shifman [mailto:[EMAIL PROTECTED] 
Unfortunately LookupDispatchAction checks for the parameter 
an throws an 
error before it gets a chance to use unspecified(), but it should
be easy enough to modify it and then override dispatchActions 
unspecified().
   

What version?  I think unspecified works right at least since 1.2.0,
probably before that.
But you can use the fact that execute is always called first, so
override execute and check for the parameter.  If it's there, just call
super.execute() and things will work, if it's not there, look
up/construct an ActionForward and return that.
Looking at some old code, that's what I used to do... The newer project
doesn't have an execute method and it works fine when the parameter for
a LookupDispatchAction is not in the request.
 



--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: problem with module

2004-03-25 Thread Daniel
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]



Re: LookupDispatchAction default

2004-03-25 Thread Brian Sayatovic/AMIG
That's exactly my point.

If there is no submit=xxx parameter/value to the action, then it throws 
a NullPointerException.  So my action works like this:

/admin/list.do?submit=Refresh

But not like this:

/admin/list.do

In the second case, there is no submit parameter.  For now, anything I 
want to go to the list for the firs titme, I have it going to the first 
representation.  But what I really want is for it to have a default 
behavior when no submit value is present so I can use the second form of 
the URL instead.  That was why I originally posted.  The initial wave of 
replies suggested I could use 'unspecified', but that didn't work.

So, is the answer:

(a) I should never use the second form because it is evil
(b) I could use the second form but its broken in LookupDispatchAction
(c) something else?

Regards,
Brian.




Mark Shifman [EMAIL PROTECTED]
03/25/2004 08:51 AM
Please respond to Struts Users Mailing List

 
To: Struts Users Mailing List [EMAIL PROTECTED]
cc: 
Subject:Re: LookupDispatchAction default


Look at the sourc for LookupDispatchAction snippet below:
 public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {

// Identify the request parameter containing the method name
String parameter = mapping.getParameter();
if (parameter == null) {
String message = messages.getMessage(dispatch.handler, 
mapping.getPath());
throw new ServletException(message);
}

// Identify the string to lookup
String name = request.getParameter(parameter);
if (name == null) {
String message =
messages.getMessage(dispatch.parameter, 
mapping.getPath(), parameter);
throw new ServletException(message);
}

It looks for the parameter's value and throws if the name is null so it 
never gets a chance to get to unspecified in Dispatch action.

mas

Brian Sayatovic/AMIG wrote:

Well, I tried overriding unspecified and I still get the following (mind 
you that I didn't change the parameter name yet) when I hit 
/admin/list.do:

Error 500: Request[/admin/list] does not contain handler 
parameter 
named submit 

My unspecified method I simply overrode from DispatchAction to call my 
normal refresh list method:

protected ActionForward unspecified(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response
) {
return this.refreshList(mapping, form, request, 
response);
}

While the JavaDocs do imply this should work, when I looked in the Struts 

1.1 source, the execute method of LookupDispatchAction generates the 
erorr 
message I see as soon as request.getParameter(parameterName) returns 
null. 
 In fact, I can find no reference to 'unspecified' anywhere in 
LookupDispatchAction.

So I think there is a disconnect.  Maybe LookupDispatchAction is broken 
and should be fixed to also use 'unspecified', or maybe its JavaDocs 
should explicitly state that it does not utilize the 'unspecified' 
behavior of its parent class.  Or, maybe I missed something and didn't 
implement correctly?

Regards,
Brian.




Mark Lowe [EMAIL PROTECTED]
03/24/2004 09:21 AM
Please respond to Struts Users Mailing List

 
To: Struts Users Mailing List 
[EMAIL PROTECTED]
cc: 
Subject:Re: LookupDispatchAction default



unspecified() is the method you want look at the javadoc.

you do need the method name though

/admin/list.do?method

I saw that using submit as the parameter name causes problems so i 
wouldn't use that.

On 24 Mar 2004, at 15:16, Brian Sayatovic/AMIG wrote:

 

I'd like to be able to have someone hit my action, /admin/list.do, 
without
having to specify a submit paramater.  However, the action is a 
subclass
of LookupDispatchAction whci requires that the request parameter be
supplied.  Looking in the struts source code, it would be nice if the
LookupDispatchAction could fall back to a default or not consider 
'null'
to be a bad value and just use 'null' as a key to the lookup Map.  For
now, any link or redirect to the page must specify what I consider to 
be
the default action -- refresh -- on the URL:
/admin/list/do?submit=Refresh.

Is there another way to do this?  Is it worth suggesting that
LookupDispatchAction support a default or null mapping?

Regards,
Brian.
 



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




 



-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL

Re: LookupDispatchAction default

2004-03-25 Thread Mark Lowe
/admin/list.do?method

On 25 Mar 2004, at 14:02, Brian Sayatovic/AMIG wrote:

Well, I tried overriding unspecified and I still get the following 
(mind
you that I didn't change the parameter name yet) when I hit
/admin/list.do:

Error 500: Request[/admin/list] does not contain handler 
parameter
named submit

My unspecified method I simply overrode from DispatchAction to call my
normal refresh list method:
protected ActionForward unspecified(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response
) {
return this.refreshList(mapping, form, request, 
response);
}

While the JavaDocs do imply this should work, when I looked in the 
Struts
1.1 source, the execute method of LookupDispatchAction generates the 
erorr
message I see as soon as request.getParameter(parameterName) returns 
null.
 In fact, I can find no reference to 'unspecified' anywhere in
LookupDispatchAction.

So I think there is a disconnect.  Maybe LookupDispatchAction is broken
and should be fixed to also use 'unspecified', or maybe its JavaDocs
should explicitly state that it does not utilize the 'unspecified'
behavior of its parent class.  Or, maybe I missed something and didn't
implement correctly?
Regards,
Brian.


Mark Lowe [EMAIL PROTECTED]
03/24/2004 09:21 AM
Please respond to Struts Users Mailing List
To: Struts Users Mailing List 
[EMAIL PROTECTED]
cc:
Subject:Re: LookupDispatchAction default



unspecified() is the method you want look at the javadoc.

you do need the method name though

/admin/list.do?method

I saw that using submit as the parameter name causes problems so i
wouldn't use that.
On 24 Mar 2004, at 15:16, Brian Sayatovic/AMIG wrote:

I'd like to be able to have someone hit my action, /admin/list.do,
without
having to specify a submit paramater.  However, the action is a
subclass
of LookupDispatchAction whci requires that the request parameter be
supplied.  Looking in the struts source code, it would be nice if the
LookupDispatchAction could fall back to a default or not consider
'null'
to be a bad value and just use 'null' as a key to the lookup Map.  For
now, any link or redirect to the page must specify what I consider to
be
the default action -- refresh -- on the URL:
/admin/list/do?submit=Refresh.
Is there another way to do this?  Is it worth suggesting that
LookupDispatchAction support a default or null mapping?
Regards,
Brian.


-
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: problem with module

2004-03-25 Thread Daniel
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]



Re: html:options where values have embedded quotes

2004-03-25 Thread Joe Germuska
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.
Sounds like a bug to me.  You can see from the code
http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java?view=markup
that no manipulation is being done to content being rendered between 
attribute quote-delimiters.

Please file a bug at http://issues.apache.org/bugzilla/

Joe

PS it appears that other tags have the same problem; at least, I 
initially looked at OptionTag instead of OptionsTag, and it 
definitely needs the same fix:
http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java?view=markup

--
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: R: Automatically detecting struts-config changes and reload app.

2004-03-25 Thread Joe Germuska
If I don't remove the attribute following requests will not work (because of
the code
in ActionServlet.getRequestProcessor)
Is this a bug?
That sounds like a bug to me.  I'm thinking that destroy methods 
should remove from the application context anything the instance put 
into the context earlier.  Perhaps you can file a bug at 
http://issues.apache.org/bugzilla/  Patches are always appreciated.

3) Don't you think that something like that could be useful? I mean, if
answer to 1) is NO,
wouldn't be useful to have a configuration reloader with struts?
This is something people have been requesting for a long time, as a 
search of the mailing list archives would reveal.  I don't recall the 
details, but I seem to remember some arguments as to why this wasn't 
being done.  Like I said, I don't recall, so I don't know if someone 
thought it was impossible, a bad idea, or just something they weren't 
going to sit down and do -- but it's probably worth a little research 
before going too far.

There is some discussion on struts-dev right now about changes 
(extensions) to the way that struts config files are loaded.  Maybe 
now would be a good time to also weigh in on how they could be 
*reloaded*.

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: Automatically detecting struts-config changes and reload app.

2004-03-25 Thread Pady Srinivasan

I used your code ( Thanks ) and I finally got it to work with a Filter. We
have a login filter in our app. So I added a method which runs only in
development mode. 

* Set the DEVELOPMENT_MODE system property during development.
* Add the WEB-INF directory to the classpath. ( does Tomcat include this in
the classpath ? )
* Call this method from the doFilter() method in your filter.

  private long lastModified = 0;
  private void reloadConfig(HttpServletRequest request) {
  if ( System.getProperty(DEVELOPMENT_MODE) != null ) {
try {
URL url = LoginFilter.class.getResource(/struts-config.xml);
if ( url == null )
return;
File f = new File(url.getFile());
if ( f.lastModified() != lastModified ) {
ActionServlet as = ( (ActionServlet)
request.getSession().getServletContext().getAttribute(
Globals.ACTION_SERVLET_KEY));
as.destroy();
 
request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
CESSOR_KEY);
as.init();
System.out.println(Reload ok.);
}
lastModified = f.lastModified();
}
catch (Exception ex) {
ex.printStackTrace();
}
  }
  }
}




Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Leonardo Francalanci [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 7:19 AM
To: Struts Users Mailing List
Subject: R: Automatically detecting struts-config changes and reload app.

I wrote the following on 01/23/2004 on the mailing list, but nobody cared...





I wrote a servlet to trigger off a reload of the struts-config.xml.

The servlet is:

protected void doGet(..) {

ActionServlet as =
((ActionServlet)request.getSession().getServletContext().getAttribute(Global
s.ACTION_SERVLET_KEY));
as.destroy();

request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
CESSOR_KEY);
as.init();

new PrintStream(response.getOutputStream()).println(Reload
ok.);
}


Now my questions...

1) Is there another way to trigger off a reload without using the Tomcat's
reload
function (which takes a very long time and leaves db connections open?)

2) I had to call removeAttribute(Globals.REQUEST_PROCESSOR_KEY) because the
destroy method
of the ActionServlet doesn't do it. Here is the code (from
ActionServlet.destroyModules()):

[..]
if (value instanceof ModuleConfig) {
ModuleConfig config = (ModuleConfig) value;
getRequestProcessor(config).destroy();

getServletContext().removeAttribute(name);

I think there should be something like

getServletContext().removeAttribute(Globals.REQUEST_PROCESSOR_KEY +
config.getPrefix());

If I don't remove the attribute following requests will not work (because of
the code
in ActionServlet.getRequestProcessor)

Is this a bug?


3) Don't you think that something like that could be useful? I mean, if
answer to 1) is NO,
wouldn't be useful to have a configuration reloader with struts?

4) Calling actionServlet.destroy() and actionServlet.init() is enough to
re-load the whole
struts-config.xml?





-
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: LookupDispatchAction default

2004-03-25 Thread Wendy Smoak
 From: Brian Sayatovic/AMIG [mailto:[EMAIL PROTECTED] 
 That's exactly my point.
 If there is no submit=xxx parameter/value to the action, 
 then it throws 
 a NullPointerException.  So my action works like this:
 /admin/list.do?submit=Refresh
 But not like this:
 /admin/list.do
 So, is the answer:
 (a) I should never use the second form because it is evil
 (b) I could use the second form but its broken in LookupDispatchAction
 (c) something else?

What version of Struts are you using?  I suspect you're on 1.1 or
something older than a nightly build.  The javadocs on the Struts site
go with the nightly builds.

The unspecified method is in DispatchAction, and is inherited by
LookupDispatchAction, so you won't find it in the LDA source code.  It's
actually the protected 'dispatchMethod' code that handles the null:
// Make sure we have a valid method name to call.
// This may be null if the user hacks the query string.
if (name == null) {
return this.unspecified(mapping, form, request, response);
}

If unspecified does not work for a missing parameter in your version of
struts, (it does in 1.2.0 and probably somewhat before that,) either
move to a newer version of Struts, or override 'execute' to provide
default behavior.  Check for the presence of the request parameter, if
it exists, call super.execute(), if not, do your default behavior,
probably by calling one of the methods in your LDA.

The reason you're getting conflicting answers is that some of us are
using new builds where unspecified works fine, and some are on other,
older versions.  The nightly builds are very stable, I recommend them
and have no problems using them in production.

-- 
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: Users, Roles Access Control in Struts Applications - Where to get information?

2004-03-25 Thread Tom Bednarz
Hi Adam,

Great infos, thanks a lot. I will have to extend the JDBCRealm a little 
bit.

Tom

Adam Hardy wrote:

This might come through twice - if so, sorry.

On 03/25/2004 11:28 AM Tom Bednarz wrote:

1) How are Roles defined? Where are they stored? I don't want these
things stored in a XML file. Is there a way to store these things
in a database? Is there any documentation about a datamodel
(Fields, datatypes etc)



Hi Tom,
for this you should check the different Realm implementations available,
see the docs on jakarta's tomcat website. There is a JDBC realm  that
sounds right for your purposes.


2) How are roles assigned to users or groups of users? Where are
these assignments stored? Basically roles should be assigned to
groups. Users will then join or leave groups with specific
privileges.



This is done at login by tomcat, but such mechanisms should be available
on all containers. The user name is stored in the session (although not
available to you by session.getAttribute(), only
request.getUserPrincipal() or getRemoteUser() ) plus the roles are
stored as an array of strings, e.g. user, admin, super, available again
via the request.isUserInRole() boolean method. Should be
container-independent.

3) What do I need to do in Struts to configure all this? I read
that since 1.1 I can define a role property in ActionMappings. How
and against what is that definition verified? Are there any
standard/basic mechanisms that can be extended ?



Struts checks against request.isUserInRole(). I don't think it's
standard or basic to extend this. However it's open-source, so you could
do whatever you wanted. The same applies to tomcat.


4) Is there any menu system available, that supports roles and can
be integrated in a Struts based application?



Have you checked out struts-menu? I think it's on source-forge, if not
check for the link on the struts website.


5) Are there any special considerations when moving from Struts 1.0
to 1.1? With other words, is the code backward compatible or will
my working code for 1.0 not work anymore on 1.1?



There's an upgrade doc on the struts website. It is /mostly/ backwards
compatible. I've heard of many people just dropping in the new struts
jar to their project and having no problems.
Adam



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


RE: Automatically detecting struts-config changes and reload app.

2004-03-25 Thread Pady Srinivasan

The parseModuleConfigFile method in ActionServlet ( called by init() ) seems
to get the resource and reparse the information. Unless there is a screw up
somewhere there, I don't know why the re-read should fail.

I will see if that can be reproduced.


Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Leonardo Francalanci [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 8:53 AM
To: Struts Users Mailing List
Subject: R: Automatically detecting struts-config changes and reload app.

 I used your code ( Thanks ) and I finally got it to work with a Filter. We
 have a login filter in our app. So I added a method which runs only in
 development mode.

just one thing: I'm not sure, but it seems that sometimes Tomcat does not
re-read the
file. It's like it keeps it cached somewhere. So beware: sometime you have
to reload
you application to reload the config. I think that happens because of the
classLoader
used by tomcat.


-
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: db error

2004-03-25 Thread Larry Meadors
It has been a while since i used oracle, but that url looks wrong:

jdbc:oracle:thin:oci8:1521:ora9i

Can you have thin and oci in one url?

Larry

 [EMAIL PROTECTED] 03/25/04 4:10 AM 
Thanks chris,
so this is not because of any missing classes or jar files? is this a
connectivity issue? the database server isup and my other applications
sqlplusw can access it.
any pointers?
sorry about read reciept thing in my previous mail.
rajat
- Original Message -
From: McCormack, Chris [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: RE: db error


Check your database is up before trying to connect to it. If it is and
you
can ping the database from your application server box, then check your
spelling in the data source definition.

Chris McCormack

-Original Message-
From: Rajat Pandit [mailto:[EMAIL PROTECTED]
Sent: 25 March 2004 11:01
To: Struts Users Mailing List
Subject: db error


Hello All,
i am trying to connect a oracle database, and i get this stack trace,
can
someone please tell me what is wrong with it.
!-- stack trace --
javax.servlet.UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE
 at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
4)
 at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3420)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:257)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:569
)
 at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:411)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
 at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
 at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
 at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
 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.catalina.startup.Bootstrap.main(Bootstrap.java:203)


!-- end of stack trace --


--- data sources --

data-sources

!-- data-source type=org.apache.commons.dbcp.BasicDataSource
--
data-source
set-property property=driverClassName
value=oracle.jdbc.driver.OracleDriver /
set-property property=url
value=jdbc:oracle:thin:oci8:1521:ora9i /
set-property property=username value=*** /
set-property property=password value=*** /
set-property property=autoCommit value=true /
set-property property=maxCount value=4 /
set-property property=minCount value=2 /
set-property property=validationQuery value=SELECT 1+1 from
dual /
/data-source

/data-sources


-- code --
ServletContext context = servlet.getServletContext();
DataSource ds = (DataSource)
context.getAttribute(Action.DATA_SOURCE_KEY);
//DataSource ds = getDataSource(req);

try {
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(Select tname, tabtype from tab);

if (!rs.wasNull()) {
/**
 * some records where returned
 */
System.err.println(==);
while (rs.next()) {
System.err.println(Table Name:  +
rs.getString(1));
System.err.println(TabType:  + rs.getString(2

Re: Exception handling in struts

2004-03-25 Thread Nick Wesselman
Didn't someone already answer this for you? Maybe we need to be more 
explicit. Try this:

global-exceptions

exception

key=uncaught_exception 

type=java.lang.Exception 

path=/jsp/error.jsp 

handler=com.graysail.pgbadmecs.exceptions.ExceptionCatcher 

scope=request/

/global-exceptions

Exception needs to be upper case. If your ExceptionCatcher really is 
called exceptioncatcher (all lower case), then keep your handler line 
the same.

Nick

Tate Austin wrote:

I'm trying to write an exception handler in my struts-config to clean up my application's exception behavior.  Well, I've followed the directions in the docs to a T, I have this entry in my struts config:

global-exceptions

exception

key=uncaught_exception 

type=java.lang.exception 

path=/jsp/error.jsp 

handler=com.graysail.pgbadmecs.exceptions.exceptioncatcher 

scope=request/

/global-exceptions



my exception catcher extends GlobalExceptionHandler and bears an execute() method.  Well, when an error of type exception goes off, the catcher is never called to it?  What ingredient am I missing?

 



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


RE: Automatically detecting struts-config changes and reload app.

2004-03-25 Thread Pady Srinivasan

I made a small change to the code where setting WEB-INF in the classpath is
not required.

  private long lastModified = 0;
  private void reloadConfig(HttpServletRequest request) {
  if ( System.getProperty(DEVELOPMENT_MODE) != null ) {
try {
File f = new
File(request.getSession().getServletContext().getRealPath(/WEB-INF/struts-c
onfig.xml));
 if ( f.lastModified() != lastModified ) {
ActionServlet as = ( (ActionServlet)
request.getSession().getServletContext().getAttribute(
Globals.ACTION_SERVLET_KEY));
as.destroy();
 
request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
CESSOR_KEY);
as.init();
System.out.println(Reload ok.);
}
lastModified = f.lastModified();
}
catch (Exception ex) {
ex.printStackTrace();
}
  }
  }

Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Pady Srinivasan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 9:37 AM
To: Struts Users Mailing List
Subject: RE: Automatically detecting struts-config changes and reload app.


I used your code ( Thanks ) and I finally got it to work with a Filter. We
have a login filter in our app. So I added a method which runs only in
development mode. 

* Set the DEVELOPMENT_MODE system property during development.
* Add the WEB-INF directory to the classpath. ( does Tomcat include this in
the classpath ? )
* Call this method from the doFilter() method in your filter.

  private long lastModified = 0;
  private void reloadConfig(HttpServletRequest request) {
  if ( System.getProperty(DEVELOPMENT_MODE) != null ) {
try {
URL url = LoginFilter.class.getResource(/struts-config.xml);
if ( url == null )
return;
File f = new File(url.getFile());
if ( f.lastModified() != lastModified ) {
ActionServlet as = ( (ActionServlet)
request.getSession().getServletContext().getAttribute(
Globals.ACTION_SERVLET_KEY));
as.destroy();
 
request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
CESSOR_KEY);
as.init();
System.out.println(Reload ok.);
}
lastModified = f.lastModified();
}
catch (Exception ex) {
ex.printStackTrace();
}
  }
  }
}




Thanks
 
-- pady
[EMAIL PROTECTED]
 

-Original Message-
From: Leonardo Francalanci [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 7:19 AM
To: Struts Users Mailing List
Subject: R: Automatically detecting struts-config changes and reload app.

I wrote the following on 01/23/2004 on the mailing list, but nobody cared...





I wrote a servlet to trigger off a reload of the struts-config.xml.

The servlet is:

protected void doGet(..) {

ActionServlet as =
((ActionServlet)request.getSession().getServletContext().getAttribute(Global
s.ACTION_SERVLET_KEY));
as.destroy();

request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
CESSOR_KEY);
as.init();

new PrintStream(response.getOutputStream()).println(Reload
ok.);
}


Now my questions...

1) Is there another way to trigger off a reload without using the Tomcat's
reload
function (which takes a very long time and leaves db connections open?)

2) I had to call removeAttribute(Globals.REQUEST_PROCESSOR_KEY) because the
destroy method
of the ActionServlet doesn't do it. Here is the code (from
ActionServlet.destroyModules()):

[..]
if (value instanceof ModuleConfig) {
ModuleConfig config = (ModuleConfig) value;
getRequestProcessor(config).destroy();

getServletContext().removeAttribute(name);

I think there should be something like

getServletContext().removeAttribute(Globals.REQUEST_PROCESSOR_KEY +
config.getPrefix());

If I don't remove the attribute following requests will not work (because of
the code
in ActionServlet.getRequestProcessor)

Is this a bug?


3) Don't you think that something like that could be useful? I mean, if
answer to 1) is NO,
wouldn't be useful to have a configuration reloader with struts?

4) Calling actionServlet.destroy() and actionServlet.init() is enough to
re-load the whole
struts-config.xml?





-
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

Re: problem with module

2004-03-25 Thread ruben
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]


Re: db error

2004-03-25 Thread Daniel H. F. e Silva
About that url try this:

  jdbc:oracle:thin:@oci8:1521:ora9i

considering 'oci8' is your database server name and 'ora9i' is your Oracle's instance 
(service)
name.

Regards,
 Daniel Silva.

--- Larry Meadors [EMAIL PROTECTED] wrote:
 It has been a while since i used oracle, but that url looks wrong:
 
 jdbc:oracle:thin:oci8:1521:ora9i
 
 Can you have thin and oci in one url?
 
 Larry
 
  [EMAIL PROTECTED] 03/25/04 4:10 AM 
 Thanks chris,
 so this is not because of any missing classes or jar files? is this a
 connectivity issue? the database server isup and my other applications
 sqlplusw can access it.
 any pointers?
 sorry about read reciept thing in my previous mail.
 rajat
 - Original Message -
 From: McCormack, Chris [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Thursday, March 25, 2004 4:46 PM
 Subject: RE: db error
 
 
 Check your database is up before trying to connect to it. If it is and
 you
 can ping the database from your application server box, then check your
 spelling in the data source definition.
 
 Chris McCormack
 
 -Original Message-
 From: Rajat Pandit [mailto:[EMAIL PROTECTED]
 Sent: 25 March 2004 11:01
 To: Struts Users Mailing List
 Subject: db error
 
 
 Hello All,
 i am trying to connect a oracle database, and i get this stack trace,
 can
 someone please tell me what is wrong with it.
 !-- stack trace --
 javax.servlet.UnavailableException: Initializing application data source
 org.apache.struts.action.DATA_SOURCE
  at
 org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
 ava:1091)
  at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
  at javax.servlet.GenericServlet.init(GenericServlet.java:256)
  at
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
 4)
  at
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
  at
 org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
 3420)
  at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
  at
 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
 21)
  at
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
  at
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
  at
 org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
 ava:257)
  at org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
  at
 org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:569
 )
  at
 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:411)
  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:879)
  at
 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:368)
  at
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
 t.java:166)
  at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
  at org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
  at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
  at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
  at
 org.apache.catalina.core.StandardService.start(StandardService.java:497)
  at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:2189)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
  at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
  at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
  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.catalina.startup.Bootstrap.main(Bootstrap.java:203)
 
 
 !-- end of stack trace --
 
 
 --- data sources --
 
 data-sources
 
 !-- data-source type=org.apache.commons.dbcp.BasicDataSource
 --
 data-source
 set-property property=driverClassName
 value=oracle.jdbc.driver.OracleDriver /
 set-property property=url
 value=jdbc:oracle:thin:oci8:1521:ora9i /
 set-property property=username value=*** /
 set-property property=password value=*** /
 set-property property=autoCommit value=true /
 set-property property=maxCount value=4 /
 set-property property=minCount value=2 /
 set-property property=validationQuery value=SELECT 1+1 from
 dual /
 /data-source
 
 /data-sources
 
 
 -- code --
 ServletContext context = servlet.getServletContext();
 DataSource ds = (DataSource)
 context.getAttribute(Action.DATA_SOURCE_KEY);
 //DataSource ds = getDataSource(req);
 
 try {
 conn = ds.getConnection();
 stmt = conn.createStatement();
 rs = stmt.executeQuery(Select tname

RE: html inside an action

2004-03-25 Thread Qureshi, Affan
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]



Re: html inside an action

2004-03-25 Thread ruben
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]


RE: html inside an action

2004-03-25 Thread Qureshi, Affan
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]



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

2004-03-25 Thread Paul McCulloch
Something like

bean:define id=type
bean:write name=product property=productType
/bean:define

bean:message key=%='prompt.productType.' + type%/

Paul

 -Original Message-
 From: Marco Mistroni [mailto:[EMAIL PROTECTED]
 Sent: 25 March 2004 16:03
 To: 'Struts Users Mailing List'
 Subject: Struts tag problem (bean:message and bean:write)
 
 
 Hi all,
   I was wondering if anyone of you have a solution
 For this dilemma.
 I have a collectin of product DTOs to show on my jsp. One of 
 DTO's property is, let's say, the type, which is listed in number.
 (let's say, 10 or 20).
 ON the DTO I will have the value 10,20 ecc but on the jsp I have to
 display
 The corresponding string (let's say, HouseProduct or Car or something
 else) which is listed in application.resources.
 
 I am looping thru the collection using logic:iterate, and
 as I have found out myself, following code does not work
 
 bean:message key='prompt.productType.bean:write name=product
 property=productType'/
 
 
 basically in app.resources I will have
 prompt.productType.10=HouseProduct
 prompt.productType.20=Car
 
 etc..
 
 above, I am outputting the message   prompt.productType.(productType)
 
 how can I solve my dilemma, keeping in mind that I am using also
 logic:iterate to loop thru the collection?
 
 With best regards
   marco
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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


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



Re: html inside an action

2004-03-25 Thread ruben
hi
These 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]


RE: Automatically detecting struts-config changes and reload app.

2004-03-25 Thread Kris Schneider
Seems like somebody ought to point out that calling lifecycle methods (like
Servlet.init and Servlet.destroy) from app code is generally a bad idea. OTOH,
if it works for you...

Quoting Pady Srinivasan [EMAIL PROTECTED]:

 
 I made a small change to the code where setting WEB-INF in the classpath is
 not required.
 
   private long lastModified = 0;
   private void reloadConfig(HttpServletRequest request) {
   if ( System.getProperty(DEVELOPMENT_MODE) != null ) {
 try {
 File f = new
 File(request.getSession().getServletContext().getRealPath(/WEB-INF/struts-c
 onfig.xml));
  if ( f.lastModified() != lastModified ) {
 ActionServlet as = ( (ActionServlet)
 request.getSession().getServletContext().getAttribute(
 Globals.ACTION_SERVLET_KEY));
 as.destroy();
  
 request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
 CESSOR_KEY);
 as.init();
 System.out.println(Reload ok.);
 }
 lastModified = f.lastModified();
 }
 catch (Exception ex) {
 ex.printStackTrace();
 }
   }
   }
 
 Thanks
  
 -- pady
 [EMAIL PROTECTED]
  
 
 -Original Message-
 From: Pady Srinivasan [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 25, 2004 9:37 AM
 To: Struts Users Mailing List
 Subject: RE: Automatically detecting struts-config changes and reload app.
 
 
 I used your code ( Thanks ) and I finally got it to work with a Filter. We
 have a login filter in our app. So I added a method which runs only in
 development mode. 
 
 * Set the DEVELOPMENT_MODE system property during development.
 * Add the WEB-INF directory to the classpath. ( does Tomcat include this in
 the classpath ? )
 * Call this method from the doFilter() method in your filter.
 
   private long lastModified = 0;
   private void reloadConfig(HttpServletRequest request) {
   if ( System.getProperty(DEVELOPMENT_MODE) != null ) {
 try {
 URL url = LoginFilter.class.getResource(/struts-config.xml);
 if ( url == null )
 return;
 File f = new File(url.getFile());
 if ( f.lastModified() != lastModified ) {
 ActionServlet as = ( (ActionServlet)
 request.getSession().getServletContext().getAttribute(
 Globals.ACTION_SERVLET_KEY));
 as.destroy();
  
 request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
 CESSOR_KEY);
 as.init();
 System.out.println(Reload ok.);
 }
 lastModified = f.lastModified();
 }
 catch (Exception ex) {
 ex.printStackTrace();
 }
   }
   }
 }
 
 
 
 
 Thanks
  
 -- pady
 [EMAIL PROTECTED]
  
 
 -Original Message-
 From: Leonardo Francalanci [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 25, 2004 7:19 AM
 To: Struts Users Mailing List
 Subject: R: Automatically detecting struts-config changes and reload app.
 
 I wrote the following on 01/23/2004 on the mailing list, but nobody cared...
 
 
 
 
 
 I wrote a servlet to trigger off a reload of the struts-config.xml.
 
 The servlet is:
 
   protected void doGet(..) {
 
   ActionServlet as =
 ((ActionServlet)request.getSession().getServletContext().getAttribute(Global
 s.ACTION_SERVLET_KEY));
   as.destroy();
 
 request.getSession().getServletContext().removeAttribute(Globals.REQUEST_PRO
 CESSOR_KEY);
   as.init();
 
   new PrintStream(response.getOutputStream()).println(Reload
 ok.);
   }
 
 
 Now my questions...
 
 1) Is there another way to trigger off a reload without using the Tomcat's
 reload
 function (which takes a very long time and leaves db connections open?)
 
 2) I had to call removeAttribute(Globals.REQUEST_PROCESSOR_KEY) because the
 destroy method
 of the ActionServlet doesn't do it. Here is the code (from
 ActionServlet.destroyModules()):
 
 [..]
 if (value instanceof ModuleConfig) {
 ModuleConfig config = (ModuleConfig) value;
 getRequestProcessor(config).destroy();
 
 getServletContext().removeAttribute(name);
 
 I think there should be something like
 
 getServletContext().removeAttribute(Globals.REQUEST_PROCESSOR_KEY +
 config.getPrefix());
 
 If I don't remove the attribute following requests will not work (because of
 the code
 in ActionServlet.getRequestProcessor)
 
 Is this a bug?
 
 
 3) Don't you think that something like that could be useful? I mean, if
 answer to 1) is NO,
 wouldn't be useful to have a configuration reloader with struts?
 
 4) Calling actionServlet.destroy() and actionServlet.init() is enough to
 re-load the whole
 struts-config.xml?

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com

Re: html inside an action

2004-03-25 Thread ruben
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]


RE: html inside an action

2004-03-25 Thread Hookom, Jacob
You are much better off doing JSP tags for something like this.  I don't
understand why people are so afraid of doing custom tags?

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



RE: html inside an action

2004-03-25 Thread Qureshi, Affan
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]



RE: html inside an action

2004-03-25 Thread Brendan Richards
I'm not entirely sure what you're after - do you mean get a string with
the contents populated by another jsp - independent from the current
request being served?

I created a test jsp in tomcat containing a jsp:include / tag, ran it
and looked in tomcat's work folder at the servlet code generated for it.

The key line of code seems to be

JspRuntimeLibrary.include(request, response, /myInclude.jsp, out,
true); 


Here's the javadoc. Looks like it's specific to Tomcat though - I don't
know if there's a cross-platform solution.

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper/docs/api/org/apac
he/jasper/runtime/JspRuntimeLibrary.html


looks like the out is a JspWriter. I think you may be able to extend
jspWriter to create a jsp writer that captures your string rather than
sending to a response.

-Original Message-
From: ruben [mailto:[EMAIL PROTECTED] 
Sent: 25 March 2004 16:00
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]



  1   2   3   4   5   6   7   8   9   10   >