Re: Struts2 URL problem

2008-03-17 Thread Tauri Valor

Thanks Jeromy

I will try your approach and let you know.




Jeromy Evans - Blue Sky Minds wrote:
 
 At this point I'd either
 a) accept it, because it's unlikely to cause really problems or ever be 
 noticed by a real user. It's just scrappy
 b) create a custom ActionMapper derived from the default one that 
 removes that feature
 c) Use a plugin that does b for you
 
 I don't use the DefaultActionMapper myself any more.
 
 Option b is not as difficult as it may first seem.  The default code is 
 quite straight-forward [1], [2]
 
 As you're using Struts 2.0 you can't use the new Convention plugin.  As 
 you're using struts.xml rather than CodeBehind I don't recommend 
 switching to the SmartURLs plugin as you'll have to re-check all the 
 configuration (unless it's a small application) [3].  The 
 Struts2UrlPlugin [4] will fix the problem immediately by dropping the 
 jar into the classpath but it's not released yet, undocumented and is 
 probably overkill.
 
 So I recommend a) or b).
 
 [1] http://struts.apache.org/2.x/docs/actionmapper.html
 [2] 
 http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java?view=markup
 [3] http://cwiki.apache.org/S2PLUGINS/smarturls-plugin.html
 [4] http://code.google.com/p/struts2urlplugin/
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts2-URL-problem-tp16020941p16089143.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] variable of variable in OGNL?

