RE: Reading Context Data

2004-02-13 Thread Villalba Arias, Fredy [BILBOMATICA]
Ok. Let me know if that works.

Good luck!

-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 13 de febrero de 2004 11:32
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

Attached is the servlet code from the other context which puts the
attribute in the context

Yes I did have that import.  I think you may be on to something here.  I
will clean up files and see if that helps.  Right now, I had created a jar
file using the classes from the other servlet context to use in the type
cast.  But maybe the other classes are still there.  I will definitely
check that out.

Thanks for taking the time to help me.  I have been stuck on this for a
couple of days; it just doesn't make any sense.

Natalie

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 11:57 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


1 questions... I can't see where the mdfUser attribute is set. Where is
it?

1 comment:

There is a line that gets my attention:

//import data.DTO.MDF_UserBean;  (inside LoginEmdfCrPktAction.java)

Is it possible that for some reason you are trying to cast a
data.DTO.MDF_UserBean to beans.MDF_UserBean? This happens sometimes,
especially if you are using and IDE, because the classes don't get
refreshed properly and then the conflict arises.

Have you tried deleteing ALL classes  JARS and recompiling + repackaging
+ redeploying EVERYTHING (sounds desperate, but sometimes it works)?

Will keep working on it.

Bye.

-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 12 de febrero de 2004 17:32
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

okay here is the code in a zip file.  I included the action and the jar
file where the bean in question is imported from.  I also included the
source code for the bean.

Any help you could provide would be much appreciated.

Thanks,

Natalie

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 11:25 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


So am I!

If you send me the stack trace, the source code where the put gets done
and the source code containing the get, I might spare some time to give
it a look. The action mapping would also help.

Can't promess anything. Don't expect and answer for today, ok? (have work
to do)  :)

Regards,
Freddy.


-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 12 de febrero de 2004 17:06
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

Yes I have verified the information is in the attribute.  I can extract it
and put it into an object variable just fine.  I can do a getClass on the
object variable and it is the right class name (beans.MDF_UserBean).  It
is when I do the direct cast with the class name that I get the
ClassCastException.

MDF_UserBean user = (MDF_UserBean)request.getAttribute(mdfUser);

This works:

Object user = (Object)request.getAttribute(mdfUser);

I am not importing more than one class with the same name either

I am baffled; this should work.

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 8:58 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


Did you check that you are put-ing (into the Context) the correct object
(the one you expect to get afterwards?)?



Have you verified that the value you are put-ing (in case its the right
one) is not being (unexpectedly) overwritten?



Are you using (/importing) more than one class with that same name
(different package)?



-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 12 de febrero de 2004 14:26
Para: Struts Users List (E-mail)
Asunto: Reading Context Data



Does anyone know how to read object data out of the context?

I have a web app which puts a Bean in to the web context data.  It then
forwards to my struts applications.  From within my action when I try to
read string data out of the context attribute, I have no problems.  When I
try to read the bean data out of the context, I keep getting a
ClassCastException.  Does anyone know what I am doing wrong.  Here are the
lines from my action:

 MDF_UserBean user = new MDF_UserBean();
 ServletContext ctx = this.getServlet().getServletContext();
  ctx = ctx.getContext(/emdf);
  user = (MDF_UserBean)ctx.getAttribute(mdfUser);

Thanks in advance


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02

RE: [OT] Case insensitive Map keys

2004-02-13 Thread Villalba Arias, Fredy [BILBOMATICA]
Good.

Well, I can see you are really looking for efficiency. Then, why don't you try 
fuzzy-logic? It should be even more efficient (and, frankly, even simpler).

The key is in the 6th less-relevant bit. Do a bit-by-bit XAND and the result should be 
'1...01'.

HTH,
Freddy.

