RE: Interceptor best practices ...

2008-01-04 Thread Al Sutton
imho, you shouldn't be validating the users username and password in an
interceptor. You should validate them in an action, then set a token in the
session indicating the user had been validated, then check for your chosen
token in the interceptor.

That way you don't need to keep hitting your username and password store
every time a request comes in. 

-Original Message-
From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] 
Sent: 04 January 2008 04:48
To: Struts Users Mailing List
Subject: Interceptor best practices ...

Am trying to understand the best practice if any for a
ValidateLoginInterceptor of sorts. In the code below, if the login is valid
then we make a call to:

return actionInvocation.invoke();

In case the login information was incorrect, what should one do?

return ActionSupport.ERROR // In this case would the result
name=error/myerrorpage.ftl/result associated with my action be
executed?


public class ValidateLoginInterceptor implements Interceptor {
private static final long serialVersionUID = 1L;

private static String EMAIL_FIELD = email;
private static String PASSWORD_FIELD = password;

public void destroy()
{
}

public void init()
{
}

public String intercept(ActionInvocation actionInvocation) throws
Exception
{
String email =
actionInvocation.getStack().findString(EMAIL_FIELD);
String password = actionInvocation.getStack().findString
(PASSWORD_FIELD);

if (isValidLogin(email, password))
{
// login credentials were valid
return actionInvocation.invoke();
}
else
{
// login credentials are not valid
//
actionInvocation.setResultCode(ActionSupport.ERROR);
Should I be doing this?
return ActionSupport.ERROR;
}
}

}


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



[S2] how to get the value of form select

2008-01-04 Thread carmi_cd

i have a form select..my problem is how to i get the selected values of the
form select..
what is its data type..is it ArrayList?

here is my code..

s:select name=selectedModules
value=%{edituser.modules.{moduleId}}
  list=modules
listKey=moduleId listValue=moduleName 
  multiple=true size=7 
/


thanks in advance for your help
-- 
View this message in context: 
http://www.nabble.com/-S2--how-to-get-the-value-of-form-select-tp14613273p14613273.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]



how to get the value of form select

2008-01-04 Thread carmi_cd

i have a form select..my problem is how to i get the selected values of the
form select..
what is its data type..is it ArrayList?

here is my code..

s:select name=selectedModules
value=%{edituser.modules.{moduleId}}
  list=modules
listKey=moduleId listValue=moduleName 
  multiple=true size=7 
/


thanks in advance for your help
-- 
View this message in context: 
http://www.nabble.com/how-to-get-the-value-of-form-select-tp14613272p14613272.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: IllegalStateException from org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher

2008-01-04 Thread Nils-Helge Garli Hegvik
There's a couple of issues with this. First, a portlet only produces
page fragments, you can't use html, head or body tags. So you'll
have to find another way to refresh the page. Second, the url-tag
needs a specified action to produce a correct URL in a portlet
environment (there's a JIRA ticket for using the executing action if
no action is specified, but this hasn't been implemented yet). Try
using s:url action=longProcess3/ instead.

Nils-H

On Jan 2, 2008 10:05 PM, Wanjun Wang [EMAIL PROTECTED] wrote:


 Nils-H,

  I noticed some error in my struts-view.xml.  It now looks like:
  struts
  package name=view extends=struts-portlet-default
  namespace=/view
  action name=index
  result name=success/WEB-INF/view/index.jsp/result
  /action

  action name=longProcess3
 class=org.apache.struts2.showcase.wait.LongProcessAction
  interceptor-ref name=defaultStack/
  interceptor-ref name=execAndWait
  param name=delay3000/param
  param name=delaySleepInterval1000/param
  /interceptor-ref
  result name=wait/WEB-INF/view/wait.jsp/result
  result name=success/WEB-INF/view/complete.jsp/result
  /action

  /package
  /struts

  wait.jsp has
  %@ taglib prefix=s uri=/struts-tags %
  html
  head
  meta http-equiv=refresh content=5;url=s:url includeParams=all//
  /head

  body
  p style=border: 1px solid silver; padding: 5px; background: #ffd;
 text-align: center;
  We are processing your request. Please wait.
  /p

  p/
  You can click this link to a href=s:url
 includeParams=all/refresh/a.

  /body
  /html

  It's fine if it goes straight to success page. The problem is with wait
 page. The new exception is:
  [1/2/08 16:00:10:140 EST] 004c PortletRender E
 com.ibm.wps.engine.tags.PortletRenderTag doStartTag EJPEJ0066E: The portlet
 could not be rendered.
  javax.portlet.PortletException: Error executing action renderDirect

  at
 org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.serviceAction(Jsr168Dispatcher.java:426)
  at
 org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.render(Jsr168Dispatcher.java:299)
  ..
  Caused by: javax.portlet.PortletException: java.lang.NullPointerException
  at
 com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:136)
  at
 com.ibm.ws.portletcontainer.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:256)
  at
 org.apache.struts2.portlet.result.PortletResult$IncludeTemplate.include(PortletResult.java:208)
  at
 org.apache.struts2.portlet.result.PortletResult.executeRenderResult(PortletResult.java:177)
  at
 org.apache.struts2.portlet.result.PortletResult.doExecute(PortletResult.java:77)

  at
 org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
  ..
  Caused by: java.lang.NullPointerException
  at
 org.apache.struts2.portlet.util.PortletUrlHelper.buildResourceUrl(PortletUrlHelper.java:200)
  at org.apache.struts2.components.URL.end(URL.java:260)
  at
 org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
  ..

  Could this be caused by the portlet container?

  Thanks.

  Wanjun Wang

  Nils-Helge Garli Hegvik [EMAIL PROTECTED]







 Nils-Helge Garli Hegvik [EMAIL PROTECTED]

 01/02/2008 02:34 PM
 Please respond to
  Struts Users Mailing List user@struts.apache.org


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


 cc



 Subject
  Re: IllegalStateException from
 org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher



 I have never tested the execute and wait stuff, so I don't really know
  how it works. But from reading the code for the interceptor, and
  reading the stack trace, I would guess that this happens because the
  default wait result is invoked and is not a result type that is
  supported in a portlet. You could try configuring a result for wait
  for the action explicitly. If you still have problems, please provide
  the relevant configuration snippets.

  Nils-H

  On Jan 2, 2008 7:01 PM, Wanjun Wang [EMAIL PROTECTED] wrote:
   Hi,
  
   Has anyone used interceptor-ref in a portlet?  I'm trying to port the
   execute-and-wait showcase to a portlet.  The initial page displays fine,
   but upon submit, the following exception occurs:
  
   [1/2/08 11:49:34:468 EST] 002b EventQueueMan E
   com.ibm.wps.pe.pc.waspc.event.EventQueueManager processEventLoop
   EJPPG1122E: An error occurred during portlet event processing.
javax.portlet.PortletException: Error
   executing action longProcess3
 at
  
 org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.serviceAction(Jsr168Dispatcher.java:426)
 at
  
 org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.processAction(Jsr168Dispatcher.java:274)
   ..
   Caused by: java.lang.IllegalStateException: Not allowed in event phase
 at
  
 org.apache.struts2.portlet.servlet.PortletServletResponse.isCommitted(PortletServletResponse.java:177)
 at
  
 

Re: Interceptor best practices ...

2008-01-04 Thread Ted Husted
The best use of interceptors is for behavior that will be shared by
several Actions. If there are several different places where a client
might be authenticated, then, in that case, a login interceptor (and a
custom interceptor stack) can be a good idea.

When coding an Interceptor, you can just return the result code, same
as an action. Any string value can be returned, so long as the code
matches one of the local or global Results.

In this case, good choices might be input or login. In the case of
input, there should be a local Result by that name that returned the
client to the initial form. Just be sure to set the appropriate Action
or field errors first, so that the messages can be displayed by the
form.

To acquire the Action instance in an Interceptor, we can use this idiom:

 MyAction action = (MyAction)invocation.getAction();

Then we can access the Action properties and helper methods.

  action.addActionError(actionErrorMessage);
  action.AddFieldError(fieldName, errorMessage);

Another approach, as Al mentioned, would be to create an base Action
with an authenticate method. In either case, the code is essentially
the same, it's just a matter of where it is called.

I believe the most common approach would be to use an Action method to
login, store a session-scope profile object, and then secure (other)
Actions with an authentication interceptor. The authentication
interceptor would check the profile object in session scope, and
decide whether to let the request through.

For more finely grained security, many people like SecurityFilter (on
SourceForge) or Acegi (now Spring Security). There's a FAQ on Acegi in
the documentation, but I don't know if it's up to date.

 * 
http://struts.apache.org/2.x/docs/can-we-use-acegi-security-with-the-framework.html

HTH, Ted.
http://www.StrutsMentor.com/