2008-03-17 Thread GF
I have something like
%{#application.one.two.three}

is it possible to do something like:

%{#application.%{stringVariable}.two.three}

Thanks.


Re: Struts 2 scheduler

2008-03-17 Thread GF
Yes, I usually use Quartz inside Spring.
If I remember correctly there is a chapter about Scheduling in the big
Spring manual

On Fri, Mar 14, 2008 at 3:47 AM, alex xander [EMAIL PROTECTED] wrote:

 thx all,
 i solve my problem with quartz, i used it with spring
 thx so much



Re: should I learn struts 1 first before learning struts 2?

2008-03-17 Thread GF
I learned Struts2 without knowing anything about Struts1.
But I'm a little curious to take a look to Struts1 too. But just for
personal knowledge.

On Fri, Mar 14, 2008 at 7:51 PM, akoo [EMAIL PROTECTED] wrote:


 Hi, forgive me if this has been asked before.  I am just starting on
 struts
 and wondering if I should first learn Struts 1 or just jump straight to
 struts 2?  Will spending time on struts 1 help me with struts 2 or will it
 get in the way since everything in struts 2 is different from Struts 1?  I
 have all of the requisites for starting struts 1.
 Thanks.



Re: How to initialize business service objects?

2008-03-17 Thread GF
I suggest you to read this simple but useful tutorial to have an idea about
how much is simple to use Struts2+Spring+Hibernate together.

http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html

On Thu, Mar 13, 2008 at 10:32 PM, Frank Fischer 
[EMAIL PROTECTED] wrote:


 Now i don't understand (1) where to create/initialize these business logic
 classes and (2) how to get access to them from the action classes.



Struts2 Annotation based Validation

2008-03-17 Thread Tauri Valor

Using Annotation based Validation, I want to try the following:

The Validation Error message can be retrieved in our jsp using :

s:actionerror /
s:fielderror / 

Do I have any alternative method of using the above tags ? 
For eg. can I retrieve the error using session.getAttribute(actionerror) ? 

Are actionerror and fielderror stored in a request or a session object ?

Please help me understand this .

Thanks,
Tauri.

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16089678.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Is type property in form-bean / tag must be filled?

2008-03-17 Thread Chen Chunwei
Hi all,

I'm new to Struts. And I want to ask if the type property in form-bean / tag 
must be filled? I mean if it's null, will the form-bean work?

Thanks.

Talos

Re: Is type property in form-bean / tag must be filled?

2008-03-17 Thread Antonio Petrelli
2008/3/17, Chen Chunwei [EMAIL PROTECTED]:
  I'm new to Struts. And I want to ask if the type property in form-bean / 
 tag must be filled? I mean if it's null, will the form-bean work?

If you are using Struts 1.2.x, the type attribute is required:
http://struts.apache.org/dtds/struts-config_1_2.dtd

If you are using Struts 1.3.x, you must specify the type or the
extends attribute.

HTH
Antonio

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



Re: Is type property in form-bean / tag must be filled?

2008-03-17 Thread Chen Chunwei
Thanks Antonio

But I'm using Struts 1.1, then is it still required?

Talos

- Original Message - 
From: Antonio Petrelli [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, March 17, 2008 4:07 PM
Subject: Re: Is type property in form-bean / tag must be filled?


 2008/3/17, Chen Chunwei [EMAIL PROTECTED]:
  I'm new to Struts. And I want to ask if the type property in form-bean / 
 tag must be filled? I mean if it's null, will the form-bean work?
 
 If you are using Struts 1.2.x, the type attribute is required:
 http://struts.apache.org/dtds/struts-config_1_2.dtd
 
 If you are using Struts 1.3.x, you must specify the type or the
 extends attribute.
 
 HTH
 Antonio
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


Re: Is type property in form-bean / tag must be filled?

2008-03-17 Thread Antonio Petrelli
2008/3/17, Chen Chunwei [EMAIL PROTECTED]:

 But I'm using Struts 1.1, then is it still required?



Yes. See:
http://struts.apache.org/dtds/struts-config_1_1.dtd

And learn DTD :-)

Antonio


Re: s:property in s:* not interpreted

2008-03-17 Thread GF


 ...unless you use the XML syntax available from JSP 2.0 and later ;-)


And in this case, how can you resolve the div id=s:property... ?


Re: [S2] accessing #application and #request from a Interceptor

2008-03-17 Thread Nils-Helge Garli Hegvik
Have you tried context.getApplication()?

BTW: The source code for the ServletConfigInterceptor shows how to
access most of the context objects from an interceptor.

Nils-H

On Mon, Mar 17, 2008 at 10:16 AM, GF [EMAIL PROTECTED] wrote:

 On Mon, Mar 17, 2008 at 10:06 AM, GF [EMAIL PROTECTED] wrote:

   I have some data stored in #application.mymap
   Inside and interceptor I want to put some of this data in
   #request.anothermap
  
   How can I access them?
   About the #request,  is it right to do this?
  
   final ActionContext context = invocation.getInvocationContext();
   request = (HttpServletRequest) context.get(HTTP_REQUEST);
   request.setAttribute(anothermap, anotherMap);
  
  
   Ok, I have found this is right.
  I'm still searching how to access #application map from the Interceptor..


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



Re: [S2] accessing #application and #request from a Interceptor

2008-03-17 Thread GF
On Mon, Mar 17, 2008 at 10:06 AM, GF [EMAIL PROTECTED] wrote:

 I have some data stored in #application.mymap
 Inside and interceptor I want to put some of this data in
 #request.anothermap

 How can I access them?
 About the #request,  is it right to do this?

 final ActionContext context = invocation.getInvocationContext();
 request = (HttpServletRequest) context.get(HTTP_REQUEST);
 request.setAttribute(anothermap, anotherMap);


 Ok, I have found this is right.
I'm still searching how to access #application map from the Interceptor..


Re: Is type property in form-bean / tag must be filled?

2008-03-17 Thread Antonio Petrelli
2008/3/17, Chen Chunwei [EMAIL PROTECTED]:

 Thanks Antonio.

 I know little about DTD, but in my company, we are not allowed to access
 Internet. So I cann't see these dtds. :-(


WTF?
Now I know why you are still using Struts 1.1 :-D
You're forgiven :-D

Antonio


Re: Struts2 Annotation based Validation

2008-03-17 Thread Lukasz Lenart
Hi,

Error messages are stored in request, you have to subclass
ActionSupport and add some mechanism to store messages in session.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Is type property in form-bean / tag must be filled?

2008-03-17 Thread Chen Chunwei
Thanks Antonio.

I know little about DTD, but in my company, we are not allowed to access 
Internet. So I cann't see these dtds. :-(

Talos

- Original Message - 
From: Antonio Petrelli [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, March 17, 2008 4:32 PM
Subject: Re: Is type property in form-bean / tag must be filled?


 2008/3/17, Chen Chunwei [EMAIL PROTECTED]:

 But I'm using Struts 1.1, then is it still required?
 
 
 
 Yes. See:
 http://struts.apache.org/dtds/struts-config_1_1.dtd
 
 And learn DTD :-)
 
 Antonio


[S2] accessing #application and #request from a Interceptor

2008-03-17 Thread GF
I have some data stored in #application.mymap
Inside and interceptor I want to put some of this data in
#request.anothermap

How can I access them?
About the #request,  is it right to do this?

final ActionContext context = invocation.getInvocationContext();
request = (HttpServletRequest) context.get(HTTP_REQUEST);
request.setAttribute(anothermap, anotherMap);


Re: Struts2 Annotation based Validation

2008-03-17 Thread Tauri Valor

Thanks Lukasz!

I tried request.getAttribute(actionerror) and
request.getAttribute(fielderror) in my jsp but it did not work.

Am I doing it the wrong way ? 









Lukasz Lenart wrote:
 
 Hi,
 
 Error messages are stored in request, you have to subclass
 ActionSupport and add some mechanism to store messages in session.
 
 
 Regards
 -- 
 Lukasz
 
 http://www.linkedin.com/in/lukaszlenart
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts2-Annotation-based-Validation-tp16089678p16090926.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts2 Annotation based Validation

2008-03-17 Thread Jeromy Evans

Lukasz Lenart wrote:

Hi,

Error messages are stored in request, you have to subclass
ActionSupport and add some mechanism to store messages in session.


Regards
  


In Struts2 error messages are stored in the ValueStack in an object 
implementing ValidationAware.
If your action extends ActionSupport, then means they're available as a 
property of your action.


You can read them from any object in the ValueStack using OGNL.  Have a 
look at ValidationAware.


eg. to iterate through action errors:
s:iterator value=actionErrors/s:iterator

They're not available in the request object. They are available in the 
session object only if something puts them there for you (which is not 
the default case).


The actionError tag applies a template.  You may be better off creating 
a custom template.


regards,
Jeromy Evans



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



Re: Struts2 Annotation based Validation

2008-03-17 Thread Lukasz Lenart
 In Struts2 error messages are stored in the ValueStack in an object

Yes, I made mistake, I've mean in request scope, not in request object ;-)


Regards
-- 
Lukasz

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



[S2] Calling getMethod with parametr

2008-03-17 Thread bugs_

In Struts 1 is this:

  In the ActionForm is this method:
public boolean getTechnologyCheckbox(String key) throws
ValueNotDefinedException {
  return sessionData.getTechnologyById(key).isSelected();
}

  In the jsp page is:
html:checkbox property=%=propertyName% styleClass=textinput/
%=propertyName% is for example
technologyCheckbox(thermal_desorption)
so as result it render:
input type=checkbox name=technologyCheckbox(thermal_desorption)
value=on
  checked=checked class=textinput
It call method getTechnologyCheckbox(thermal_desorption) from
ActionForm, and it works fine.


I need rewrite this in Struts 2.

  In Struts 2 action I have methods:
public boolean getTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}