-Mensaje original-
De: Guillermo Meyer [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 13 de febrero de 2004 14:38
Para: 'Struts Users Mailing List'
Asunto: RE: [OT] Case insensitive Map keys

I'm trying the following:

public class KeyGeneratedMap extends HashMap {
public Object put(Object key, Object value) {
return
super.put(this.generateKey(key.toString()), value);
}

public Object get(Object key) {
return
super.get(this.generateKey(key.toString()));
}   

/**
* This generates an integer object for Strings and are
case insensitive, that is
* Hello and heLLO generate the same Integer object value
*/
private Object generateKey(String str) {
int len = str.length();
int h=0;
char val[] = str.toCharArray();
char c;
for (int i = 0; i  len; i++) {
c=val[i++];
if(c=97  c =122)
c-=32;

h = 31*h + c;
}
return new Integer(h);
}
}

This by now is three times faster than using toUpperCase for storing and
retrievinig items from the hash. What do you think?

-Original Message-
From: Navjot Singh [mailto:[EMAIL PROTECTED] 
Sent: Viernes, 13 de Febrero de 2004 02:53 a.m.
To: Struts Users Mailing List
Subject: RE: [OT] Case insensitive Map keys


oops!! thanks for correcting me freddy.

well in that case, if you map is not modified frequently, try the
FastHashMap from the Apache Commons. either you override and read and
write your own.

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] 
[mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 5:50 PM
To: Struts Users Mailing List
Subject: RE: [OT] Case insensitive Map keys


Navjot,

I believe this is exactly what Guillermo CLEARLY stated he had already 
tried (and is not efficient enough for him).

If you had taken a little bit longer and read carefully, then maybe 
you'd have noticed.

Regards,
Freddy.

-Mensaje original-
De: Navjot Singh [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 12 de febrero de 2004 13:14
Para: Struts Users Mailing List; [EMAIL PROTECTED]
Asunto: RE: [OT] Case insensitive Map keys

yes. here it is.

public CIMap extends HashMap
{

   public Object get(String key)
   {
   return super.get(key.toLowerCase());
   }

   public Object put(String key, Object value)
   {
   super.put(key.toLowerCase(),value);
   }
}

This was simple implementation. By the time you ask the Q and wait for 
reply. you could have written on your own.

Navjot Singh


-Original Message-
From: Guillermo Meyer [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 5:24 PM
To: 'Struts Users Mailing List'
Subject: [OT] Case insensitive Map keys


Hi:
Does anyone know an implementation of Map where keys are String and 
case insensitive? I want to do this:

map.put(propertyName, DATA);

And then, I should be able to get the value like this:
Object obj = map.get(PROPERTYNAME);

Or like this:
Object obj = map.get(propertyname); //or whatever. case insensitive.

We tried using toUppercase when putting and toUppercase when getting, 
and using equalsIgnoreCase but this is not as efficient as we need. 
May there be a way to calculate a hash for strings in upper or lower 
case to result in the same value?

Thanks in advance.

Guillermo.


NOTA DE CONFIDENCIALIDAD
Este mensaje (y sus anexos) es confidencial, esta dirigido 
exclusivamente a las personas direccionadas en el mail y puede 
contener informacion (i)de propiedad exclusiva de Interbanking S.A. o 
(ii) amparada por el secreto profesional. Cualquier opinion en el 
contenido, es exclusiva de su autor y no representa necesariamente la 
opinion de Interbanking S.A. El acceso no autorizado, uso, 
reproduccion, o divulgacion esta prohibido. Interbanking S.A no 
asumira responsabilidad ni obligacion legal alguna por cualquier 
informacion incorrecta o alterada contenida en este mensaje. Si usted 
ha recibido este mensaje por error, le rogamos tenga la amabilidad de 
destruirlo inmediatamente junto con todas las copias del mismo, 
notificando al remitente. No debera utilizar, revelar, distribuir, 
imprimir o copiar este mensaje ni ninguna de sus partes si usted no es

el destinatario. Muchas gracias

RE: Back to the originating screen...

2004-02-13 Thread Villalba Arias, Fredy [BILBOMATICA]
 the scenerio you have explained do not need 2 actions.It is the  case for 
just one OpenAction.(ProductListOpenAction).And the form for this action can keep 
record of teh search criteria entered(by having them as attributes) and the same can 
be  passed to jsp either as text fields or hidden parameters.

HTH.
regards,
Shirish.

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Monday, February 09, 2004 6:59 PM
To: Sakhare, Shirishchandra
Subject: RE: Back to the originating screen...


Yes, indeed.

To be precise, I'm (more) interested in the OpenAction/SaveAction paradigm, and the 
general GET/POST philosophy you applied. The Changing Language functionality would 
be a good example, although I've thought about another one that I'm also interested in:

There is a login screen. The user logs into the system, gets redirected to the List 
of Products screen where the paginated list of products is shown. That screen allows 
the user to filter the list by specifying one or more filtering parameters (on that 
same screen) and submitting them (by clicking a Search - submit - button). 
Initially, there will appear all products. After clicking on Search, that same 
screen is reloaded; however, this time the list contains only those products meeting 
the search criteria.
The last setting for all search parameters MUST be visible AFTER the search has 
returned (i.e. the screen has been reloaded).

I've already been thinking and working on this very same example and I've already 
managed to solve it by implementing everything in the same Action. However, if I 
understood you (and the thread you told me to give a look at), it should preferably be 
implemented in 2 different Actions.

Anyway, won't distract you any further. I look forward to hearing from you again.

Kind Regards,
Freddy.

-Mensaje original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 09 de febrero de 2004 15:57
Para: Villalba Arias, Fredy [BILBOMATICA]
Asunto: RE: Back to the originating screen...

Hi Freddy,
I will definately glad to share my experience.If i am not mistaken, you will like to 
know more about how we have implemented the Changing Language Functionality? including 
the concept of OpenAction/SaveAction?

I will send you a detail mail.But I will also urge you to read the post about 
chainning actions from struts archive.
http://marc.theaimsgroup.com/?l=struts-userm=104427309720653w=2

This thread might be of interest to you.Especially the defference between action 
chainning and Action relay...

A bit under pressure today.But definately send a detail mail by tomorrow.

regards,
Shirish

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Monday, February 09, 2004 3:41 PM
To: Sakhare, Shirishchandra
Subject: RE: Back to the originating screen...


Hi Shirish,

I'm really interested in this approach you mentioned. I'm a experienced architect, yet 
kind of new to the Struts FWK. Therefore, I'm still in that early stage when you try 
to figure out the best designs patterns / strategies for architecting a Struts-based 
system.

Would you be willing to share this knowledge with me?

Regards,
Freddy.

-Mensaje original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 06 de febrero de 2004 16:40
Para: [EMAIL PROTECTED]
Asunto: RE: Back to the originating screen...

Hi,
We have implemented similar concept.And you are right.You have to be careful not to 
redo the last posts.

Luckily for us, the desin we had solved the problem.We have a concept of 
OpenAction(Actions that prepare data for view) and Save action(Post actions,actions 
that update DB).So in AbstractOpenAction, the called URL is saved in session under a 
specific key(Open actions always use GET.So the saved URL can always recreate the 
request if you forward to it :-))) and when the user changes the language, we change 
the language in session and just forward to last action called.And as the last action 
called will be always be the OpenAction which created the last screen seen by user.So 
chance of a post being done again.

Some users have pointed out that having such Reusable small actions lends itself to 
action chaining(e.g. To complete a user Preference save request, you will first call 
SaveUserPrefrrenceAction which will then forward to UserdetaislOpenAction,assuming you 
are showing user details after he saves them) And qwe had a long discussion on this 
forum about action chainning.

So you may want to review all of this before you take this route.

HTH.
regards,
Shirish

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Friday, February 06, 2004 4:26 PM
To: Struts Users Mailing List
Subject: RE: Back to the originating screen...


Hi,

IMHO, this is a difficult problem to solve (100%, that is). Including the redo-URL on 
the language link is the most practical of those options

RE: struts actions and content/type responses

2004-02-12 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi Ben,

I'm not sure if I understood you well, but I believe it's as simple as coding the 
Action just like you said and inserting the corresponding URL to call it (I suppose it 
would have to include the imageID as a parameter) inside, let's say, the src 
attribute on an image tag.

HTH,
Freddy.

-Mensaje original-
De: Turner Benjamin [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 12 de febrero de 2004 12:31
Para: Struts-User (E-mail)
Asunto: struts actions and content/type responses

hello,

i am looking for a solution for the following problem:

in my database i have various BLOB items which represent images (gif or jpg). i would 
like to create a struts action which returns this (by passing along a request 
parameter to the action which is the imageid in the database. is it possible to set 
the response content/type in an action and then return the image itself somehow? maybe 
with a requestdispatcher? any ideas/pointers to this would be welcome.

ty,

Ben

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: [OT] Case insensitive Map keys

2004-02-12 Thread Villalba Arias, Fredy [BILBOMATICA]
Navjot,

I believe this is exactly what Guillermo CLEARLY stated he had already tried (and is 
not efficient enough for him).

If you had taken a little bit longer and read carefully, then maybe you'd have noticed.

Regards,
Freddy.

-Mensaje original-
De: Navjot Singh [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 12 de febrero de 2004 13:14
Para: Struts Users Mailing List; [EMAIL PROTECTED]
Asunto: RE: [OT] Case insensitive Map keys

yes. here it is.

public CIMap extends HashMap
{

public Object get(String key)
{
return super.get(key.toLowerCase());
}

public Object put(String key, Object value)
{
super.put(key.toLowerCase(),value);
}
}

This was simple implementation. By the time you ask the Q and wait for
reply. you could have written on your own.

Navjot Singh


-Original Message-
From: Guillermo Meyer [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 5:24 PM
To: 'Struts Users Mailing List'
Subject: [OT] Case insensitive Map keys


Hi:
Does anyone know an implementation of Map where keys are String and case
insensitive?
I want to do this:

map.put(propertyName, DATA);

And then, I should be able to get the value like this:
Object obj = map.get(PROPERTYNAME);

Or like this:
Object obj = map.get(propertyname); //or whatever. case insensitive.

We tried using toUppercase when putting and toUppercase when getting,
and using equalsIgnoreCase but this is not as efficient as we need.
May there be a way to calculate a hash for strings in upper or lower
case to result in the same value?

Thanks in advance.

Guillermo.


NOTA DE CONFIDENCIALIDAD
Este mensaje (y sus anexos) es confidencial, esta dirigido
exclusivamente a las personas direccionadas en el mail y puede
contener informacion (i)de propiedad exclusiva de Interbanking
S.A. o (ii) amparada por el secreto profesional. Cualquier opinion
en el contenido, es exclusiva de su autor y no representa
necesariamente la opinion de Interbanking S.A. El acceso no
autorizado, uso, reproduccion, o divulgacion esta prohibido.
Interbanking S.A no asumira responsabilidad ni obligacion legal
alguna por cualquier informacion incorrecta o alterada contenida
en este mensaje. Si usted ha recibido este mensaje por error, le
rogamos tenga la amabilidad de destruirlo inmediatamente junto con
todas las copias del mismo, notificando al remitente. No debera
utilizar, revelar, distribuir, imprimir o copiar este mensaje ni
ninguna de sus partes si usted no es el destinatario. Muchas gracias.



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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: Problem with opening a file that comes from SevletResponse

2004-02-12 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi,

I'm not sure about this, but I remember having the same problem a long time ago and I 
believe it had something to do with the response's header(s). Sorry, can't remember 
exactly what it was.

HTH,
Freddy.

-Mensaje original-
De: Hendrickx Wesley [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 12 de febrero de 2004 13:27
Para: [EMAIL PROTECTED]
Asunto: Problem with opening a file that comes from SevletResponse

Hi,

In my application I have a feature to download a report in PDF format.
The contents come from an XML tree, together with an XSL-T to make the byte array for 
the PDF file.

The content type for the httpServletOutputStream is as follows:

httpServletResponse.setContentType(application/pdf);
httpServletResponse.setHeader(Content-disposition, attachment; 
filename=helios.pdf );

The next thing is stream the pdf to the response of the servlet:

BufferedOutputStream bos = null;
ServletOutputStream stream = httpServletResponse.getOutputStream();
bos = new BufferedOutputStream(stream);
bos.write(pdf.toByteArray());

Now when i call the action to get the report, everything works fine.
The dialog box to download the file pops up. When I click the save button there is no 
problem at all - the file is saved on the HD,
but when i hit the Open button, i get a new dialog box again with open and save 
buttons.
I hit the open button again, and then I get the error that the file does not exist.


Anyone alse that had this problem and might have come up with a solution to this 
problem?

Thanks in advance,
Wesley

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: Reading Context Data

2004-02-12 Thread Villalba Arias, Fredy [BILBOMATICA]
Did you check that you are put-ing (into the Context) the correct object (the one you 
expect to get afterwards?)?

 

Have you verified that the value you are put-ing (in case its the right one) is not 
being (unexpectedly) overwritten?

 

Are you using (/importing) more than one class with that same name (different package)?

 

-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 12 de febrero de 2004 14:26
Para: Struts Users List (E-mail)
Asunto: Reading Context Data

 

Does anyone know how to read object data out of the context? 

I have a web app which puts a Bean in to the web context data.  It then forwards to my 
struts applications.  From within my action when I try to read string data out of the 
context attribute, I have no problems.  When I try to read the bean data out of the 
context, I keep getting a ClassCastException.  Does anyone know what I am doing wrong. 
 Here are the lines from my action:

 MDF_UserBean user = new MDF_UserBean(); 
 ServletContext ctx = this.getServlet().getServletContext(); 
  ctx = ctx.getContext(/emdf); 
  user = (MDF_UserBean)ctx.getAttribute(mdfUser); 

Thanks in advance 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 


[OT] Servlet Name at runtime

2004-02-12 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi to you all,

 

An OT question (if it were not urgent, I wouldnt post it) hope not to get fired 
for this.   :-)

 

Given a web application with two Servlets classA and classB: how can I determine 
classBs servlet-name (as specified inside the web.xml file) from classAs doGet 
method?

 

I already know about ServletConfig.getServletName(). What I havent been able to 
determine is how to obtain an instance (the right one) of classB in order to do that 
(creating one by hand one work since it would be null.

 

Will appreciate if you can help me out with this.

 

Thanx,

Freddy.

 

P.D.: dont want to use the deprecated methods there used to be in previous APIs.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 


RE: Reading Context Data

2004-02-12 Thread Villalba Arias, Fredy [BILBOMATICA]
So am I!

If you send me the stack trace, the source code where the put gets done and the 
source code containing the get, I might spare some time to give it a look. The 
action mapping would also help.

Can't promess anything. Don't expect and answer for today, ok? (have work to do)  :)

Regards,
Freddy.


-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 12 de febrero de 2004 17:06
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

Yes I have verified the information is in the attribute.  I can extract it
and put it into an object variable just fine.  I can do a getClass on the
object variable and it is the right class name (beans.MDF_UserBean).  It
is when I do the direct cast with the class name that I get the
ClassCastException.

MDF_UserBean user = (MDF_UserBean)request.getAttribute(mdfUser);

This works:

Object user = (Object)request.getAttribute(mdfUser);

I am not importing more than one class with the same name either

I am baffled; this should work.

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 8:58 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


Did you check that you are put-ing (into the Context) the correct object
(the one you expect to get afterwards?)?



Have you verified that the value you are put-ing (in case its the right
one) is not being (unexpectedly) overwritten?



Are you using (/importing) more than one class with that same name
(different package)?



-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 12 de febrero de 2004 14:26
Para: Struts Users List (E-mail)
Asunto: Reading Context Data



Does anyone know how to read object data out of the context?

I have a web app which puts a Bean in to the web context data.  It then
forwards to my struts applications.  From within my action when I try to
read string data out of the context attribute, I have no problems.  When I
try to read the bean data out of the context, I keep getting a
ClassCastException.  Does anyone know what I am doing wrong.  Here are the
lines from my action:

 MDF_UserBean user = new MDF_UserBean();
 ServletContext ctx = this.getServlet().getServletContext();
  ctx = ctx.getContext(/emdf);
  user = (MDF_UserBean)ctx.getAttribute(mdfUser);

Thanks in advance


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: Reading Context Data

2004-02-12 Thread Villalba Arias, Fredy [BILBOMATICA]
1 questions... I can't see where the mdfUser attribute is set. Where is it?

1 comment: 

There is a line that gets my attention:

//import data.DTO.MDF_UserBean;  (inside LoginEmdfCrPktAction.java)

Is it possible that for some reason you are trying to cast a data.DTO.MDF_UserBean to 
beans.MDF_UserBean? This happens sometimes, especially if you are using and IDE, 
because the classes don't get refreshed properly and then the conflict arises.

Have you tried deleteing ALL classes  JARS and recompiling + repackaging + 
redeploying EVERYTHING (sounds desperate, but sometimes it works)?

Will keep working on it.

Bye.

-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 12 de febrero de 2004 17:32
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

okay here is the code in a zip file.  I included the action and the jar
file where the bean in question is imported from.  I also included the
source code for the bean.

Any help you could provide would be much appreciated.

Thanks,

Natalie

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 11:25 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


So am I!

If you send me the stack trace, the source code where the put gets done
and the source code containing the get, I might spare some time to give
it a look. The action mapping would also help.

Can't promess anything. Don't expect and answer for today, ok? (have work
to do)  :)

Regards,
Freddy.


-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 12 de febrero de 2004 17:06
Para: Struts Users Mailing List
Asunto: RE: Reading Context Data

Yes I have verified the information is in the attribute.  I can extract it
and put it into an object variable just fine.  I can do a getClass on the
object variable and it is the right class name (beans.MDF_UserBean).  It
is when I do the direct cast with the class name that I get the
ClassCastException.

MDF_UserBean user = (MDF_UserBean)request.getAttribute(mdfUser);

This works:

Object user = (Object)request.getAttribute(mdfUser);

I am not importing more than one class with the same name either

I am baffled; this should work.

-Original Message-
From: Villalba Arias, Fredy [BILBOMATICA] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 8:58 AM
To: Struts Users Mailing List
Subject: RE: Reading Context Data


Did you check that you are put-ing (into the Context) the correct object
(the one you expect to get afterwards?)?



Have you verified that the value you are put-ing (in case its the right
one) is not being (unexpectedly) overwritten?



Are you using (/importing) more than one class with that same name
(different package)?



-Mensaje original-
De: Rassmann, Natalie D [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 12 de febrero de 2004 14:26
Para: Struts Users List (E-mail)
Asunto: Reading Context Data



Does anyone know how to read object data out of the context?

I have a web app which puts a Bean in to the web context data.  It then
forwards to my struts applications.  From within my action when I try to
read string data out of the context attribute, I have no problems.  When I
try to read the bean data out of the context, I keep getting a
ClassCastException.  Does anyone know what I am doing wrong.  Here are the
lines from my action:

 MDF_UserBean user = new MDF_UserBean();
 ServletContext ctx = this.getServlet().getServletContext();
  ctx = ctx.getContext(/emdf);
  user = (MDF_UserBean)ctx.getAttribute(mdfUser);

Thanks in advance


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003


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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: [OT] Sending email from struts

2004-02-11 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi Matt,

The first thought that comes through my mind is this: consider your email as a burden 
plain text message (/stream). Then, look for a text parser or similars. Most surely, 
you will be able to find something related to XML / XSLT technologies.

Hope this gives you some ideas.

Regards,
Freddy.

-Mensaje original-
De: Matt Bathje [mailto:[EMAIL PROTECTED] 
Enviado el: miƩrcoles, 11 de febrero de 2004 17:03
Para: strutslist
Asunto: [OT] Sending email from struts

Hi all.

This is kind of off topic as it is not really struts related, but somebody
here would probably have the answer.

We have our application sending emails to users at some points and it is
working fine. The problem is that we have the email message hardcoded into
the Java, which we would like to avoid either by storing the message in
application.properties or our database. This would be easy, except all of
the messages contain user-specific information like their name or phone
number or order id or something like that.

Anybody have any ideas (or links to programs!) that can read in an email,
replace the information it needs to from the db, and send that to the user.

I could obviously write something myself to do it, but wouldn't want to
reinvent the wheel.

Turns out this is hard to search for too - email is not a search term that
makes things easy.

Thanks,
Matt Bathje


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: dynamic parameters

2004-02-10 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi,

I don't know about indexes, but I can think of a simple solution, Struts-independent 
(well, not 100%): have all values concatenated in a single hidden attribute that 
get's submitted, using different tokens for separating different values and for 
separating different records (by record I mean a set of values). Then it's just about 
parsing it (the value stored on the corresponding property) on the server side. I know 
It's not the most elegant solution, but it you are short of time, then it will 
surely do it.

HTH,
Freddy.

-Mensaje original-
De: Nathan Maves [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 10 de febrero de 2004 1:24
Para: Struts Users Mailing List
Asunto: dynamic parameters

I have searched but found nothing on this specific example.

I have a form that will have n number of elements.  Each of these 
elements will needs it own name.

example.

list of students is displayed on the screen with two text fields for 
their first and last name.

This is for a mass update page.

The only way I can thing of is to have form element like..

text name=#student_id#-#first_name#
text name=#student_id#-#last_name#

This way in my action I can parse out the student id and then update 
the corresponding first and last name.

Can this be done or is there a better way to do it.


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



Passing parameters between Actions

2004-02-09 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi everybody,

 

Is there a standard / preferred way(s) to pass parameters from one Action(Form) to 
another? Is there some way to have some property (of any type) automatically mapped 
between two ActionForms?

 

Regards,

Freddy.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 


Enable the log for RequestProcessor and other classes

2004-02-06 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi,

 

Is there a configuration variable (web.xml / struts-config.xml / other file) for 
enabling the log for the RequestProcessor class (and the like)?

 

Regards,

Freddy.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 


RE: Back to the originating screen...

2004-02-06 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi,

IMHO, this is a difficult problem to solve (100%, that is). Including the redo-URL on 
the language link is the most practical of those options, if you are able to generate 
redo-URLs that do not redo the last action itself but only recompose the current 
view (not that simple, I know). Remember to be careful with issues such as redo-ing 
posts that, for instance, involve persistency-related tasks. Say: saveNewProduct.

Hth,
Freddy.

-Mensaje original-
De: Jesse Alexander (KAID 11) [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 06 de febrero de 2004 16:07
Para: 'Mailing List [EMAIL PROTECTED]'
Asunto: Back to the originating screen...

Hi
I need a hint on how to return always to the originating action preserving
all input-parameters to that originating action...

problem: From any screen in my application the user is allowed to
 change the language of the UI. He should be immediately presented
 the same screen again in the new UI-language.

So far I think I create an action (and a global forward) to change the
UI-language. That's the easy part. But what strategy to use in order
to be able to redo the last action before the change of language?

The possibilities I thought of are:
- on the language link, include always the redo-URL
- on each primary action (actions called from the UI, opposed to secondary
  actions called from primary actions...) I store the redo-URL in the
  session.

What do you do in such a case? 

thanks in advance
Alexander
  


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: Using the ActionForm in the JSP

2004-02-05 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi Rahul,

I'm kind of a newbie, but I believe that:

(1) Assuming that the scope you specified for that bean is request, it's intantiated 
when rendering the page (I suppose you mean a GET) and every time you do a POST.

(2) You can specify a default value inside your JSP, but - almost sure - also through 
the struts-config file (the initial attribute on the property tag).

Hope I'm not giving you more questions than answers.

Regards,
Freddy.

-Mensaje original-
De: Rahul Mohan [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 09 de enero de 2004 15:47
Para: struts
Asunto: Using the ActionForm in the JSP

Hi everyone,

I need to access the ActionForm properties inside the JSP code for the same 
window. Is there any way to do this? 

Regarding this I have some doubts about the life cycle of ActionForms

1. When exactly is the ActionForm object instantiated? Is the ActionForm object 
instantiated only on submit of the corresponding form? or is it instantiated while 
rendering the page?

2. Also I need to set some properties to default values at instantiation of the 
ActionForm. Can I simply override the ActionForm constructor in my action-form? That 
doesnt look like a good strategy since the constructor implementation in the 
ActionForm does not seem to be made for overriding as it has some code in it ( its 
simply servlet = null ) so is it wise to simply override it? it seems a bit over 
smart idea!!! :) 

Please help me out..

thank you,
rahul

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: Struts and Pajes

2004-02-04 Thread Villalba Arias, Fredy [BILBOMATICA]
Ok.

I'll try to be more clear:

- I don't want to use JSPs when working with Struts, neither the Taglibs.
Instead, I want to be able to delegate the presentation on an external
component.

- In order to do that, I must be able to access the data to be presented
(i.e. access the appropriate ActionForm) from that external component,
in consistency with Struts handlign of scope and other concepts.

- It seems like Struts would expect you to (finally surrender and) use
JSP + JSP tags, although it does not formally obliges you to do so. I've
been checking both the source code for the tag libs and the .java-s
generated by them and I get this strong impression that there is happening a
lot more behind the scenes that one would suppose (and Struts would
recognize). This would not worry me if there were Java classes that, not being 
JSP-oriented, still allowed me to do everything (or even 50%) Struts' JSP-tags do. I 
dont say they don't exist. I just have not found
them.

- I don't see why you say I'm conflating those 2 issues (please, explain it to me :)  
). I'm not introducing anything new inside the framework, nor am I changing its normal 
behaviour. I'm respecting the roles assigned to each component. I believe what I'm 
doing is - precisely - prevent (or, at least, make it more difficult to) the developer 
from mixing control and presentation (on a JSP); moreover, I'm allowing the TOTAL 
separation of HTML and Java by encapsulating the dynamic generation of the view in a 
Java object especially designed for that purpose (for good). Anyway, I'm absolutely 
open to any comments / opinnions you can provide in this regard.

IMPORTANTE NOTICE:

I don't want start a discussion here about how good or bad Struts is:
- I don't have time for that,
- I don't have yet the required level of knowledge and expertise (on Struts,
that is) to make such judgement,
- That's not the point for this posting.

This said, I'll be really looking forward to anything anybody is willing
to collaborate with.

Thanx again!
Freddy.

-Mensaje original-
De: Michael McGrady [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 03 de febrero de 2004 19:41
Para: Struts Users Mailing List; [EMAIL PROTECTED]
Asunto: Re: Struts and Pajes

Struts is not the presentation tools so you are fine.  You can use any 
presentation, or even none.  I do a lot of tunneling things with struts, 
including serving images with Action classes.  Your question is not clear 
to me?  You seem to be conflating mapping (control) and view (presentation) 
issues.  But, I am not sure.  Anyway, if you are not clear, they are 
distinct.  I don't know how much you know, so let me stress that the web 
MVC pattern is really not the classic MVC pattern.  Rather, our own 
beloved Ted Husted has nailed the real pattern, which is to keep the 
connections of each of the MVC to only one of the other three on each side 
(incoming and out going).  It's more of a circle.
  



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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: Accessing ActionForm from Servlet (was: Pajes + Struts)

2004-02-04 Thread Villalba Arias, Fredy [BILBOMATICA]
Thanx Joe, Andrew... you seem to have grasped the essence of my worries.

Andrew: on your comment about Pajes (jejeje), yes. It's a nice simple framework I've 
been working with for about 2 years now. I confess I have
not been interested to become a Guru at it or something like that, but
that's mostly because the core objects (the DOM objects to
dinamycally manipulate an HTML template) were simple and sufficient
enough for achieving what I wanted. I recommend you to take a look at
it. It's worth it. About XMLC, had never heard of it. I might give it a
look (when I have time!).


Anyway, let me comment on your posting, Joe (read below):

These are initial steps towards making it easier 
to get an ActionForm instance for prepopulation 
on the way to the view.  Be warned, this method 
does not use any of the logic for looking up an 
existing form bean in request or session scope 
under any name, either the forms name or the 
'attribute' property of an ActionMapping, since 
as you can see, the method gets neither a request 
or an action mapping.

Yes.

I suppose you say this about the action mapping because it's
possible that very same ActionForm is being used from more than
one Action. Am I right?

In any case, Struts takes care of handling for you the association between Action and 
ActionForm, including management of important aspects such as
Scope. Regarding the scope issue, I don't think it would be a problem since,
by the time the control is delegated (ActionForward-ed) to the external component:

(1) The Action's job is finished (execute / perform) -- at least, for that request.

(2) The Action is already associated to the appropriate ActionForm and will
remain so until the response is sent back (or further, depending on the scope, right?).

(3) It is not possible to have more than one ActionForm associated to an
Action (at the same time), i.e. it's a 1:1 relationship (again, am I right?)

That's why I thought: if I can recover that very same ActionForm object once
accessible from the just-executed Action (the actionForm attribute), then voila! (I 
believe that very same object is the one accessed through the
JSP-tags, isn't it?).

However, I don't see how can the first issue affect me... if what I just stated is 
true, that is. Do you?


I have been thinking about adding a method:
RequestUtils.createActionForm(fbc, servlet, 
request, scopeString, attributeString) which 
would integrate that logic as well, but I was 
waiting to make sure that no one objected to what 
I did a few weeks ago.  Actually, I would also 
prefer to use a different method name like 
'findOrCreateActionForm' but I don't love that 
name, so I'm also waiting to come up with a 
method name that I like.

A nice method to have would be something like:

getCurrentActionForm(HttpServletRequest r, Action a) or
getCurrentActionForm(HttpServletRequest r, Class actionClass)

However, I don't know if I'm saying something stupid here,
since I have the doubts I just stated above.

Also, there has been a lot of effort to factor 
certain things out of RequestUtils, so maybe it's 
time to find a different home for these methods. 
FormUtils?

Definitively YES!


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



RE: Accessing ActionForm from Servlet (was: Pajes + Struts)

2004-02-04 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi /thorsten

I don't know for sure. That's why I asked if I was right... :)

Anyway:

(1) How do you associate 2 ActionForms to the same Action (and have
them automatically associated and populated by Struts)?

(2) Assuming 1 is possible (I'd really appreciate if you could explain
me how to acomplish that), what sense does it make to have 2 ActionForms
variables if only one form can be submitted at a time anyways? (maybe
I'm missing something else)

(3) Despite 1 and 2, there must be a method to obtain the ActionForm(s)
associated to an Action (during an specific request / post). Right?

Regards,
Freddy.

-Mensaje original-
De: news [mailto:[EMAIL PROTECTED] En nombre de Thorsten Scherler
Enviado el: miƩrcoles, 04 de febrero de 2004 17:20
Para: [EMAIL PROTECTED]
Asunto: Re: Accessing ActionForm from Servlet (was: Pajes + Struts)

Villalba Arias, Fredy [BILBOMATICA] fvillalba at mailext.com writes:

 (3) It is not possible to have more than one ActionForm associated to an

 Action (at the same time), i.e. it's a 1:1 relationship (again, am I right?)



That's not true! I am using an Action with 2 ActionForms:

ServiceForm serviceForm = (ServiceForm) form;

ServiceExForm serviceExForm = (ServiceExForm) form;



...or did I not understood you

King regards

/thorsten


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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



Struts and Pajes

2004-02-03 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi to yall,

 

Im trying to integrate Pajes (www.apache.org), a Servlet Presentation Framework, with 
Struts. The idea is to use Struts MVC separation (Action, ActionForms, ActionServlet, 
etc) WITHOUT using Struts presentation tools (i.e. no JSP, ergo no JSP Tags), just 
plain XHTML templates (in conjunction with the Pajes framework I just mentioned).

 

Im not interested in an XSLT-based solution (for now).

 

The problem Ive come across:

 

For connecting with Pajes, Ive thought about a Servlet (kind of a View Dispatcher) 
that should be the entry point to all Pajes-related requests. Then, one would do 
things like this:

 

package org.gn.samples.strutspajes.login;

 



 

public class MyFirstAction extends Action {

 

  public ActionForward execute(ActionMapping actionMapping) {

MyFirstActionForm theActionForm = (LoginActionForm) actionForm;

if () {

  return actionMapping.findForward(/some_other_typically_mapped_page);

} else {

  

  ActionForward af = new 
PajeViewActionForwardFactory.generate(fully.qualified.view.generator.pajes.classname,
 theTemplateFilename.html, request);

  return af;

}

  }

}

 

 where the generated ActionForward object points to the aforementioned Servlet, 
including on that URL the corresponding parameters. Examples:

 

/PajeDispatcher?template=Login.htmlfactory=org.gn.samples.strutspajes.login.LoginPageView
 (in case this is the default web application)

 

/webappname/PajeDispatcher?template=ProductCatalog.htmlfactory=org.gn.samples.strutspajes.login.NavigateProductCatalogPageView
 (in case this is not the default web application and the name is webappname)

 

This solves the problem of delegating from Struts to Pajes.

 

HOWEVER, I have not solved yet the data access method part. I NEED TO BE ABLE TO 
RECOVER THE APPROPRIATE ActionForm object FROM THAT Servlet (actually, in a factory 
class, but I dont want to bother you with all the details) so that the 
view-generating class can paint, WITHOUT REPLICATING THE ActionForm Management 
(especially, the scopes management) ALREADY PERFORMED BY Struts. HOW CAN I DO THAT???

 

(1) Is there some method (+ class) that, given an Action class (/classname), 
returns the ActionForm object its currently associated to? (if any)

(2) Whats the minimal information that one needs to retrieve an Actions 
corresponding ActionForm object?

(3) How can I do it from an ordinary Servlet?

 

Note that Im trying to avoid passing it through the Session. My initial idea was to 
take advantage of the classes behind the tag libs that do this, but from what Ive 
seen so far (I mean, its source code), that is not possible (the code is too tied to a 
JSP environment).

 

This is my first effort. Therefore, Im not worried about being able to do 
EVERYTHING that can be done through the tag libs. For now, the only thing I look 
forward is to be able to recover the appropriate ActionForm object associated to that 
Action from where redirection took place (ActionForward, that is).

 

Id really appreciate any thoughts on this matter.

 

Thanx,

Freddy.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 


Pajes + Struts (REPOSTED and FORMATTED)

2004-02-03 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi to yall,

 

Im trying to integrate Pajes (www.pajes.org), a Servlet Presentation

Framework, with Struts. The idea is to use Struts MVC separation (Action,

ActionForms, ActionServlet, etc) WITHOUT using Struts presentation tools

(i.e. no JSP, ergo no JSP Tags), just plain XHTML templates (in conjunction

with the Pajes framework I just mentioned).

 

Im not interested in an XSLT-based solution (for now).

 

The problem Ive come across:

 

For connecting with Pajes, Ive thought about a Servlet (kind of a View

Dispatcher) that should be the entry point to all Pajes-related requests.

Then, one would do things like this: 

 

package org.gn.samples.strutspajes.login;

 

. . .

 

public class MyFirstAction extends Action {

 

  public ActionForward execute(ActionMapping actionMapping . . .) {

MyFirstActionForm theActionForm = (LoginActionForm) actionForm;

if (. . .) {

  . . .

  return actionMapping.findForward(/some_other_typically_mapped_page);

} else {

  . . .

  ActionForward af = 

   new PajeViewActionForwardFactory.generate(f.q.view.gen.pajes.classname,

 theTemplateFilename.html,

 request);

  return af;

}

  }

 

}

 

 where the generated ActionForward object points to the aforementioned

Servlet, including on that URL the corresponding parameters. Examples:

 

/PajeDispatcher?template=Login.htmlfactory=org.gn.samples.strutspajes.login.LoginPageView
 (in case this is the default web application)

 

 

/webappname/PajeDispatcher?template=ProductCatalog.htmlfactory=org.gn.samples.strutspajes.login.NavigateProductCatalogPageView
 (in case this is not the default web application and the name is webappname)

 

 

This solves the problem of delegating from Struts to Pajes.

 

HOWEVER, I have not solved yet the data access method part. I MUST

BE ABLE TO RECOVER THE APPROPRIATE ActionForm object FROM THAT Servlet

(actually, in a factory class, but I dont want to bother you with all

the details) so that the view-generating class can paint, WITHOUT

REPLICATING THE ActionForm Management (especially, the scopes management)

ALREADY PERFORMED BY Struts. HOW CAN I DO THAT???

 

(1) Is there some method (+ class) that, given an Action class (/classname),

returns the ActionForm object its currently associated to? (if any)

 

(2) Whats the minimal information that one needs to retrieve an Actions

corresponding ActionForm object?

 

(3) How can I do it from an ordinary Servlet?

 

Note that Im trying to avoid passing it through the Session. My initial

idea was to take advantage of the classes behind the tag libs that do this,

but from what Ive seen so far (I mean, its source code), that is not

possible (the code is too tied to a JSP environment).

 

This is my first effort. Therefore, Im not worried about being able to

do EVERYTHING that can be done through the tag libs. For now, the only

thing I look forward is to be able to recover the appropriate ActionForm

object associated to that Action from where redirection took place

(ActionForward, that is).

 

Id really appreciate any thoughts on this matter.

 

Thanks everybody,

Freddy.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 


RE: Accessing ActionForm from Servlet (was: Pajes + Struts)

2004-02-03 Thread Villalba Arias, Fredy [BILBOMATICA]
Hi Hubert, thanx for answering!

Read below.

Not sure this would be possible.  The actual ActionForm in use depends on the
session, and sometimes even the particular request.  I doubt there's a way to
get to the form object actually in use by just specifying the action class.
If it's the *class* of the ActionForm you want, check out the ActionMapping
object for a particular mapping.

The doGet method receives the request and response objects. Correct me if
I'm wrong, but the request object is client-specific, and so are the
ActionForm objects, as you clearly mentioned above. Therefore, no matter
which client originated the request, through it you'd be able to access any
attribute stored on that specific request or even on the Session associated
to it. Being Struts already in charge of managing the life-cycle of the
ActionForm-s, I believe there shouldn't be a problem in trying to access the
ActionForm for a given Action (/client) from a separate Servlet, since the
latter won't be able to reach anything the former does not want it to.

This was actually the initial reasoning that led me to the tesis that it
should be absolutely feasible to accomplish this integration. Do u agree?

This said, my question remains: is there some Struts' class that
encapsulates the scope issue (and others as well) and, given a form bean's
name (and maybe the request / Session / something else...), returns it (if
exists)???

I sneaked through the tag libs classes (the source code) and saw something
more or less similar to what I'm looking for; the problem was that it did
additional stuff I don't want to get executed, plus it was tied to JSP (it
used pageContext and other stuff)...


 (3) How can I do it from an ordinary Servlet?

request.getAttribute(formName);
or 
session.getAttribute(formName);
 depending on the scope of the form as declared in struts-config.

Would that be the formName as declared in struts-config?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/2003
 

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