On Jan 3, 2008 11:47 PM, Mufaddal Khumri [EMAIL PROTECTED] wrote:
 Am trying to understand the best practice if any for a
 ValidateLoginInterceptor of sorts. In the code below, if the login is
 valid then we make a call to:

 return actionInvocation.invoke();

 In case the login information was incorrect, what should one do?

 return ActionSupport.ERROR // In this case would the result
 name=error/myerrorpage.ftl/result associated with my action be
 executed?


 public class ValidateLoginInterceptor implements Interceptor
 {
 private static final long serialVersionUID = 1L;

 private static String EMAIL_FIELD = email;
 private static String PASSWORD_FIELD = password;

 public void destroy()
 {
 }

 public void init()
 {
 }

 public String intercept(ActionInvocation actionInvocation) throws
 Exception
 {
 String email = 
 actionInvocation.getStack().findString(EMAIL_FIELD);
 String password = actionInvocation.getStack().findString
 (PASSWORD_FIELD);

 if (isValidLogin(email, password))
 {
 // login credentials were valid
 return actionInvocation.invoke();
 }
 else
 {
 // login credentials are not valid
 // 
 actionInvocation.setResultCode(ActionSupport.ERROR);
 Should I be doing this?
 return ActionSupport.ERROR;
 }
 }

 }

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



Re: Refresh parent browser when form in pop-up browser is submitted

2008-01-04 Thread zainu


Hi,
  You can use theh following JS function.Hope it will solve your
problem...Just call this script from the popup's submit button..
function refreshBack()
{

linkss=parentAction.do;
window.opener.location=linkss;
window.close();
}


quinquin2209 wrote:
 
 Hi All,
 
 In my application, user can open a member profile in the main page. The
 member profile is opened in a pop-up window and user can edit the profile.
 When user submits the form in pop-up browser, I want to close the pop-up
 browser, refresh the parent browser to reflect change and also display the
 actionError or actionMessage while processing the profile editing. 
 
 Any suggestion in how I can achieve it?
 
 Thanks in advance
 
 Queenie
 

-- 
View this message in context: 
http://www.nabble.com/Refresh-parent-browser-when-form-in-pop-up-browser-is-submitted-tp14370069p14613550.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: Enum, TypeConversion and error handling

2008-01-04 Thread Adam Hardy

Dave Newton on 04/01/08 00:09, wrote:

--- Adam Hardy [EMAIL PROTECTED] wrote:

Fresh from plugging in my first TypeConverter, I find that on the whole the
TypeConversion mechanism in S2 is very good. After setting up a custom type
converter, I thought I could chip in with a couple of comments:

(1) where to register type converter


Which part was confusing? It says to put it in
ClassName-conversion.properties or the XWork conversion file.


Obviously I did manage to work it out, but when I started, I thought:

- which ClassName? (the Action, or the class to be converted, or the javabean 
parent it was nested in, etc - when you don't know, the variety is infinite!)

- which package does it go in?
- when you don't fully qualify the class, (e.g. 'point'), what does the name 
refer to? Is it the property on the action?



(2) S2 swallows exceptions in XworkConverter.  I couldn't figure out
whether the type converter registration had even worked.


Well, putting logging in your convertor should have at least shown if your
conversion methods were being called, no?


Sure, but I was trying to follow the docs by throwing TypeConversionExceptions, 
so it seemed that I'd messed it up somehow because I never saw any. Then I 
realised they would never have seen the light of day anyway, so it was at least 
misleading to suggest throwing them.



When I was dinking around w/ convertors I occasionally would wrap my code
with Exception catches, but I agree that there are exceptions that are
difficult to get at under normal circumstances. This is on my list, but I'm
completely swamped right now.


I can appreciate that! Anyone who finds any time for open source in a commercial 
environment has my admiration - long may it last.


Ideally those catch blocks in XWorkConverter should be catching only 
TypeConversionExceptions, and any other exception type should be uncaught, 
breaking the process.




(2b) it was difficult to tell exactly what I should do in my TypeConverter
to show the message that I really wanted when conversion failed.


I'm not sure what you mean by that.


I haven't quite figured out the way that conversion error messages are chosen, 
but it would be cool to tie them in with the exception, for instance:


throw new TypeConversionException(someaction.thistype.nonNumeric);

or

throw new TypeConversionException(someaction.thistype.nullNotAllowed);

As I say though I haven't got so far as to find out how flexible the XWork 
converter is.


Regards
Adam

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



Re: struts2: interceptor - validation doesn't work :-(

2008-01-04 Thread Dave Newton
Please post the entire relevant code and configuration. I do this all the
time (annotating the getter, though, as Wes said) and don't have any
problems. You're extending ActionSupport?

d.

--- xianwinwin [EMAIL PROTECTED] wrote:

 
 thanks wes, I tried this manipulation - didnt work
 :-(
 
 
 
 Wes Wannemacher wrote:
  
  Try annotating the getter rather than the setter.
  
  -Wes
  
  On 1/3/08, xianwinwin [EMAIL PROTECTED] wrote:
 
  yes i did :super:
 
 
 
  newton.dave wrote:
  
   Did you annotate the class with the @Validation() annotation?
  
   d.
  
   --- xianwinwin [EMAIL PROTECTED] wrote:
  
  
   I've been struggling with this issue for a while and any pointer
 would
  be
   appreciated.
  
   I have a simple file with one field -name; I would like to validate
  that
   the
   user put information in it.
  
   I'm using the annotation in order to achieve this but for some reason
  the
   validation doesn't work (there's no return message that the user did
  not
   provide the info).
  
   my file looks like this:
  
  
@RequiredStringValidator(message=name is missing)
public void setName(String name)
{
this.name=name;
}
  
  
   in the jsp page:
   ...
s:textfield name=name label=your name: /
  
  
  
   in the xml:
   action name=UserTest_*  method={1}
   class=com.simple.validation.Test
   result name=error/pages/error.jsp/result
   result name=success/pages/welcome.jsp/result
  
   interceptor-ref name=guest/
   /action
  
  
   the guest interceptor is:
   interceptor-stack name=guest 
   interceptor-ref name=defaultStack/
   /interceptor-stack
  
   any idea?
  
   --
   View this message in context:
  
  
 

http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.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]
  
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
  --
  View this message in context:
 

http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14609244.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]
 
 
  
  
  -- 
  Wesley Wannemacher
  President, Head Engineer/Consultant
  WanTii, Inc.
  http://www.wantii.com
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 -- 
 View this message in context:

http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14610928.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]
 
 


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



Re: Update from 2.0.9 to 2.0.11

2008-01-04 Thread Dave Newton
--- Micha³ Letyñski [EMAIL PROTECTED] wrote:
 So it was a bug that we could use EL expressions in struts tag ?

Did you read the JIRA ticket?

The bug was: Arbitrary user-submitted OGNL possible when using JSP EL or
FreeMarker.

d.


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



Load a particular resource bundle

2008-01-04 Thread Raghuveer
How to set locale for my struts application.

My application will have 2 languages.

There will be 2 buttons in jsp page.

One button is polish and other is English.

 

on clicking of Polish button all the labels and button names and messages
are to be changed into polis language.

 

Any suggestions of implementing this



Re: [S2] how to get the value of form select

2008-01-04 Thread Arpan Debroy
It should be a list.
I guess your selectedModules in the name attribute is also a list and the
values of selected items will be
populated into it. If you wouldn't write multiple=true, the return data type
would be String.

On Jan 4, 2008 3:14 PM, carmi_cd [EMAIL PROTECTED] wrote:


 i have a form select..my problem is how to i get the selected values of
 the
 form select..
 what is its data type..is it ArrayList?

 here is my code..

s:select name=selectedModules
 value=%{edituser.modules.{moduleId}}
  list=modules
 listKey=moduleId listValue=moduleName
  multiple=true size=7
 /


 thanks in advance for your help
 --
 View this message in context:
 http://www.nabble.com/-S2--how-to-get-the-value-of-form-select-tp14613273p14613273.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]




-- 
Thanks  Regards
 Arpan Debroy

AOL Online India Private Ltd
RMZ EcoSpace Campus 1A
Outer Ring Road, Bellandur,
Bangalore - 560037
India
Mobile No :+9886006306
on-board :+91 (80) 4035 4528
E-mail : [EMAIL PROTECTED]


RE: setting locale manually

2008-01-04 Thread Raghuveer
So you mean if I  addrequest_locale=en_US in all forward this will work
OR if I add in first forward it is sufficient?

 

  _  

From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 04, 2008 8:10 PM
To: [EMAIL PROTECTED]
Subject: RE: setting locale manually

 

Czes Raghu

http://struts.apache.org/2.0.11/docs/i18n-interceptor.html
you can pass the locale on the request
and path accordingly
 
dziekuje!

Martin 
__
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and Sender
does not endorse distribution to any party other than intended recipient.
Sender does not necessarily endorse content 

 From: [EMAIL PROTECTED]
 To: user@struts.apache.org
 Subject: setting locale manually
 Date: Fri, 4 Jan 2008 18:30:39 +0530
 
 How to set locale for my struts application.
 
 My application will have 2 languages.
 
 There will be 2 buttons in jsp page.
 
 One button is polish and other is English.
 
 
 
 on clicking of Polish button all the labels and button names and messages
 are to be changed into polis language.
 
 
 
 Any suggestions of implementing this
 



  _  

Watch Cause Effect, a show about real people making a real difference.
Learn http://im.live.com/Messenger/IM/MTV/?source=text_watchcause  more



Re: [S2]Issue with wrong dates for datetimepicker and the New Year

2008-01-04 Thread Skip Hollowell

https://issues.apache.org/struts/browse/WW-2377
So, if I read this correctly, it is in the system, and schedule for 
release in the 2.1?  If there is a way to grab a patch for this, I am 
unsure how to do that.  Ideas?

Skip Hollowell wrote:

I have a datetimepicker on my page, from the struts tag lilbrary:

%@ taglib prefix=s uri=/struts-tags%
...
s:datetimepicker key=transaction.datepaid /

So today is Jan 3.  If I choose December 31, Monday of this week, the
value I get back in my field is 3/2/2008, and for the 30th, Sunday, I
receive 3/1/2008
Conversely, if I change the Calendar to December, 2007, and choose Jan
1, I receive 11/1/2007 and if I choose Jan 3, I receive 11/3/2007  As
long as we aren't crossing over a Year boundary, the picker works just 
fine.


Is this a known bug (and if so, where should I have looked to find that
out)? Or is this something most folks haven't run into before, or better
yet, am I doing something wrong?

Skip Hollowell


-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
http://www.nabble.com/user/SendEmail.jtp?type=postpost=14597406i=0
For additional commands, e-mail: [EMAIL PROTECTED] 
http://www.nabble.com/user/SendEmail.jtp?type=postpost=14597406i=1






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



Re: Interceptor best practices ...

2008-01-04 Thread Dave Newton
--- Mufaddal Khumri [EMAIL PROTECTED] wrote:
 In Struts1 I did have a Base Action that I extended from along with a  
 session scoped variable that kept track of whether the user is logged  
 in or not. This functionality is needed by multiple actions who ended  
 up extending the base class. Since Struts 2 has interceptors, I felt  
 that it would be a better design to create an interceptor that does  
 this and that way the Action does not have to extend a base class.  

The point is, more or less, what Ted and Al said: having the interceptor
check that the user *was* logged in correctly is fine, and is a valid
use--checking for a logged-in user is a cross-cutting concern. Logging in
itself *isn't*, so belongs in an action.

d.


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



Re: [S2]Issue with wrong dates for datetimepicker and the New Year

2008-01-04 Thread Skip Hollowell
I have checked the Issues db for datetimepicker, and don't see this 
specific issue, or one even close to it.  Is this something that I 
should report as a bug?  Is anyone else able to verify that it is indeed 
an issue?


Skip Hollowell wrote:

I have a datetimepicker on my page, from the struts tag lilbrary:

%@ taglib prefix=s uri=/struts-tags%
...
s:datetimepicker key=transaction.datepaid /

So today is Jan 3.  If I choose December 31, Monday of this week, the
value I get back in my field is 3/2/2008, and for the 30th, Sunday, I
receive 3/1/2008
Conversely, if I change the Calendar to December, 2007, and choose Jan
1, I receive 11/1/2007 and if I choose Jan 3, I receive 11/3/2007  As
long as we aren't crossing over a Year boundary, the picker works just 
fine.


Is this a known bug (and if so, where should I have looked to find that
out)? Or is this something most folks haven't run into before, or better
yet, am I doing something wrong?

Skip Hollowell


-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
http://www.nabble.com/user/SendEmail.jtp?type=postpost=14597406i=0
For additional commands, e-mail: [EMAIL PROTECTED] 
http://www.nabble.com/user/SendEmail.jtp?type=postpost=14597406i=1






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



setting locale manually

2008-01-04 Thread Raghuveer
How to set locale for my struts application.

My application will have 2 languages.

There will be 2 buttons in jsp page.

One button is polish and other is English.

 

on clicking of Polish button all the labels and button names and messages
are to be changed into polis language.

 

Any suggestions of implementing this



Re: Interceptor best practices ...

2008-01-04 Thread Mufaddal Khumri
In Struts1 I did have a Base Action that I extended from along with a  
session scoped variable that kept track of whether the user is logged  
in or not. This functionality is needed by multiple actions who ended  
up extending the base class. Since Struts 2 has interceptors, I felt  
that it would be a better design to create an interceptor that does  
this and that way the Action does not have to extend a base class.  
This way this interceptor can be stacked with other custom  
interceptors as required as well. Thanks for pointing out the  
addActionErrors and addFieldErrors methods.


Thanks.

On Jan 4, 2008, at 3:55 AM, Ted Husted wrote:


The best use of interceptors is for behavior that will be shared by
several Actions. If there are several different places where a client
might be authenticated, then, in that case, a login interceptor (and a
custom interceptor stack) can be a good idea.

When coding an Interceptor, you can just return the result code, same
as an action. Any string value can be returned, so long as the code
matches one of the local or global Results.

In this case, good choices might be input or login. In the case of
input, there should be a local Result by that name that returned the
client to the initial form. Just be sure to set the appropriate Action
or field errors first, so that the messages can be displayed by the
form.

To acquire the Action instance in an Interceptor, we can use this  
idiom:


 MyAction action = (MyAction)invocation.getAction();

Then we can access the Action properties and helper methods.

  action.addActionError(actionErrorMessage);
  action.AddFieldError(fieldName, errorMessage);

Another approach, as Al mentioned, would be to create an base Action
with an authenticate method. In either case, the code is essentially
the same, it's just a matter of where it is called.

I believe the most common approach would be to use an Action method to
login, store a session-scope profile object, and then secure (other)
Actions with an authentication interceptor. The authentication
interceptor would check the profile object in session scope, and
decide whether to let the request through.

For more finely grained security, many people like SecurityFilter (on
SourceForge) or Acegi (now Spring Security). There's a FAQ on Acegi in
the documentation, but I don't know if it's up to date.

 * http://struts.apache.org/2.x/docs/can-we-use-acegi-security-with- 
the-framework.html


HTH, Ted.
http://www.StrutsMentor.com/

On Jan 3, 2008 11:47 PM, Mufaddal Khumri  
[EMAIL PROTECTED] wrote:

Am trying to understand the best practice if any for a
ValidateLoginInterceptor of sorts. In the code below, if the login is
valid then we make a call to:

return actionInvocation.invoke();

In case the login information was incorrect, what should one do?

return ActionSupport.ERROR // In this case would the result
name=error/myerrorpage.ftl/result associated with my action be
executed?


public class ValidateLoginInterceptor implements Interceptor
{
private static final long serialVersionUID = 1L;

private static String EMAIL_FIELD = email;
private static String PASSWORD_FIELD = password;

public void destroy()
{
}

public void init()
{
}

public String intercept(ActionInvocation actionInvocation)  
throws

Exception
{
String email = actionInvocation.getStack 
().findString(EMAIL_FIELD);
String password = actionInvocation.getStack 
().findString

(PASSWORD_FIELD);

if (isValidLogin(email, password))
{
// login credentials were valid
return actionInvocation.invoke();
}
else
{
// login credentials are not valid
// actionInvocation.setResultCode 
(ActionSupport.ERROR);

Should I be doing this?
return ActionSupport.ERROR;
}
}

}


-
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: S2: chart result type not recognized

2008-01-04 Thread Ian Roughley

How are you referencing the action?  I always use an img tag like this:

img src=serverIronLoadChart.action /

/Ian

--
Ian Roughley

From Down  Around, Inc.

Consulting * Training / Mentoring * Agile Process * Open Source
web: http://www.fdar.com - email: [EMAIL PROTECTED]



John Cartwright wrote:

Hello All,

I'm having a little trouble getting a chart result type configured 
using the package declaration below.  Whenever I hit the associated 
URL, my browser prompts me to save a bin file  rather than 
displaying the chart.  The bin file is a valid png, but somehow Struts 
is not recognizing the returned type.  Can anyone suggest what I'm 
doing wrong?


Thanks!

-- john


package name=chart extends=jfreechart-default namespace=/chart
 action name=serverIronLoadChart
class=gov.noaa.eds.arcims.tng.action.ServerIronLoadChartAction
result type=chart
   param name=width400/param
   param name=height300/param
/result
 /action
  /package

-
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: struts2: interceptor - validation doesn't work :-(

2008-01-04 Thread Ian Roughley

I didn't see an INPUT result configured, which will be needed.

/Ian

--
Ian Roughley

From Down  Around, Inc.

Consulting * Training / Mentoring * Agile Process * Open Source
web: http://www.fdar.com - email: [EMAIL PROTECTED]



Dave Newton wrote:

Please post the entire relevant code and configuration. I do this all the
time (annotating the getter, though, as Wes said) and don't have any
problems. You're extending ActionSupport?

d.

--- xianwinwin [EMAIL PROTECTED] wrote:

  

thanks wes, I tried this manipulation - didnt work
:-(



Wes Wannemacher wrote:


Try annotating the getter rather than the setter.

-Wes

On 1/3/08, xianwinwin [EMAIL PROTECTED] wrote:
  

yes i did :super:



newton.dave wrote:


Did you annotate the class with the @Validation() annotation?

d.

--- xianwinwin [EMAIL PROTECTED] wrote:

  

I've been struggling with this issue for a while and any pointer


would


be


appreciated.

I have a simple file with one field -name; I would like to validate


that


the
user put information in it.

I'm using the annotation in order to achieve this but for some reason


the


validation doesn't work (there's no return message that the user did


not


provide the info).

my file looks like this:


 @RequiredStringValidator(message=name is missing)
 public void setName(String name)
 {
 this.name=name;
 }


in the jsp page:
...
 s:textfield name=name label=your name: /



in the xml:
action name=UserTest_*  method={1}
class=com.simple.validation.Test
result name=error/pages/error.jsp/result
result name=success/pages/welcome.jsp/result

interceptor-ref name=guest/
/action


the guest interceptor is:
interceptor-stack name=guest 
interceptor-ref name=defaultStack/
/interceptor-stack

any idea?

--
View this message in context:



http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.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]




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



  

--
View this message in context:



http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14609244.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]




--
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

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



  

--
View this message in context:



http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14610928.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]






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

  


[S2] datetimepicker - type = time - time selection

2008-01-04 Thread Srikanth Muthyala

Hello, 

I am able  to use datetimepicker for time field. But the selection is the 
problem. If I want to select 10:45 PM - I have to click the picker icon three 
times to select 10 then 45 then PM. Does anybody know how to make this user 
friendly - I mean the selection popup screen does not disappear after first 
selection and force to select hours and minutes. 

The code, if needed. 


 s:datetimepicker type = time name = time label = Time toggleType = 
fade toggleDuration = 300  / s:datetimepicker  s:datetimepicker type = 
time name = time label = Time toggleType = fade toggleDuration = 300 
 / s:datetimepicker  Any help will be appreciated. I guess this could be a 
common problem. Any work arounds??? 

Regards, 

Srikanth  


Re: struts2: interceptor - validation doesn't work :-(

2008-01-04 Thread Arpan Debroy
I guess your problem is in the xml file.
You are using error result type. But by default if validation error
occurs, input string is being returned.
So please use input instead of error and check again.

Thanks

On Jan 4, 2008 5:07 AM, xianwinwin [EMAIL PROTECTED] wrote:


 I've been struggling with this issue for a while and any pointer would be
 appreciated.

 I have a simple file with one field -name; I would like to validate that
 the
 user put information in it.

 I'm using the annotation in order to achieve this but for some reason the
 validation doesn't work (there's no return message that the user did not
 provide the info).

 my file looks like this:


@RequiredStringValidator(message=name is missing)
public void setName(String name)
{
this.name=name;
}


 in the jsp page:
 ...
  s:textfield name=name label=your name: /



 in the xml:
action name=UserTest_*  method={1}
 class=com.simple.validation.Test
result name=error/pages/error.jsp/result
result name=success/pages/welcome.jsp/result

interceptor-ref name=guest/
/action


 the guest interceptor is:
interceptor-stack name=guest 
interceptor-ref name=defaultStack/
/interceptor-stack

 any idea?

 --
 View this message in context:
 http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14607863.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]




-- 
Thanks  Regards
 Arpan Debroy

AOL Online India Private Ltd
RMZ EcoSpace Campus 1A
Outer Ring Road, Bellandur,
Bangalore - 560037
India
Mobile No :+9886006306
on-board :+91 (80) 4035 4528
E-mail : [EMAIL PROTECTED]


Struts 2 and Dojo toolkit

2008-01-04 Thread Filipe David Manana
Hi,

I am trying to use dojo.require method in one of my JSPs.

The code is the following:

head
decorator:head /

  script type=text/javascript
dojo.require(dojo.query);
dojo.query(window).onload( function() { alert(test); } );
  /script

/head

In Firefox's error console I have: Error: Could not load 'dojo.query'; last
tried '__package__.js'
Source File: http://localhost:8080/cdbweb2/struts/dojo/dojo.js;

If I comment the the dojo.require statement, I get the error: Error:
dojo.query is not a function
Source File: http://localhost:8080/cdbweb2/lsf/accounts/list.action;. So I
have to use the dojo.require statement, I suppose.

Struts 2 is already bundled with Dojo, all the dojo .js files are in the
struts-core.jar archive. How should I proceed to use the dojo.requiremethod?

cheers

-- 
Filipe David Manana,
[EMAIL PROTECTED]

Obvious facts are like secrets to those not trained to see them.


Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Pascal SEREMES-DAMAL
In fact in the tutorial
(http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
) they say that there no need to specify the JPA configuration in this
file because the datasource will be on spring configuration file.

2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
 Spring couldn't find META-INF/persistence.xml

 musachy

 On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
  Hello everyone!!!
 
  I hope you had fun during the end of year 2007 and I wish you a happy new 
  year.
 
  I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
  struts page and when I deployed it on my server I had the following
  exceptions.
 
  GRAVE: Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name
  'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
  defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
  Initialization of bean failed; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name
  'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
  Cannot create inner bean '(inner bean)' of type
  [org.springframework.transaction.interceptor.TransactionInterceptor]
  while setting bean property 'transactionInterceptor'; nested exception
  is org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name '(inner bean)': Cannot resolve reference to
  bean 'transactionManager' while setting bean property
  'transactionManager'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'transactionManager' defined in ServletContext
  resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
  to bean 'entityManagerFactory' while setting bean property
  'entityManagerFactory'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'entityManagerFactory' defined in
  ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
  of init method failed; nested exception is
  java.lang.IllegalStateException: No persistence units parsed from
  {classpath*:META-INF/persistence.xml}
  Caused by: org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name
  'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
  Cannot create inner bean '(inner bean)' of type
  [org.springframework.transaction.interceptor.TransactionInterceptor]
  while setting bean property 'transactionInterceptor'; nested exception
  is org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name '(inner bean)': Cannot resolve reference to
  bean 'transactionManager' while setting bean property
  'transactionManager'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'transactionManager' defined in ServletContext
  resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
  to bean 'entityManagerFactory' while setting bean property
  'entityManagerFactory'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'entityManagerFactory' defined in
  ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
  of init method failed; nested exception is
  java.lang.IllegalStateException: No persistence units parsed from
  {classpath*:META-INF/persistence.xml}
  Caused by: org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name '(inner bean)': Cannot resolve reference
  to bean 'transactionManager' while setting bean property
  'transactionManager'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'transactionManager' defined in ServletContext
  resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
  to bean 'entityManagerFactory' while setting bean property
  'entityManagerFactory'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'entityManagerFactory' defined in
  ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
  of init method failed; nested exception is
  java.lang.IllegalStateException: No persistence units parsed from
  {classpath*:META-INF/persistence.xml}
  Caused by: org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'transactionManager' defined in
  ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot
  resolve reference to bean 'entityManagerFactory' while setting bean
  property 'entityManagerFactory'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'entityManagerFactory' defined in
  ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 

Re: struts2: interceptor - validation doesn't work :-(

2008-01-04 Thread xianwinwin

AND THE WINNER IS:  xniit2003

YES!! thank you so much! good call and a brilliant observation 

thank you all!

you wrote:
I guess your problem is in the xml file.
You are using error result type. But by default if validation error
occurs, input string is being returned.
So please use input instead of error and check again. 
:jumping:
-- 
View this message in context: 
http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%28-tp14607863p14618918.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]



Accessing form parameters in an interceptor ....

2008-01-04 Thread Mufaddal Khumri
Basically I am trying to access some parameters in an interceptor  
since the interceptor needs to do something based on the values of  
these parameters. Any action that this interceptor is applied to does  
not need these parameters.


In order to do this:

If I have an ftl file with a form like such:

@s.form namespace=/ob action=test method=post

@s.textfield name=param1 label=Param1 /
@s.textfield name=param2 label=Param2 /
@s.submit value=Send/

/@s.form

The html produced by the above code is:

form id=test name=test onsubmit=return true; action=/mywebapp/ 
ob/test.action method=post

table class=wwFormTable
tr
td class=tdLabellabel for=test_param1  
class=labelParam1:/label/td
tdinput type=text name=param1 value= id=test_param1/ 
/td

/tr
tr
td class=tdLabellabel for=test_param2  
class=labelParam2:/label/td
tdinput type=text name=param2 value= id=test_param2/ 
/td

/tr
tr
td colspan=2div align=rightinput type=submit  
id=test_0 value=Send//div/td

/tr
/table/form

Next since I need to see the values of these parameters in an  
interceptor and any actions that this interceptor does not need these  
parameters set as properties in the Action POJO; I implement the  
NoParameter interface in my TestAction.  (If I do not do this struts  
complains that it cannot set these properties in my action POJO.  
Ideally I would like to achieve the functionality I am looking to get  
without forcing the action class to implement the NoParameter marker  
interface?? Is there a way to do this??)


In my interceptor how do I get access to these parameters?

If I do something like this:
String param1 = actionInvocation.getStack().findString('param1');
String param2 = actionInvocation.getStack().findString('param2');

I get null values for param1 and param2

Aren't form parameters accessible from the value stack?

Thanks for any pointers.

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



Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Pascal SEREMES-DAMAL
Hello everyone!!!

I hope you had fun during the end of year 2007 and I wish you a happy new year.

I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
struts page and when I deployed it on my server I had the following
exceptions.

GRAVE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
Cannot create inner bean '(inner bean)' of type
[org.springframework.transaction.interceptor.TransactionInterceptor]
while setting bean property 'transactionInterceptor'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)': Cannot resolve reference to
bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
Cannot create inner bean '(inner bean)' of type
[org.springframework.transaction.interceptor.TransactionInterceptor]
while setting bean property 'transactionInterceptor'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)': Cannot resolve reference to
bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name '(inner bean)': Cannot resolve reference
to bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'transactionManager' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot
resolve reference to bean 'entityManagerFactory' while setting bean
property 'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: java.lang.IllegalStateException: No persistence units

[S2] Adding a new interceptor to every package.

2008-01-04 Thread GF
Hi everyone.
I have many packages that extends extends=tiles-default.
I would like to add an interceptor to all of them.

Now I'm doing this:

package name=myPackage extends=tiles-default namespace=/myspace

interceptors
interceptor name=myInter class=myInterceptor /
interceptor-stack name=myStack
interceptor-ref name=myInter /
interceptor-ref name=defaultStack /
/interceptor-stack
/interceptors