public boolean isTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}

  In jsp page i have:
s:checkbox name=%{#attr.propertyName} cssClass=textinput /
so as result it render for example:
input type=checkbox name=technologyCheckbox(thermal_desorption)
value=true 
id=technologies_technologyCheckbox(thermal_desorption)
class=textinput/

  But this doesn't work. It never call method
  getTechnologyCheckbox(thermal_desorption) or
isTechnologyCheckbox(thermal_desorption).
  That's why chech box is never checked.

Please. Can anybody help me?
-- 
View this message in context: 
http://www.nabble.com/-S2--Calling-getMethod-with-parametr-tp16092039p16092039.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: s:property in s:* not interpreted

2008-03-17 Thread Dave Newton
--- GF [EMAIL PROTECTED] wrote:
  ...unless you use the XML syntax available from JSP 2.0 and later ;-)
 And in this case, how can you resolve the div id=s:property... ?

div id=${aProperty}...

Dave


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



Re: [OT] XML Preprocessing

2008-03-17 Thread Roger Varley
I've never tried to do this since, normally, you want the XML processor to 
handle entities such as the  symbol - and if either the input XML or output 
XML contains these symbols unaltered then you don't have legal XML.

If you really need to leave these unprocessed, then perhaps you can replace 
the SAX EntityResolver with your own implementation?

Perhaps if you could explain what you're trying to do?

Regards

On Monday 17 March 2008 05:39:07 Chris Pratt wrote:
 Sorry I missed the normal Friday free-for-all with my Off Topic
 question, but I'm hoping someone around here has already solved the
 problem I'm staring at.

 I am trying to pre-process a stream of HTML/XML.  My first thought was
 to just use SAX (with TagSoup for the HTML) and watch for the tokens I
 needed to modify while passing the rest through, but all the XML tools
 I can find are geared towards processing XML, not pre-processing it.
 So they help you out by automatically converting entities to their
 values and other things that completely get in the way of
 pre-processing.  Has anybody else had to solve this problem?  If so,
 any pointers would be GREATLY appreciated.  Thanks.
   (*Chris*)

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



Re: [OT] XML Preprocessing

2008-03-17 Thread Chris Pratt
On Mon, Mar 17, 2008 at 8:02 AM, Roger Varley
[EMAIL PROTECTED] wrote:
 I've never tried to do this since, normally, you want the XML processor to
  handle entities such as the  symbol - and if either the input XML or output
  XML contains these symbols unaltered then you don't have legal XML.

  If you really need to leave these unprocessed, then perhaps you can replace
  the SAX EntityResolver with your own implementation?

  Perhaps if you could explain what you're trying to do?


Unfortunately the EntityResolver just finds files containing external
entities, so that doesn't seem to help much.

What I'm trying to do is read a stream of HTML and make changes to
certain tags ,like adding a target=_blank to the a tags and
setting the src attributes for img, link and others so they can't
be loaded, for a mail viewer web application.  I'd prefer not to
change the stream in any ways other than the intentional changes, so
that I don't run into any weird bugs down the line.  But I haven't
found a good technique to do that yet.
  (*Chris*)

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



RE: How to initialize business service objects?

2008-03-17 Thread Frank Fischer

Hi all 

first i'd like to thank all of you that have given me valuable feedback to
my question. 

Following the answers from Dave and Jeromy i decided to go the hard way
with Spring and DI. After reading some manuals (thanks to GF, good reading)
i managed to load the Spring ContextLoaderListener and even define an POJO
bean that serves as my BusinessLogicService. From the Tomcat logs i can see
that an instance of that Service is created. 

As far as i read/unterstood, i now would only have to create a setter method
on my Action class and Spring then would automatically inject the related
dependcy to my Action class. So far, this doesn't seem to work, so i guess,
i must be missing something.

My applicationContext.xml looks quite simple (and seems to work, since the
DispatcherService is created on startup):

---
?xml version=1.0 encoding=UTF-8?
!DOCTYPE beans PUBLIC -//SPRING//DTD BEAN//EN
http://www.springframework.org/dtd/spring-beans.dtd;
beans default-autowire=autodetect
bean id=DispatcherService
class=com.demo.businesslogic.DispatcherService/
/beans
---

The Struts config looks like:

---
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts
Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd;

struts

package name=customerAgent extends=struts-default

action name=login method=login class=com.demo.CustomerAction
result name=input/CustomerLogin.jsp/result
result name=success/CustomerChat.jsp/result
/action

action name=logout method=logout
class=com.demo.CustomerAction
result name=success/CustomerLogin.jsp/result
result name=input/CustomerLogin.jsp/result
/action

action name=chat method=chat class=com.demo.CustomerAction
result name=success/CustomerChat.jsp/result
/action


/package

/struts
---

So i guess, i must be missing something. Is there a way i would have to tell
Spring which Action classes to inject?

Thanks a lot for your help
Frank





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



Re: How to initialize business service objects?

2008-03-17 Thread Piero Sartini
Am Donnerstag, 13. März 2008 22:32:34 schrieb Frank Fischer:
 Now i don't understand (1) where to create/initialize these business logic
 classes and (2) how to get access to them from the action classes.

Just build your business logic without thinking about s2 too much. From your 
action classes you can access your business logic like everything else. Its 
really more of a java problem how to do this =)

If you have to run initialization code at startup, maybe a normal Listener is 
what you are looking for...

Piero



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



RE: How to initialize business service objects?

2008-03-17 Thread Griffith, Michael *
Frank, 

Check two things:

1) You have included the struts2-spring-pliugin.jar in your classpath
2) Your applicationContext.xml file is getting loaded on startup.  If
you haven't already done so, check your web.xml for a context parameter
like this:
context-param
param-namecontextConfigLocation/param-name

param-valueclasspath*:applicationContext*.xml/param-value
/context-param