default-interceptor-ref name=myStack/
...
/package

But I should do this to Every one.. and it is not nice..
Can you suggest me a quicker (and more elegant) way?

Thank you!

GF

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



Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Musachy Barroso
Indeed. But the file needs to be there, even if it is empty, which I
found quite annoying (at least I don't know how to avoid having the
file there), like:

persistence xmlns=http://java.sun.com/xml/ns/persistence;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd;
version=1.0
persistence-unit name=punit
/persistence-unit
/persistence

musachy

On Jan 4, 2008 11:26 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
 In fact in the tutorial
 (http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
 ) they say that there no need to specify the JPA configuration in this
 file because the datasource will be on spring configuration file.

 2008/1/4, Musachy Barroso [EMAIL PROTECTED]:

  Spring couldn't find META-INF/persistence.xml
 
  musachy
 
  On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
   Hello everyone!!!
  
   I hope you had fun during the end of year 2007 and I wish you a happy new 
   year.
  
   I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
   struts page and when I deployed it on my server I had the following
   exceptions.
  
   GRAVE: Context initialization failed
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name
   'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
   defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
   Initialization of bean failed; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name
   'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
   Cannot create inner bean '(inner bean)' of type
   [org.springframework.transaction.interceptor.TransactionInterceptor]
   while setting bean property 'transactionInterceptor'; nested exception
   is org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name '(inner bean)': Cannot resolve reference to
   bean 'transactionManager' while setting bean property
   'transactionManager'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'transactionManager' defined in ServletContext
   resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
   to bean 'entityManagerFactory' while setting bean property
   'entityManagerFactory'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'entityManagerFactory' defined in
   ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
   of init method failed; nested exception is
   java.lang.IllegalStateException: No persistence units parsed from
   {classpath*:META-INF/persistence.xml}
   Caused by: org.springframework.beans.factory.BeanCreationException:
   Error creating bean with name
   'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
   Cannot create inner bean '(inner bean)' of type
   [org.springframework.transaction.interceptor.TransactionInterceptor]
   while setting bean property 'transactionInterceptor'; nested exception
   is org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name '(inner bean)': Cannot resolve reference to
   bean 'transactionManager' while setting bean property
   'transactionManager'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'transactionManager' defined in ServletContext
   resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
   to bean 'entityManagerFactory' while setting bean property
   'entityManagerFactory'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'entityManagerFactory' defined in
   ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
   of init method failed; nested exception is
   java.lang.IllegalStateException: No persistence units parsed from
   {classpath*:META-INF/persistence.xml}
   Caused by: org.springframework.beans.factory.BeanCreationException:
   Error creating bean with name '(inner bean)': Cannot resolve reference
   to bean 'transactionManager' while setting bean property
   'transactionManager'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'transactionManager' defined in ServletContext
   resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
   to bean 'entityManagerFactory' while setting bean property
   'entityManagerFactory'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'entityManagerFactory' defined in
   ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
   of init method failed; nested 

Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Pascal SEREMES-DAMAL
That's exactly what I have. I've followed all the instructions in the tuto.

2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
 Indeed. But the file needs to be there, even if it is empty, which I
 found quite annoying (at least I don't know how to avoid having the
 file there), like:

 persistence xmlns=http://java.sun.com/xml/ns/persistence;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd;
 version=1.0
 persistence-unit name=punit
 /persistence-unit
 /persistence

 musachy

 On Jan 4, 2008 11:26 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
  In fact in the tutorial
  (http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
  ) they say that there no need to specify the JPA configuration in this
  file because the datasource will be on spring configuration file.
 
  2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
 
   Spring couldn't find META-INF/persistence.xml
  
   musachy
  
   On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
Hello everyone!!!
   
I hope you had fun during the end of year 2007 and I wish you a happy 
new year.
   
I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
struts page and when I deployed it on my server I had the following
exceptions.
   
GRAVE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
Cannot create inner bean '(inner bean)' of type
[org.springframework.transaction.interceptor.TransactionInterceptor]
while setting bean property 'transactionInterceptor'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)': Cannot resolve reference to
bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
Cannot create inner bean '(inner bean)' of type
[org.springframework.transaction.interceptor.TransactionInterceptor]
while setting bean property 'transactionInterceptor'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)': Cannot resolve reference to
bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name '(inner bean)': Cannot resolve reference
to bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is

Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Musachy Barroso
Spring couldn't find META-INF/persistence.xml

musachy

On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
 Hello everyone!!!

 I hope you had fun during the end of year 2007 and I wish you a happy new 
 year.

 I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
 struts page and when I deployed it on my server I had the following
 exceptions.

 GRAVE: Context initialization failed
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name
 'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
 defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
 Initialization of bean failed; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name
 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
 Cannot create inner bean '(inner bean)' of type
 [org.springframework.transaction.interceptor.TransactionInterceptor]
 while setting bean property 'transactionInterceptor'; nested exception
 is org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name '(inner bean)': Cannot resolve reference to
 bean 'transactionManager' while setting bean property
 'transactionManager'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'transactionManager' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'entityManagerFactory' while setting bean property
 'entityManagerFactory'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'entityManagerFactory' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 of init method failed; nested exception is
 java.lang.IllegalStateException: No persistence units parsed from
 {classpath*:META-INF/persistence.xml}
 Caused by: org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name
 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
 Cannot create inner bean '(inner bean)' of type
 [org.springframework.transaction.interceptor.TransactionInterceptor]
 while setting bean property 'transactionInterceptor'; nested exception
 is org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name '(inner bean)': Cannot resolve reference to
 bean 'transactionManager' while setting bean property
 'transactionManager'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'transactionManager' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'entityManagerFactory' while setting bean property
 'entityManagerFactory'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'entityManagerFactory' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 of init method failed; nested exception is
 java.lang.IllegalStateException: No persistence units parsed from
 {classpath*:META-INF/persistence.xml}
 Caused by: org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name '(inner bean)': Cannot resolve reference
 to bean 'transactionManager' while setting bean property
 'transactionManager'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'transactionManager' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'entityManagerFactory' while setting bean property
 'entityManagerFactory'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'entityManagerFactory' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 of init method failed; nested exception is
 java.lang.IllegalStateException: No persistence units parsed from
 {classpath*:META-INF/persistence.xml}
 Caused by: org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'transactionManager' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot
 resolve reference to bean 'entityManagerFactory' while setting bean
 property 'entityManagerFactory'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'entityManagerFactory' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 of init method failed; nested exception is
 java.lang.IllegalStateException: No persistence units parsed from
 {classpath*:META-INF/persistence.xml}
 Caused by: org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name 'entityManagerFactory' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 of 

[S2] and XSS

2008-01-04 Thread GF
Hi all.
Is there any document about how to automatically handle security
issues related to Cross Site Scripting on websites managed with
Struts2?
I'm thinking about my own strategy, but I would like to know if
anything already exists.

Thank you
GF

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



Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Musachy Barroso
well, somehow the file is not getting there at runtime I guess, this
is from your stacktrace:

java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}

musachy

On Jan 4, 2008 11:35 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
 That's exactly what I have. I've followed all the instructions in the tuto.


 2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
  Indeed. But the file needs to be there, even if it is empty, which I
  found quite annoying (at least I don't know how to avoid having the
  file there), like:
 
  persistence xmlns=http://java.sun.com/xml/ns/persistence;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
  http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd;
  version=1.0
  persistence-unit name=punit
  /persistence-unit
  /persistence
 
  musachy
 
  On Jan 4, 2008 11:26 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
   In fact in the tutorial
   (http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
   ) they say that there no need to specify the JPA configuration in this
   file because the datasource will be on spring configuration file.
  
   2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
  
Spring couldn't find META-INF/persistence.xml
   
musachy
   
On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
 Hello everyone!!!

 I hope you had fun during the end of year 2007 and I wish you a happy 
 new year.

 I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
 struts page and when I deployed it on my server I had the following
 exceptions.

 GRAVE: Context initialization failed
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name
 'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
 defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
 Initialization of bean failed; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name
 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
 Cannot create inner bean '(inner bean)' of type
 [org.springframework.transaction.interceptor.TransactionInterceptor]
 while setting bean property 'transactionInterceptor'; nested exception
 is org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name '(inner bean)': Cannot resolve reference to
 bean 'transactionManager' while setting bean property
 'transactionManager'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'transactionManager' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'entityManagerFactory' while setting bean property
 'entityManagerFactory'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'entityManagerFactory' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 of init method failed; nested exception is
 java.lang.IllegalStateException: No persistence units parsed from
 {classpath*:META-INF/persistence.xml}
 Caused by: org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name
 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
 Cannot create inner bean '(inner bean)' of type
 [org.springframework.transaction.interceptor.TransactionInterceptor]
 while setting bean property 'transactionInterceptor'; nested exception
 is org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name '(inner bean)': Cannot resolve reference to
 bean 'transactionManager' while setting bean property
 'transactionManager'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'transactionManager' defined in ServletContext
 resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
 to bean 'entityManagerFactory' while setting bean property
 'entityManagerFactory'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'entityManagerFactory' defined in
 ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
 of init method failed; nested exception is
 java.lang.IllegalStateException: No persistence units parsed from
 {classpath*:META-INF/persistence.xml}
 Caused by: org.springframework.beans.factory.BeanCreationException:
 Error creating bean with name '(inner bean)': Cannot resolve reference
 to bean 'transactionManager' while setting bean property
 'transactionManager'; 

Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Pascal SEREMES-DAMAL
Do you mean it can come from a bad classpath..? Or maybe should I
specify somewhere that the spring framework is used for the
persistence... But I don't know where.

I thought that the setting struts.objectFactory to spring in
struts.xml would be enough.

2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
 well, somehow the file is not getting there at runtime I guess, this
 is from your stacktrace:

 java.lang.IllegalStateException: No persistence units parsed from
 {classpath*:META-INF/persistence.xml}

 musachy

 On Jan 4, 2008 11:35 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
  That's exactly what I have. I've followed all the instructions in the tuto.
 
 
  2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
   Indeed. But the file needs to be there, even if it is empty, which I
   found quite annoying (at least I don't know how to avoid having the
   file there), like:
  
   persistence xmlns=http://java.sun.com/xml/ns/persistence;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
   http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd;
   version=1.0
   persistence-unit name=punit
   /persistence-unit
   /persistence
  
   musachy
  
   On Jan 4, 2008 11:26 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
In fact in the tutorial
(http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
) they say that there no need to specify the JPA configuration in this
file because the datasource will be on spring configuration file.
   
2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
   
 Spring couldn't find META-INF/persistence.xml

 musachy

 On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] 
 wrote:
  Hello everyone!!!
 
  I hope you had fun during the end of year 2007 and I wish you a 
  happy new year.
 
  I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
  struts page and when I deployed it on my server I had the following
  exceptions.
 
  GRAVE: Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name
  'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
  defined in ServletContext resource 
  [/WEB-INF/applicationContext.xml]:
  Initialization of bean failed; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name
  'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
  Cannot create inner bean '(inner bean)' of type
  [org.springframework.transaction.interceptor.TransactionInterceptor]
  while setting bean property 'transactionInterceptor'; nested 
  exception
  is org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name '(inner bean)': Cannot resolve reference to
  bean 'transactionManager' while setting bean property
  'transactionManager'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'transactionManager' defined in 
  ServletContext
  resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
  to bean 'entityManagerFactory' while setting bean property
  'entityManagerFactory'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'entityManagerFactory' defined in
  ServletContext resource [/WEB-INF/applicationContext.xml]: 
  Invocation
  of init method failed; nested exception is
  java.lang.IllegalStateException: No persistence units parsed from
  {classpath*:META-INF/persistence.xml}
  Caused by: org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name
  'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
  Cannot create inner bean '(inner bean)' of type
  [org.springframework.transaction.interceptor.TransactionInterceptor]
  while setting bean property 'transactionInterceptor'; nested 
  exception
  is org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name '(inner bean)': Cannot resolve reference to
  bean 'transactionManager' while setting bean property
  'transactionManager'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'transactionManager' defined in 
  ServletContext
  resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
  to bean 'entityManagerFactory' while setting bean property
  'entityManagerFactory'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'entityManagerFactory' defined in
  ServletContext resource 

Re: Accessing form parameters in an interceptor ....

2008-01-04 Thread Chris Pratt
Try using InvocationContext.getActionContext().getParameters().  That
will give you a Map containing all the parameters.  I believe if you
remove parameters from the map, they won't be injected into the
Action, but you'll have to try that to confirm.
  (*Chris*)

On Jan 4, 2008 8:56 AM, Mufaddal Khumri [EMAIL PROTECTED] wrote:
 Basically I am trying to access some parameters in an interceptor
 since the interceptor needs to do something based on the values of
 these parameters. Any action that this interceptor is applied to does
 not need these parameters.

 In order to do this:

 If I have an ftl file with a form like such:

 @s.form namespace=/ob action=test method=post

  @s.textfield name=param1 label=Param1 /
  @s.textfield name=param2 label=Param2 /
  @s.submit value=Send/

 /@s.form

 The html produced by the above code is:

 form id=test name=test onsubmit=return true; action=/mywebapp/
 ob/test.action method=post
 table class=wwFormTable
 tr
  td class=tdLabellabel for=test_param1
 class=labelParam1:/label/td
  tdinput type=text name=param1 value= id=test_param1/
  /td
 /tr
 tr
  td class=tdLabellabel for=test_param2
 class=labelParam2:/label/td
  tdinput type=text name=param2 value= id=test_param2/
  /td
 /tr
 tr
  td colspan=2div align=rightinput type=submit
 id=test_0 value=Send//div/td
 /tr
 /table/form

 Next since I need to see the values of these parameters in an
 interceptor and any actions that this interceptor does not need these
 parameters set as properties in the Action POJO; I implement the
 NoParameter interface in my TestAction.  (If I do not do this struts
 complains that it cannot set these properties in my action POJO.
 Ideally I would like to achieve the functionality I am looking to get
 without forcing the action class to implement the NoParameter marker
 interface?? Is there a way to do this??)

 In my interceptor how do I get access to these parameters?

 If I do something like this:
 String param1 = actionInvocation.getStack().findString('param1');
 String param2 = actionInvocation.getStack().findString('param2');

 I get null values for param1 and param2

 Aren't form parameters accessible from the value stack?

 Thanks for any pointers.

 -
 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: struts2: interceptor - validation doesn't work :-(

2008-01-04 Thread Randy Burgess
Don't validation errors go to input? Like so:

 action name=UserTest_*  method={1}
 class=com.simple.validation.Test
 result name=error/pages/error.jsp/result
 result name=input/pages/welcome-input.jsp/result
 result name=success/pages/welcome.jsp/result
 interceptor-ref name=guest/
 /action

I put the annotations on the setters.

@RequiredStringValidator(type = ValidatorType.FIELD, message = You must
enter a password.)

@StringLengthFieldValidator(type = ValidatorType.SIMPLE, trim = true,
minLength = 6, maxLength = 100, fieldName = pwd, message = Password
must be at least 6 characters)

public void setPwd(String password) {
this.pwd = password;
}

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



 From: xianwinwin [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Date: Thu, 3 Jan 2008 15:37:08 -0800 (PST)
 To: user@struts.apache.org
 Subject: struts2: interceptor - validation doesn't work :-(
 
 
 I've been struggling with this issue for a while and any pointer would be
 appreciated.
 
 I have a simple file with one field -name; I would like to validate that the
 user put information in it.
 
 I'm using the annotation in order to achieve this but for some reason the
 validation doesn't work (there's no return message that the user did not
 provide the info).
 
 my file looks like this:
 
  
 @RequiredStringValidator(message=name is missing)
 public void setName(String name)
 {
 this.name=name;
 }
 
 
 in the jsp page:
 ...
  s:textfield name=name label=your name: /
 
 
 
 in the xml:
 action name=UserTest_*  method={1}
 class=com.simple.validation.Test
 result name=error/pages/error.jsp/result
 result name=success/pages/welcome.jsp/result
 
 interceptor-ref name=guest/
 /action
 
 
 the guest interceptor is:
 interceptor-stack name=guest 
 interceptor-ref name=defaultStack/
 /interceptor-stack
 
 any idea?
 
 -- 
 View this message in context:
 http://www.nabble.com/struts2%3A-interceptor---validation-doesn%27t-work-%3A-%
 28-tp14607863p14607863.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]
 


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



struts2 spring plugin

2008-01-04 Thread Brian Relph
I have read through the spring plugin wiki page
http://struts.apache.org/2.0.11/docs/spring-plugin.html for struts2.

I want my actions to be completely managed by spring, so i am declaring them
in applicationContext.xml.


?xml version=1.0 encoding=UTF-8?

beans xmlns=http://www.springframework.org/schema/beans;

xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:schemaLocation=http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd

http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd

http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd;

xmlns:aop=http://www.springframework.org/schema/aop;

xmlns:tx=http://www.springframework.org/schema/tx;

xmlns:util=http://www.springframework.org/schema/util;



bean id=com.cerner.healthe.struts2.action.AccountResendAction

  class=com.cerner.healthe.struts2.action.AccountResendAction
singleton=false

  property name=userService

ref=com.cerner.healthe.struts2.service.UserService /

  property name=provisioningService

ref=com.cerner.healthe.struts2.service.ProvisioningService /

/bean



...

/beans


However, when starting my application, spring throws an error:

*

org.xml.sax.SAXParseException*: cvc-complex-type.3.2.2: Attribute
'singleton' is not allowed to appear in element 'bean'.

I have also found an older version of the wiki page
http://cwiki.apache.org/WW/spring.html that gives an explanation of the
'singleton' attribute:

The singleton attribute is set to false, meaning that Spring will create a
new Action class upon each request, as Struts 1 would do.

Is this attribute no longer necessary?


RE: Outputting raw HTML with s:property tag

2008-01-04 Thread shai200

Thanks, I think that'll do it! 