HTH, 
MG
-Original Message-
From: Frank Fischer [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 17, 2008 11:09 AM
To: 'Struts Users Mailing List'
Subject: RE: How to initialize business service objects?


Hi all 

first i'd like to thank all of you that have given me valuable feedback
to
my question. 

Following the answers from Dave and Jeromy i decided to go the hard
way
with Spring and DI. After reading some manuals (thanks to GF, good
reading)
i managed to load the Spring ContextLoaderListener and even define an
POJO
bean that serves as my BusinessLogicService. From the Tomcat logs i can
see
that an instance of that Service is created. 

As far as i read/unterstood, i now would only have to create a setter
method
on my Action class and Spring then would automatically inject the
related
dependcy to my Action class. So far, this doesn't seem to work, so i
guess,
i must be missing something.

My applicationContext.xml looks quite simple (and seems to work, since
the
DispatcherService is created on startup):

---
?xml version=1.0 encoding=UTF-8?
!DOCTYPE beans PUBLIC -//SPRING//DTD BEAN//EN
http://www.springframework.org/dtd/spring-beans.dtd;
beans default-autowire=autodetect
bean id=DispatcherService
class=com.demo.businesslogic.DispatcherService/
/beans
---

The Struts config looks like:

---
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts
Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd;

struts

package name=customerAgent extends=struts-default

action name=login method=login
class=com.demo.CustomerAction
result name=input/CustomerLogin.jsp/result
result name=success/CustomerChat.jsp/result
/action

action name=logout method=logout
class=com.demo.CustomerAction
result name=success/CustomerLogin.jsp/result
result name=input/CustomerLogin.jsp/result
/action

action name=chat method=chat
class=com.demo.CustomerAction
result name=success/CustomerChat.jsp/result
/action


/package

/struts
---

So i guess, i must be missing something. Is there a way i would have to
tell
Spring which Action classes to inject?

Thanks a lot for your help
Frank





-
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 to initialize business service objects?

2008-03-17 Thread Randy Burgess
You also need to setup your action in the application context so that Spring
knows where to inject the business object. Your class name in the Struts
action also needs to be the *bean id of the action* so that the
Struts/Spring plugin can do it's work. So assuming you have a setter for
DispatcherService in CustomerAction your struts.xml would look like this.

 struts
 
 package name=customerAgent extends=struts-default
 
 action name=login method=login class=customerAction
 result name=input/CustomerLogin.jsp/result
 result name=success/CustomerChat.jsp/result
 /action
...

Application context:
...
bean id=customerAction class=com.demo.CustomerAction
property name=DispatcherService ref=DispatcherService/
/bean

I recommend making your bean id's lower case and lower case properties in
the Action.

Private DispatcherService dispatcherService;

Then the property would be
property name=dispatcherService ref=dispatcherService/

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



 From: Frank Fischer [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Date: Mon, 17 Mar 2008 17:08:30 +0100
 To: 'Struts Users Mailing List' user@struts.apache.org
 Subject: RE: How to initialize business service objects?
 
 
 Hi all 
 
 first i'd like to thank all of you that have given me valuable feedback to
 my question. 
 
 Following the answers from Dave and Jeromy i decided to go the hard way
 with Spring and DI. After reading some manuals (thanks to GF, good reading)
 i managed to load the Spring ContextLoaderListener and even define an POJO
 bean that serves as my BusinessLogicService. From the Tomcat logs i can see
 that an instance of that Service is created.
 
 As far as i read/unterstood, i now would only have to create a setter method
 on my Action class and Spring then would automatically inject the related
 dependcy to my Action class. So far, this doesn't seem to work, so i guess,
 i must be missing something.
 
 My applicationContext.xml looks quite simple (and seems to work, since the
 DispatcherService is created on startup):
 
 ---
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE beans PUBLIC -//SPRING//DTD BEAN//EN
 http://www.springframework.org/dtd/spring-beans.dtd;
 beans default-autowire=autodetect
 bean id=DispatcherService
 class=com.demo.businesslogic.DispatcherService/
 /beans
 ---
 
 The Struts config looks like:
 
 ---
 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts
 Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd;
 
 struts
 
 package name=customerAgent extends=struts-default
 
 action name=login method=login class=com.demo.CustomerAction
 result name=input/CustomerLogin.jsp/result
 result name=success/CustomerChat.jsp/result
 /action
 
 action name=logout method=logout
 class=com.demo.CustomerAction
 result name=success/CustomerLogin.jsp/result
 result name=input/CustomerLogin.jsp/result
 /action
 
 action name=chat method=chat class=com.demo.CustomerAction
 result name=success/CustomerChat.jsp/result
 /action
 
 
 /package
 
 /struts
 ---
 
 So i guess, i must be missing something. Is there a way i would have to tell
 Spring which Action classes to inject?
 
 Thanks a lot for your help
 Frank
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



This email and any attachments (Message) may contain legally privileged 
and/or confidential information.  If you are not the addressee, or if this 
Message has been addressed to you in error, you are not authorized to read, 
copy, or distribute it, and we ask that you please delete it (including all 
copies) and notify the sender by return email.  Delivery of this Message to any 
person other than the intended recipient(s) shall not be deemed a waiver of 
confidentiality and/or a privilege.

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



Re: How to initialize business service objects?

2008-03-17 Thread Rushikesh Thakkar
Frank,

AFAIU, you want your Business Service Object to be injected in your Struts2
actions. To achieve that, I have done this:

- Using Spring ObjectFactory.
- Declare Business Service Object (BSO) in Spring's
applicationContext.xml(you've already done that)
- Define action that has setter method for your BSO.
- Declare this action as a bean in applicationContext.xml, with BSO
injected as dependency.

Sample Code:

Action:

public class SetEndPoint extends ActionSupport {
private DispatcherService dispatcherService;
public String execute () throws Exception {
//-your business logic-
return SUCCESS;
}

// DispatcherService object will be set (i.e. injected) by Spring (see
applicationContext.xml)
*public void setDispatcherService(DispatcherService dispatcherService)*{
this.dispatcherService = dispatcherService;
}
}

applicationContext.xml

 !-- . your existing bean declaration for DispatcherService
remains  -

!-- . Declare action here, injecting DispatcherService  -
bean id=setEndPoint class=example.client.web.action.SetEndPoint
*property name=dispatcherService*
ref bean=DispatcherService/
/property
/bean

struts.xml

struts
*constant name=struts.objectFactory value=spring /*
package name=no.bbs extends=struts-default
action name=setEndPoint method=execute *class=setEndPoint* 
result name=consumeA/view/consumeAcos.jsp/result
result name=consumeB/view/consumeMapp.jsp/result
result name=error/view/error.jsp/result
/action
/package
/struts

I have underlined important parts of each artifact..
I hope this helps..

-Rushikesh

On Mon, Mar 17, 2008 at 5:28 PM, Piero Sartini [EMAIL PROTECTED]
wrote:

 Am Donnerstag, 13. März 2008 22:32:34 schrieb Frank Fischer:
  Now i don't understand (1) where to create/initialize these business
 logic
  classes and (2) how to get access to them from the action classes.

 Just build your business logic without thinking about s2 too much. From
 your
 action classes you can access your business logic like everything else.
 Its
 really more of a java problem how to do this =)

 If you have to run initialization code at startup, maybe a normal Listener
 is
 what you are looking for...

Piero



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




Re: [OT] XML Preprocessing

2008-03-17 Thread Dave Newton
--- Chris Pratt [EMAIL PROTECTED] wrote:
 What I'm trying to do is read a stream of HTML and make changes to
 certain tags ,like adding a target=_blank to the a tags and
 setting the src attributes for img, link and others so they can't
 be loaded, for a mail viewer web application.  I'd prefer not to
 change the stream in any ways other than the intentional changes, so
 that I don't run into any weird bugs down the line.  But I haven't
 found a good technique to do that yet.

While I'd imagine there are HTML libraries that don't convert entities (you
might check out http://htmlparser.sourceforge.net/, at least) you can always
use regular expressions. If your input is well-formed I'd imagine that XSLT
would also work, but then you'd have to use XSLT, and we'd all stand around
and laugh and point.

I don't know if you're trying to do this from within a Java application or as
a standalone tool, but if standalone, I'd probably just use one of the
[J]Ruby alternatives; I do a lot of massaging with a combination of regex and
some of the XML/HTML libraries.

Dave


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



Re: How to initialize business service objects?

2008-03-17 Thread Dave Newton
--- Randy Burgess [EMAIL PROTECTED] wrote:
 You also need to setup your action in the application context so that
 Spring knows where to inject the business object. 

You *can* do it that way, but the default setup doesn't require it. It
depends on how you're wiring, whether or not your philosophically opposed to
magic, and so on.

Dave



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



Struts 2 and JSP 2.0 tags

2008-03-17 Thread Kalpesh Modi
Hi,

Is there anyway to use the JSP 2.0 tag files and the Struts 2.0 tags together.

I have created a JSP 2.0 .tag file. Inside that file, I want to access the 
attributes passed from the main jsp. I want to access the attributes using the 
Struts 2.0 tags. Is there any way to do it?

I am using Struts 2.0.11.

Any help appreciated.

Thanks,
-Kal

   
-
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

Re: [struts] Struts 2 and JSP 2.0 tags

2008-03-17 Thread Dale Newfield

Kalpesh Modi wrote:

Is there anyway to use the JSP 2.0 tag files and the Struts 2.0 tags together.


Yes, all you have to do is add the taglib at the top of your .tag file 
so that you can refer to the s: tags.  The difficulty comes in passing 
arguments.  At first I was only able to successfully pass the top of the 
VS, but that's brittle (and only really supports 1 argument well), so 
I've changed over to passing objects as tag attributes.  In order to do 
this you must pass using EL, not OGNL.


I found that arguments from one .tag file to another didn't work 
correctly in tomcat6.  (But it does in tomcat5.5 and in glassfish.)


-Dale

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



RE: How to initialize business service objects?

2008-03-17 Thread Frank Fischer
Hi Michael

Thanks for your answer.

 1) You have included the struts2-spring-pliugin.jar in your classpath

Yes, it put it under WEB-INF/lib/ so it's packaged to the war file and
should be available to tomcat it think. I also can't see any error or
warning messages while deploying the application, so i guess the package can
be resolved. 

 2) Your applicationContext.xml file is getting loaded on startup.  If
 you haven't already done so, check your web.xml for a context 
 parameter
 like this:
   context-param
   param-namecontextConfigLocation/param-name
   
 param-valueclasspath*:applicationContext*.xml/param-value
   /context-param

I did not include that line because i read, that this is the default setting
Spring uses when no contextConfigLocation parameter is defined. I just added
it but it didn't change anything as far as i see.

Thanks again for your help.
Frank


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



RE: How to initialize business service objects?

2008-03-17 Thread Dave Newton
--- Frank Fischer [EMAIL PROTECTED] wrote:
 beans default-autowire=autodetect

Off the top of my head I don't recall what autodetect means.

Did you try leaving out the default-autowire attribute or switching it to
the default (name or something like that; I don't recall) and seeing if
that works?

That would at least help determine if everything is getting
deployed/initialized correctly.

Dave



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



RE: How to initialize business service objects?

2008-03-17 Thread Griffith, Michael *
Frank, 

I would check your struts.properties file:

Make sure it has these entries and that it is on your classpath (i.e. in
WEB-INF/classes)

struts.objectFactory = spring
struts.objectFactory.spring.autoWire = name

MG

-Original Message-
From: Frank Fischer [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 17, 2008 1:35 PM
To: 'Struts Users Mailing List'
Subject: RE: How to initialize business service objects?

Hi Michael

Thanks for your answer.

 1) You have included the struts2-spring-pliugin.jar in your classpath

Yes, it put it under WEB-INF/lib/ so it's packaged to the war file and
should be available to tomcat it think. I also can't see any error or
warning messages while deploying the application, so i guess the package
can
be resolved. 

 2) Your applicationContext.xml file is getting loaded on startup.  If
 you haven't already done so, check your web.xml for a context 
 parameter
 like this:
   context-param
   param-namecontextConfigLocation/param-name
   
 param-valueclasspath*:applicationContext*.xml/param-value
   /context-param

I did not include that line because i read, that this is the default
setting
Spring uses when no contextConfigLocation parameter is defined. I just
added
it but it didn't change anything as far as i see.

Thanks again for your help.
Frank


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



uploaded image file contentType (IE vs Firefox)

2008-03-17 Thread akash agrawal
Hi,

I am using fileuploadinterceptor which is part defaultStack. I upload an image 
*.jpg using IE and Firefox and get a different contentType in action for 
different browser.
IE returns content type as image/pjpeg whereas Firefox returns content type as 
image/jpeg.
Similary for a *.png image uploading using IE and Firefox returns different 
content types. IE returns content type as image/x-png whereas Firefox returns 
image/png.

What can I do to resolve this conflict and not get different content types? Is 
there other property which can be accessed regarding the image types (like mime 
type)?
Anyone else came across such a use case?

Thanks.

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: uploaded image file contentType (IE vs Firefox)

2008-03-17 Thread Dave Newton
--- akash agrawal [EMAIL PROTECTED] wrote:
 What can I do to resolve this conflict and not get different content types?

Only use one browser?

Can't you just do some processing/aggregation of content types on the server
side?

Dave


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



Re: uploaded image file contentType (IE vs Firefox)

2008-03-17 Thread akash agrawal
Thanks for the reply Dave.

I have to support both IE and Firefox so can't use just one browser.

Yes, I can do some processing on the server side and handle image/pjpeg and 
image/jpeg as same and image/x-png and image/png as same but would prefer not 
to as decoding these images requires different decoders and may get into some 
trouble down the road.
I was wondering if this is an issue of combination of browser and struts 
framework and if there is access to more properties which can give more 
information about the uploaded images.

Thanks.

Dave Newton [EMAIL PROTECTED] wrote: --- akash agrawal  wrote:
 What can I do to resolve this conflict and not get different content types?

Only use one browser?

Can't you just do some processing/aggregation of content types on the server
side?

Dave


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



   
-
Never miss a thing.   Make Yahoo your homepage.

Re: uploaded image file contentType (IE vs Firefox)

2008-03-17 Thread Dave Newton
--- akash agrawal [EMAIL PROTECTED] wrote:
 I have to support both IE and Firefox so can't use just one browser.

I was kidding.

 Yes, I can do some processing on the server side and handle image/pjpeg and
 image/jpeg as same and image/x-png and image/png as same but would prefer
 not to as decoding these images requires different decoders and may get
 into some trouble down the road.

I don't know what you're doing with the files that they need decoding anyway,
but it probably doesn't matter. If you're that concerned then you'll probably
need to sniff the file yourself to determine the content type. Searching the
web may give you some leads on what libraries are available.

I don't know of a way to control what the browser sends as an upload content
type; each browser sniffs the files differently, but someone else may have
some ideas.

Dave


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



Re: Struts 1 return stream (documents)

2008-03-17 Thread Dave Newton
Does this help?

http://wiki.apache.org/struts/StrutsFileDownload

Dave

--- bhaarat Sharma [EMAIL PROTECTED] wrote:

 Hello,
 
 I started struts by learning struts2.  However, now i am working with
 struts 1: (
 
 I am faced with a problem where user downloads a file.
 
 I have this in the struts.xml
 
   action path=/viewModificationDocument
   

type=org.something1.something2.actions.download.ModificationDocumentDownloadAction
   scope=request input=viewAwardModification
   /action
 
 And then in the action I have this which is returning a bytestream
 
   protected class ByteArrayStreamInfo implements StreamInfo {
 
   protected String contentType;
 
   protected byte[] bytes;
 
   public ByteArrayStreamInfo(String contentType, byte[] bytes) {
   this.contentType = contentType;
   this.bytes = bytes;
   }
 
   public String getContentType() {
   return contentType;
   }
 
   public InputStream getInputStream() throws IOException {
   return new ByteArrayInputStream(bytes);
   }
 
   }
 
 But when user clicks a link is sees a open close cancel dialog
 box...he just sees actionname.do as file name.  I know I am not
 returning the file name (I can) but where will I catch it?? like in
 struts 2...shouldnt tehre be more in the action of this? like
 specifying what is returned? and if i return the name.should I
 just make public String getFileName() method in ByteArrayStreamInfo
 class?
 
 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: Struts 1 return stream (documents)

2008-03-17 Thread bhaarat Sharma
yes, that worked!

Thanks! I remember you helped me with similar problem in S2 as well

On Mon, Mar 17, 2008 at 10:07 PM, Dave Newton [EMAIL PROTECTED] wrote:
 Does this help?

  http://wiki.apache.org/struts/StrutsFileDownload

  Dave



  --- bhaarat Sharma [EMAIL PROTECTED] wrote:

   Hello,
  
   I started struts by learning struts2.  However, now i am working with
   struts 1: (
  
   I am faced with a problem where user downloads a file.
  
   I have this in the struts.xml
  
 action path=/viewModificationDocument
  
  
  
 type=org.something1.something2.actions.download.ModificationDocumentDownloadAction
 scope=request input=viewAwardModification
 /action
  
   And then in the action I have this which is returning a bytestream
  
 protected class ByteArrayStreamInfo implements StreamInfo {
  
 protected String contentType;
  
 protected byte[] bytes;
  
 public ByteArrayStreamInfo(String contentType, byte[] bytes) 
 {
 this.contentType = contentType;
 this.bytes = bytes;
 }
  
 public String getContentType() {
 return contentType;
 }
  
 public InputStream getInputStream() throws IOException {
 return new ByteArrayInputStream(bytes);
 }
  
 }
  
   But when user clicks a link is sees a open close cancel dialog
   box...he just sees actionname.do as file name.  I know I am not
   returning the file name (I can) but where will I catch it?? like in
   struts 2...shouldnt tehre be more in the action of this? like
   specifying what is returned? and if i return the name.should I
   just make public String getFileName() method in ByteArrayStreamInfo
   class?
  
   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]



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



Re: Struts 1 return stream (documents)

2008-03-17 Thread Dave Newton
--- bhaarat Sharma [EMAIL PROTECTED] wrote:
 Thanks! I remember you helped me with similar problem in S2 as well

I'm very good at using the work of others to make me look good ;)

Dave


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



Re: Struts 1 return stream (documents)

2008-03-17 Thread bhaarat Sharma
Quick question

in all other examples on that page they show how the fileName is
retrieved. But for Byte Array Example they do not mention anything
regarding the fileName.

How are we suppose to supply the fileName?


On Mon, Mar 17, 2008 at 10:41 PM, Dave Newton [EMAIL PROTECTED] wrote:
 --- bhaarat Sharma [EMAIL PROTECTED] wrote:

  Thanks! I remember you helped me with similar problem in S2 as well

  I'm very good at using the work of others to make me look good ;)

  Dave




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



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



struts 1.2 html:select and submit button

2008-03-17 Thread Sonu S
 HI,

I am using struts 1.2 in my web application. I have to display one
html:select html:options list

list will be build dynamically. User can select any option. base on the
user's selection page will be refreshed (need to hit the database and
display information in other fields on same page.) I need to know two
things:

1) there is one submit button on that page and one action is associated with
that submit button. i can call the associated action class once the user
finish the form and click the submit button. When user select from list i
need to call another action class.

I want to know how to call another action class, (when user select something
from list), as list control is inside the same html:form tag.

2) When user selects some value from list i need to refresh the page and
populate the other fields.

I would like to know, Lets say there are ten values and user has selected
third option, how to keep selected that third option as page is already
refreshed?

I am beginner in struts.. any sample code would be a great help for me

Thank you for time and help.

sonu


Re: Issue In Autocompleter

2008-03-17 Thread Ozzy

Dude I dont think autocomplete would be complete till you actually try to
complete it.

Now we are thinking!



Ankur Agar wrote:
 
 
 Hi All,
   I am tryin to make an autocomplete work with its theme=ajax
 I am using struts 2.0.x
 The data coming from the action is in JSON format
 
 {Arizona:AZ,Arkansas:AR,Armed:AE,California:CA,Florida:FL}
 the jsp code is
 %@ taglib prefix=s uri=/struts-tags %
 html
   head
 s:head theme=ajax debug=true/
   /head
  s:property value=jsonList/
   body
  s:url id=ajaxCallUrl value=autocompleter1.action
  /s:url
 h1Struts 2 Autocompleter Example!/h1
 s:label name=stateName value=Select State Name: /
 br
  s:autocompleter name=state theme=ajax  href=%{ajaxCallUrl}
 loadOnTextChange=true loadMinimumCount=1/
 br
   /body
 /html
 
 But still the autocomplete is not working gives a syntax error on page
 when
 run in debug mode. In one of the links I found that struts-dojo-tags has
 to
 be used as a plugin in struts 2.0.x  But also in one of the links it was
 specified that its embedded in struts-core.jar.
 Please help me out.
 Regards,
 Ankur
 
 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain 
 confidential or privileged information. If you are 
 not the intended recipient, any dissemination, use, 
 review, distribution, printing or copying of the 
 information contained in this e-mail message 
 and/or attachments to it are strictly prohibited. If 
 you have received this communication in error, 
 please notify us by reply e-mail or telephone and 
 immediately and permanently delete the message 
 and any attachments. Thank you
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Issue-In-Autocompleter-tp16048547p16114440.html
Sent from the Struts - User mailing list archive at Nabble.com.


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