Al Sutton-4 wrote:
 
 A polymorphic array would be my suggestion.
 
 Have an array of objects which contain an identifier for the struts tag
 type, and the data needed to populate it. For example;
 
 In your action you would have ;
 
 
 private MyPolyObject[] blah;
 
 
 Where MyPolyObject contains;
 
 
 class MyPolyObject {
   private int type
   private String value
 ...
 }
 
 Then your JSP has
 
 s:iterator value=blah
   s:if test=type==1
   s:property value=%{value}
   /s:if
   s:elseif test=type==2
   s:textfield value=%{value}
   /s:elseif
   
 /s:iterator
 
 You can then build extend MyPolyObject into classes which hold the
 information for specific types (e.g. a Map for the s:select type).
 
 Hope this helps.
 
 Al.
 
 
 -Original Message-
 From: shai200 [mailto:[EMAIL PROTECTED] 
 Sent: 03 January 2008 02:36
 To: user@struts.apache.org
 Subject: Re: Outputting raw HTML with s:property tag
 
 
 OK, here's what I'm doing: I am generating forms from external data.
 Meaning, I have some XML files, based on which, I am generating a form.
 
 Normally I could do this without Actions, but rather include a bean into a
 JSP file (am I right about that?)
 
 However, I also need to use request and response information, and that is
 why I was trying to do this through an action. 
 
 Perhaps you have some suggestions for me?
 
 Thanks.
 
 
 Laurie Harper wrote:
 
 Leaving aside the issue that you really shouldn't be spitting HTML out 
 of calls to action methods, the answer to your question is no. JSPs 
 are aren't processed 'recursively' like that; you can't have the 
 result of evaluating something in a JSP be something that needs
 evaluating.
 
 Why do you want this? It sounds like you're trying to do too much of 
 your presentation logic in action code, which is generally a bad idea.
 If you describe what you're trying to achieve, someone can probably 
 suggest a better approach.
 
 L.
 
 shai200 wrote:
 No, I want the output of my action to be yet another Struts tag (with 
 an
 s:
 suffix) which is translated into its HTML equivalent -  so for example:
 
 If my JSP file includes:
 
 s:property value=property1
 
 then the output of myAction.getProperty1 will be the following code:
 
 s:property value=property2
 
 and that in turn returns Hello. 
 
 So I want the outcome to be Hello on the screen.
 
 Another example: 
 
 s:property value=mytextbox
 
 and the output of that will be
 
 s:textfield value=hello 
 
 and I want the result to be a text field displaying the string hello
 inside it.
 
 
 Etcetera...
 
 
 
 newton.dave wrote:
 --- shai200 [EMAIL PROTECTED] wrote:
 Second question - how can I use struts tags as output (i.e.
 s:textarea)?
 Can Struts in turn convert them into HTML code by outputting Struts 
 HTML tag using s:property  ?
 You mean you want to display the (escaped) HTML created by a tag?

 d.


 -
 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]
 
 
 
 
 -- 
 View this message in context:
 http://www.nabble.com/Outputting-raw-HTML-with-s%3Aproperty-tag-tp14554781p1
 4590802.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]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Outputting-raw-HTML-with-s%3Aproperty-tag-tp14554781p14624682.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: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Pascal SEREMES-DAMAL
Did some one else encountered the same problem as mine when following
the tutorial 
http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
?

2008/1/4, Pascal SEREMES-DAMAL [EMAIL PROTECTED]:
 Do you mean it can come from a bad classpath..? Or maybe should I
 specify somewhere that the spring framework is used for the
 persistence... But I don't know where.

 I thought that the setting struts.objectFactory to spring in
 struts.xml would be enough.

 2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
  well, somehow the file is not getting there at runtime I guess, this
  is from your stacktrace:
 
  java.lang.IllegalStateException: No persistence units parsed from
  {classpath*:META-INF/persistence.xml}
 
  musachy
 
  On Jan 4, 2008 11:35 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
   That's exactly what I have. I've followed all the instructions in the 
   tuto.
  
  
   2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
Indeed. But the file needs to be there, even if it is empty, which I
found quite annoying (at least I don't know how to avoid having the
file there), like:
   
persistence xmlns=http://java.sun.com/xml/ns/persistence;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd;
version=1.0
persistence-unit name=punit
/persistence-unit
/persistence
   
musachy
   
On Jan 4, 2008 11:26 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
 In fact in the tutorial
 (http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
 ) they say that there no need to specify the JPA configuration in this
 file because the datasource will be on spring configuration file.

 2008/1/4, Musachy Barroso [EMAIL PROTECTED]:

  Spring couldn't find META-INF/persistence.xml
 
  musachy
 
  On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] 
  wrote:
   Hello everyone!!!
  
   I hope you had fun during the end of year 2007 and I wish you a 
   happy new year.
  
   I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on 
   the
   struts page and when I deployed it on my server I had the 
   following
   exceptions.
  
   GRAVE: Context initialization failed
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name
   'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
   defined in ServletContext resource 
   [/WEB-INF/applicationContext.xml]:
   Initialization of bean failed; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name
   'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
   Cannot create inner bean '(inner bean)' of type
   [org.springframework.transaction.interceptor.TransactionInterceptor]
   while setting bean property 'transactionInterceptor'; nested 
   exception
   is org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name '(inner bean)': Cannot resolve reference 
   to
   bean 'transactionManager' while setting bean property
   'transactionManager'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'transactionManager' defined in 
   ServletContext
   resource [/WEB-INF/applicationContext.xml]: Cannot resolve 
   reference
   to bean 'entityManagerFactory' while setting bean property
   'entityManagerFactory'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'entityManagerFactory' defined in
   ServletContext resource [/WEB-INF/applicationContext.xml]: 
   Invocation
   of init method failed; nested exception is
   java.lang.IllegalStateException: No persistence units parsed from
   {classpath*:META-INF/persistence.xml}
   Caused by: 
   org.springframework.beans.factory.BeanCreationException:
   Error creating bean with name
   'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
   Cannot create inner bean '(inner bean)' of type
   [org.springframework.transaction.interceptor.TransactionInterceptor]
   while setting bean property 'transactionInterceptor'; nested 
   exception
   is org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name '(inner bean)': Cannot resolve reference 
   to
   bean 'transactionManager' while setting bean property
   'transactionManager'; nested exception is
   org.springframework.beans.factory.BeanCreationException: Error
   creating bean with name 'transactionManager' defined in 
   

Re: struts2 spring plugin

2008-01-04 Thread Dave Newton
--- Brian Relph [EMAIL PROTECTED] wrote:
 I want my actions to be completely managed by spring, so i am declaring
 them in applicationContext.xml.

Just FYI, you don't need to do that if you use Spring as the default object
factory (is that the default? I don't remember.)

 Is this [singleton] attribute no longer necessary?

IIRC Spring 2 doesn't have that attribute, and the error message kind of
verifies that, leading me to believe it wouldn't be necessary. Or possible.
Check out the scope attribute.

That said, S2 isn't designed to be used with singleton actions, so I don't
know what would happen.

d.


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



Struts 2.0.11 and multipage wizard forms

2008-01-04 Thread termiX

Hi,

please, how can I create multipage forms (wizard) in Struts 2.0.11.

thank!

termi
-- 
View this message in context: 
http://www.nabble.com/Struts-2.0.11-and-multipage-wizard-forms-tp14625384p14625384.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 there a way to use Spring to inject objects to a Struts 2 Interceptor?

2008-01-04 Thread Néstor Boscán
Hi
 
Is there a way to use Spring to inject objects to a Struts 2 Interceptor?
 
Regards,
 
Néstor Boscán


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



Re: S2: httpheader result type

2008-01-04 Thread Laurie Harper

[EMAIL PROTECTED] wrote:

Hello All,

in configuring the httpheader result type in the struts.xml file, is
there a way to access objects on the value stack?


Have you tried using an expression, as in

  result ...
param ...${ognl.expression.here}/param

L.


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



Re: [ANN] Connext Graphs

2008-01-04 Thread Mark P Ashworth

Good Day,

The Connext-Graphs 0.6 is ready with an addition from Oleh Lozynskyy to
support the Sketch Bar chart from Open Flash Chart.


Project Page: https://connext-graphs.dev.java.net
Home Page: http://www.connext.co.za
Plugin Page:
http://cwiki.apache.org/confluence/display/S2PLUGINS/Connext+Graph+Plugin

Regards,
Mark P Ashworth
http://www.connext.co.za
-- 
View this message in context: 
http://www.nabble.com/-ANN--Connext-Graphs-tp11222429p14627151.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: Struts 2.0.11 and multipage wizard forms

2008-01-04 Thread Laurie Harper

termiX wrote:

Hi,

please, how can I create multipage forms (wizard) in Struts 2.0.11.


That's a bit of a vague question. What specifically are you having 
difficulty with?


L.


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



Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Laurie Harper
Musachy is suggesting that the persistence.xml file is not in your 
classpath (or not in the right place). Make sure that the file is really 
being deployed and that it is in the correct directory 
(WEB-INF/classes/META-INF/persistence.xml).


L.

Pascal SEREMES-DAMAL wrote:

Do you mean it can come from a bad classpath..? Or maybe should I
specify somewhere that the spring framework is used for the
persistence... But I don't know where.

I thought that the setting struts.objectFactory to spring in
struts.xml would be enough.

2008/1/4, Musachy Barroso [EMAIL PROTECTED]:

well, somehow the file is not getting there at runtime I guess, this
is from your stacktrace:

java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}

musachy

On Jan 4, 2008 11:35 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:

That's exactly what I have. I've followed all the instructions in the tuto.


2008/1/4, Musachy Barroso [EMAIL PROTECTED]:

Indeed. But the file needs to be there, even if it is empty, which I
found quite annoying (at least I don't know how to avoid having the
file there), like:

persistence xmlns=http://java.sun.com/xml/ns/persistence;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd;
version=1.0
persistence-unit name=punit
/persistence-unit
/persistence

musachy

On Jan 4, 2008 11:26 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:

In fact in the tutorial
(http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
) they say that there no need to specify the JPA configuration in this
file because the datasource will be on spring configuration file.

2008/1/4, Musachy Barroso [EMAIL PROTECTED]:


Spring couldn't find META-INF/persistence.xml

musachy

On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:

Hello everyone!!!

I hope you had fun during the end of year 2007 and I wish you a happy new year.

I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
struts page and when I deployed it on my server I had the following
exceptions.

GRAVE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
defined in ServletContext resource [/WEB-INF/applicationContext..xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
Cannot create inner bean '(inner bean)' of type
[org.springframework.transaction.interceptor.TransactionInterceptor]
while setting bean property 'transactionInterceptor'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)': Cannot resolve reference to
bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
Cannot create inner bean '(inner bean)' of type
[org.springframework.transaction.interceptor.TransactionInterceptor]
while setting bean property 'transactionInterceptor'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '(inner bean)': Cannot resolve reference to
bean 'transactionManager' while setting bean property
'transactionManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
to bean 'entityManagerFactory' while setting bean property
'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
of init method failed; nested exception is
java.lang.IllegalStateException: No persistence units parsed from
{classpath*:META-INF/persistence.xml}

Re: [S2] Adding a new interceptor to every package.

2008-01-04 Thread Laurie Harper

GF wrote:

Hi everyone.
I have many packages that extends extends=tiles-default.
I would like to add an interceptor to all of them.

Now I'm doing this:

package name=myPackage extends=tiles-default namespace=/myspace

interceptors
interceptor name=myInter class=myInterceptor /
interceptor-stack name=myStack
interceptor-ref name=myInter /
interceptor-ref name=defaultStack /
/interceptor-stack
/interceptors

default-interceptor-ref name=myStack/
...
/package

But I should do this to Every one.. and it is not nice..
Can you suggest me a quicker (and more elegant) way?


Sure: define the stack once, then reference it from each of your packages:

  package name=default extends=tiles-default abstract=true
interceptors
  interceptor name=myInter class=myInterceptor /
  interceptor-stack name=myStack
interceptor-ref name=myInter /
interceptor-ref name=defaultStack /
  /interceptor-stack
/interceptors

default-interceptor-ref name=myStack/

  /package

  package name=myPackage extends=default namespace=/myspace
...actions...
  /package

See the Interceptors guide [1], especially the Stacking Interceptors 
section and the first item in the FAQs [2] at the end.


L.

[1] http://struts.apache.org/2.0.11/docs/interceptors.html
[2] 
http://struts.apache.org/2.0.11/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.html



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



Re: setting locale manually

2008-01-04 Thread Laurie Harper

From the documentation Martin linked to:

For example, using the default parameter name, a request to 
foo.action?request_locale=en_US, then the locale for US English is saved 
in the user's session and will be used for all future requests.


So, specifying the locale parameter once is sufficient.

L.


Raghuveer wrote:

So you mean if I  addrequest_locale=en_US in all forward this will work
OR if I add in first forward it is sufficient?

 

  _  

From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 04, 2008 8:10 PM

To: [EMAIL PROTECTED]
Subject: RE: setting locale manually

 


Czes Raghu

http://struts.apache.org/2.0.11/docs/i18n-interceptor.html
you can pass the locale on the request
and path accordingly
 
dziekuje!


Martin 
__

Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and Sender
does not endorse distribution to any party other than intended recipient.
Sender does not necessarily endorse content 


From: [EMAIL PROTECTED]
To: user@struts.apache.org
Subject: setting locale manually
Date: Fri, 4 Jan 2008 18:30:39 +0530

How to set locale for my struts application.

My application will have 2 languages.

There will be 2 buttons in jsp page.

One button is polish and other is English.



on clicking of Polish button all the labels and button names and messages
are to be changed into polis language.



Any suggestions of implementing this





  _  


Watch Cause Effect, a show about real people making a real difference.
Learn http://im.live.com/Messenger/IM/MTV/?source=text_watchcause  more





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



Re: S2: httpheader result type

2008-01-04 Thread John Cartwright

Hi Laurie,

Thanks for your reply and suggestion. I can access what I'm assuming is 
the Exception object, but can't seem to get the message property from it:


   result name=sessionTimeout type=httpheader
   param name=status204/param
   param 
name=headers.exceptionSessionTimeoutException/param

   param name=headers.class${exception}/param
  param name=headers.message${exception.message}/param
 param name=headers.stack${exception.stackTrace}/param
   /result

${exception} reports the fully qualified Exception class name
${exception.message} is null
${exception.stackTrace} reports only the first line of the stack trace.

If I forward to a JSP, it has access to the message, stack trace via
s:property value=exception /
s:property value=exceptionStack /

In any case, having the class name provides me a workable solution - 
thanks so much for your help!


-- john


Laurie Harper wrote:

[EMAIL PROTECTED] wrote:

Hello All,

in configuring the httpheader result type in the struts.xml file, is
there a way to access objects on the value stack?


Have you tried using an expression, as in

  result ...
param ...${ognl.expression.here}/param

L.


-
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 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Pascal SEREMES-DAMAL
How can I be sure that it is deployed?

The file was in /META-INF/persistence.xml as described in the tutorial.

I put it in WEB-INF/classes/META-INF/persistence.xml and it works.
Thank both of you very much!

Pascal

2008/1/4, Laurie Harper [EMAIL PROTECTED]:
 Musachy is suggesting that the persistence.xml file is not in your
 classpath (or not in the right place). Make sure that the file is really
 being deployed and that it is in the correct directory
 (WEB-INF/classes/META-INF/persistence.xml).

 L.

 Pascal SEREMES-DAMAL wrote:
  Do you mean it can come from a bad classpath..? Or maybe should I
  specify somewhere that the spring framework is used for the
  persistence... But I don't know where.
 
  I thought that the setting struts.objectFactory to spring in
  struts.xml would be enough.
 
  2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
  well, somehow the file is not getting there at runtime I guess, this
  is from your stacktrace:
 
  java.lang.IllegalStateException: No persistence units parsed from
  {classpath*:META-INF/persistence.xml}
 
  musachy
 
  On Jan 4, 2008 11:35 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
  That's exactly what I have. I've followed all the instructions in the 
  tuto.
 
 
  2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
  Indeed. But the file needs to be there, even if it is empty, which I
  found quite annoying (at least I don't know how to avoid having the
  file there), like:
 
  persistence xmlns=http://java.sun.com/xml/ns/persistence;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
  http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd;
  version=1.0
  persistence-unit name=punit
  /persistence-unit
  /persistence
 
  musachy
 
  On Jan 4, 2008 11:26 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] wrote:
  In fact in the tutorial
  (http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html
  ) they say that there no need to specify the JPA configuration in this
  file because the datasource will be on spring configuration file.
 
  2008/1/4, Musachy Barroso [EMAIL PROTECTED]:
 
  Spring couldn't find META-INF/persistence.xml
 
  musachy
 
  On Jan 4, 2008 11:12 AM, Pascal SEREMES-DAMAL [EMAIL PROTECTED] 
  wrote:
  Hello everyone!!!
 
  I hope you had fun during the end of year 2007 and I wish you a happy 
  new year.
 
  I tried the Struts 2 + Spring 2 + JPA + AJAX tutorial that is on the
  struts page and when I deployed it on my server I had the following
  exceptions.
 
  GRAVE: Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name
  'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor'
  defined in ServletContext resource [/WEB-INF/applicationContext..xml]:
  Initialization of bean failed; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name
  'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
  Cannot create inner bean '(inner bean)' of type
  [org.springframework.transaction.interceptor.TransactionInterceptor]
  while setting bean property 'transactionInterceptor'; nested exception
  is org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name '(inner bean)': Cannot resolve reference to
  bean 'transactionManager' while setting bean property
  'transactionManager'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'transactionManager' defined in ServletContext
  resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference
  to bean 'entityManagerFactory' while setting bean property
  'entityManagerFactory'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'entityManagerFactory' defined in
  ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation
  of init method failed; nested exception is
  java.lang.IllegalStateException: No persistence units parsed from
  {classpath*:META-INF/persistence.xml}
  Caused by: org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name
  'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor':
  Cannot create inner bean '(inner bean)' of type
  [org.springframework.transaction.interceptor.TransactionInterceptor]
  while setting bean property 'transactionInterceptor'; nested exception
  is org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name '(inner bean)': Cannot resolve reference to
  bean 'transactionManager' while setting bean property
  'transactionManager'; nested exception is
  org.springframework.beans.factory.BeanCreationException: Error
  creating bean with name 'transactionManager' defined in ServletContext
  resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference

Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Frans Thamura
can we have the code also?

F


Re: Struts 2 + Spring 2 + JPA + AJAX tutorial

2008-01-04 Thread Pascal SEREMES-DAMAL
All the code is there :
http://struts.apache.org/2.0.11/docs/struts-2-spring-2-jpa-ajax.html

But I had a problem to deploy the application on my tomcat server.

Musachy and Laurie suggested to move the file persistence.xml from
/META-INF (where indicated in the tutorial) to
/WEB-INF/classes/META-INF.

Enjoy.


Pascal


2008/1/4, Frans Thamura [EMAIL PROTECTED]:
 can we have the code also?

 F


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