Re: OutOfMemoryError: PermGen space!!!! Dont know why?

2010-07-13 Thread RogerV



abhishek jain-11 wrote:
 
 Hi friends,
 I need urgent help, i have developed an application but when i run that on
 server i get the following error,
 I am using Tomcat 5.5 and Struts 1.1 , i develpoed application using
 Myeclipse, do i need to optimize application by removing some libraries
 before deploying or so.
 Pl. help
 

Alternatively, if you are using Tomcats hot deploy you are probably running
into the Tomcat memory leak. It's an ongoing problem that is still present
in the current 6.0.26 version. If you're developing in Eclipse then the
problem is probably being made worse by Eclipses default behaviour to
re-deploy after every change to the source. If this is the case then no
amount of adjusting your code as going to help you and no matter how much
memory you allocate to the JVM you are going to hit this at some point. The
only way around this is to periodically shut down and re-start Tomcat. 

The developers reckon that they've finally solved this in Tomcat 7 which is
currently in beta.

Regards
-- 
View this message in context: 
http://old.nabble.com/OutOfMemoryError%3A-PermGen-space%21%21%21%21-Dont-know-why--tp29114902p29146903.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



how can i get the validation in japanese

2010-07-13 Thread Salish S
Hi all
I'm facing a problem ,

in a sample there is a username and password there two has to show in
japanese if the user didnt enter the values the validation also has also be
shown in japanese i had changed the page encoding ,changed to validation.xml
to property file there also on saving eclise is shwing cant encode to utf-8
some ISO ... is enabled so i change the language support of my
sys,in eclipse also Window-PrefencesGeneral---Workspace to
UTF-8 but on deplaying the validation is showing in  why what is
the problem and how can i get it correct
Thanks in advance


Session error while loading an object

2010-07-13 Thread abhishek jain
Hi friends,
I am using tomcat 5.5 , struts 1.x and i encounter the following error:
I actually store the object in session and retrieve that(for a shopping cart
application), pl. advice what i can do to remove this error:

Exception loading sessions from persistent
storagejava.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: com.cart.Customer
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
   at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
   at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
   at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
   at
org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1416)
   at
org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:940)
   at
org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
   at
org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
   at
org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
   at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4202)
   at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:3056)
   at
org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
   at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1278)
   at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
   at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
   at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
   at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
   at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.NotSerializableException: com.cart.Customer
   at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
   at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
   at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
   at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
   at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
   at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
   at
org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1492)
   at
org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:957)
   at
org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:517)
   at
org.apache.catalina.session.StandardManager.unload(StandardManager.java:463)
   at
org.apache.catalina.session.StandardManager.stop(StandardManager.java:667)
   at
org.apache.catalina.core.StandardContext.stop(StandardContext.java:4362)
   at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:3050)
   ... 7 more



-- 
Thanks and kind Regards,
Abhishek jain


Model Driven Preparable

2010-07-13 Thread Amol Ghotankar
Dear List members,


I have implemented model driven  prepare able interface in S2, also
included interceptor stack

My method call flow is

 1.prepare  2.getModel  3.getModel
Why does getModel gets called twice. Is it to useful to call it twice or is
my config setting wrong somewhere.

Also I create a object in my prepare method, but this method creates new
object every-time rather than using the created object in previous prepare.



With Best Regards,

Amol Ghotankar


RE: how can i get the validation in japanese

2010-07-13 Thread Martin Gainty

UTF-8 wont handle dbcs or tbcs languages
i would suggest change all encodings (parameter and file,input and output) to 
UTF-16

 

?xml version=1.0 encoding=UTF-8 ?

change all XML declaration tags for all XML files to UTF-16 e.g.

?xml version=1.0 encoding=UTF-16 ?

 

freemarker and velocity have their language specific scripts which you will 
need to modify or insert located at

/WEB-INF/velocity/tiles-defs_ja_JA.xml

/WEB-INF/freemarker/tiles-defs_ja_JA.xml

 

if you use the embeddedjsp plugin you will need to provide 
LocalStrings_ja.properties in resources folder

\plugins\embeddedjsp\src\main\resources\org\apache\struts2\jasper\resources\LocalStrings_ja.properties

 

if you are using portlets in portlet.xml change 
supported-localeen/supported-locale to 
supported-localeja/supported-locale

 

set the locale for your sessions to ja_JA via i18n-interceptor

https://cwiki.apache.org/WW/i18n-interceptor.html


Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.



 

 Date: Tue, 13 Jul 2010 13:04:56 +0530
 Subject: how can i get the validation in japanese
 From: ssal...@gmail.com
 To: user@struts.apache.org
 
 Hi all
 I'm facing a problem ,
 
 in a sample there is a username and password there two has to show in
 japanese if the user didnt enter the values the validation also has also be
 shown in japanese i had changed the page encoding ,changed to validation.xml
 to property file there also on saving eclise is shwing cant encode to utf-8
 some ISO ... is enabled so i change the language support of my
 sys,in eclipse also Window-PrefencesGeneral---Workspace to
 UTF-8 but on deplaying the validation is showing in  why what is
 the problem and how can i get it correct
 Thanks in advance
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

result-type using annotations

2010-07-13 Thread JP Cafaro
Is it possible to declare result-type using annotations?  For example, 
when trying to return an object, that gets serialized to json, is it 
possible to move away from the struts.xml result-type and do it via 
annotations


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts2 validation

2010-07-13 Thread kisja

I have two textfield and I would like to validate that at least one of both
have data. 
How I can do? 

(I apologize for my bad English)

Thanks
-- 
View this message in context: 
http://old.nabble.com/Struts2-validation-tp29149892p29149892.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 validation

2010-07-13 Thread jake
You can use the fieldexpression validator. See 
http://struts.apache.org/2.1.8.1/docs/fieldexpression-validator.html for 
details.

On Tue, Jul 13, 2010 at 05:39:52AM -0700, kisja wrote:
 
 I have two textfield and I would like to validate that at least one of both
 have data. 
 How I can do? 
 
 (I apologize for my bad English)
 
 Thanks
 -- 
 View this message in context: 
 http://old.nabble.com/Struts2-validation-tp29149892p29149892.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Session error while loading an object

2010-07-13 Thread Robert Taylor

Greetings,

Does the Customer object implement Serializable interface?
If not, try modifying Customer to implement Serializable and see if the 
error still persists.


/robert
- Original Message - 
From: abhishek jain abhishek.netj...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 4:33 AM
Subject: Session error while loading an object



Hi friends,
I am using tomcat 5.5 , struts 1.x and i encounter the following error:
I actually store the object in session and retrieve that(for a shopping 
cart

application), pl. advice what i can do to remove this error:

Exception loading sessions from persistent
storagejava.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: com.cart.Customer
  at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)

  at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
  at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
  at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
  at 
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)

  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
  at
org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1416)
  at
org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:940)
  at
org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
  at
org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
  at
org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
  at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4202)
  at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:3056)
  at
org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
  at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1278)
  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
  at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
  at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.NotSerializableException: com.cart.Customer
  at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
  at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
  at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
  at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
  at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
  at
org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1492)
  at
org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:957)
  at
org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:517)
  at
org.apache.catalina.session.StandardManager.unload(StandardManager.java:463)
  at
org.apache.catalina.session.StandardManager.stop(StandardManager.java:667)
  at
org.apache.catalina.core.StandardContext.stop(StandardContext.java:4362)
  at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:3050)
  ... 7 more



--
Thanks and kind Regards,
Abhishek jain




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 remote commands execution

2010-07-13 Thread Greg Lindholm
Thanks for pushing this, your right it is critical and needs to be fixed asap.

On Sat, Jul 10, 2010 at 4:02 AM, Meder Kydyraliev mede...@gmail.com wrote:
 There's a critical remote commands execution vulnerability in XWork(used by
 Struts2), which fixed in 2.2.0, which isn't released yet but can be
 downloaded here: http://people.apache.org/builds/struts/2.2.0/

 More details about this vulnerability can be found here:
 http://blog.o0o.nu/2010/07/cve-2010-1870-struts2xwork-remote.html

 Meder


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2 remote commands execution

2010-07-13 Thread Johannes Geppert

is version 2.2.0 also available with maven?

Johannes


Meder Kydyraliev-2 wrote:
 
 There's a critical remote commands execution vulnerability in XWork(used
 by
 Struts2), which fixed in 2.2.0, which isn't released yet but can be
 downloaded here: http://people.apache.org/builds/struts/2.2.0/
 
 More details about this vulnerability can be found here:
 http://blog.o0o.nu/2010/07/cve-2010-1870-struts2xwork-remote.html
 
 Meder
 
 


-
---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep

-- 
View this message in context: 
http://old.nabble.com/Struts2-remote-commands-execution-tp29124645p29150957.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Javascript issues

2010-07-13 Thread Fabio Alves de Araujo Ebner - DnaSolution

Hey man, did u see the email i send? with my class and struts.xml??

tks
- Original Message - 
From: JP Cafaro jcafar...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Monday, July 12, 2010 2:38 PM
Subject: Re: Javascript issues



I think the problem has to do with this line:

script src=ajax-user-browser.js type=text/javascript /

When I use firefox, and view the source, I can click on the link to
ajax-user-browser.js and it can't find the resource.  I think this is
because it's under my WEB-INF directory.  I moved ajax-user-browser.js
to a folder js on the same level as WEB-INF and changed the line to:

script src=../js/ajax-user-browser.js type=text/javascript /

but it still doesn't work!  Nothing shows up on the page.  However when I 
view the source
this time, I can click the link and I do see the code for the javascript. 
Please help!




JP Cafaro wrote:

I'm trying to incorporate some ajax stuff with struts2 but I'm running
into problems.

I have this action:
public class AjaxUserBrowser extends ActionSupport
{
   private ListUser users;
 public String execute()
   {
   System.out.println(AJAX USER BROWSER);
   setUsers(getPortfolioService().getUsers());
   return SUCCESS;
   }
 public PortfolioService getPortfolioService( ){
   return new PortfolioService();
   }

   public void setUsers(ListUser users)
   {
   this.users = users;
   }

   public ListUser getUsers()
   {
   return users;
   }
}

It's very simple.  It doesn't really do anything.
Then I have this resulting jsp page:
?xml version=1.0 encoding=ISO-8859-1 ?
%@ page language=java contentType=text/html; charset=ISO-8859-1
   pageEncoding=ISO-8859-1%
%@ taglib prefix=s uri=/struts-tags%
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html;
charset=ISO-8859-1 /
script src=ajax-user-browser.js type=text/javascript /
titleTitle/title
/head
body
h5Artist Browser Control/h5s:form action=AjaxRetrieveUser
 s:select name=username list='users' listKey=username
listValue=username label=Select an artist value=defaultUsername
onchange=fetchUser();/   /s:form hr/
  h5Artist Information/h5   div id='console'
 pName: s:property value=defaultUser.firstName/ s:property
value=defaultUser.lastName//p
 s:iterator value=defaultUser.portfolios
   pPortfolioName: s:property value=value.name //p
 /s:iterator
  /div
/body
/html

When I click the link to the action, nothing appears on the resulting
page.  The action fires (print statement is printed) but no resulting
page is shown.  If I view the source, the html is right, and if I take
out the script line, the page is shown but doesn't do anything
obviously

Here is the javascript file:
var req=null;
var console=null;
var READY_STATE_UNINITIALIZED=0;
var READY_STATE_LOADING=1;
var READY_STATE_LOADED=2;
var READY_STATE_INTERACTIVE=3;
var READY_STATE_COMPLETE=4;

function sendRequest ( url, params, HttpMethod ) {
 if ( !HttpMethod ){
   HttpMethod=GET;
   }
   req=initXMLHTTPRequest();if ( req ) {
   req.onreadystatechange=onReadyState;
   req.open(HttpMethod, url, true );
   req.setRequestHeader ( Content-Type,
application/x-www-form-urlencoded);
   req.send (params);
   }
}

function initXMLHTTPRequest(){
   var xRequest=null;
   if (window.XMLHttpRequest) {
   xRequest=new XMLHttpRequest();
   } else if ( window.ActiveXObject ){
   xRequest = new ActiveXObject(Microsoft.XMLHTTP);
   }
   return xRequest;
}


function onReadyState() {
   var ready=req.readyState;
   var jsonObject=null;
 if ( ready == READY_STATE_COMPLETE ){
   jsonObject=eval( (+ req.responseText +) );
 toFinalConsole ( jsonObject );
   }
}

function toFinalConsole(jsonObject){
 if (console!=null){
   removeAllChildren ( console );
   var div = document.createElement(p);
   var txt=document.createTextNode(Name:  +
jsonObject.artist.firstName +   + jsonObject.artist.lastName );
   div.appendChild ( txt );
   console.appendChild(div);
 //mess of Javascript references because we didn't mediate the
JSON interpretation of our maps, etc.
   var portfolios = jsonObject.artist.portfolios.entry;
   var portfolioCount = portfolios.length;
   for ( var index = 0;  index  portfolioCount; index++ ) {
var portfolio = portfolios[index];
  txt=document.createTextNode(Portfolio Name:  +
portfolio['string']  );
  div = document.createElement(p);
  div.appendChild ( txt );
  console.appendChild(div);
   }
 }
}

function removeAllChildren( node ){
   var childCount = node.childNodes.length;
   for ( var count = 1; count = childCount; count++) {
   node.removeChild ( node.childNodes[0] );
   }
}

function fetchUser()
{
 console=document.getElementById('console');
 var selectBox = 

Re: Help Struts2 + interceptor

2010-07-13 Thread JP Cafaro
I'm fairly new to this myself so maybe someone else can jump in.  First 
things first, put a print statement in the intercept methods of your 
interceptors so you at least know if the interceptor is even getting 
called. 

Secondly, I didn't ever use a line like this:interceptorRefs = { 
@InterceptorRef(loginClienteInterceptor) }) .


Other than that, I'm not sure what else to do.

Fabio Alves de Araujo Ebner - DnaSolution wrote:

Hey man, this is my structure


MY ACTION

package br.com.dnasolution.site.action;


/** import **//


@ParentPackage(my-secure)

public class OrdemServicoAction {

@Action(value = cadastrarOrdemServico, results = {...@result(name = 
valido, location = /jsp/ordemservico/cadastro_sucesso.jsp), 
@Result(name = invalido, location = 
/jsp/ordemservico/cadastro_falha.jsp) }, interceptorRefs = { 
@InterceptorRef(loginClienteInterceptor) })

public String cadastrarOrdemServico() {
   /* code */
}



MY INTERCEPTOR

package br.com.dnasolution.site.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class LoginClienteInterceptor implements Interceptor {

@Override
public void destroy() {
 // TODO Auto-generated method stub

}

@Override
public void init() {
 // TODO Auto-generated method stub

}

@Override
public String intercept(ActionInvocation invocation) throws Exception {
 if(invocation.getInvocationContext().getSession().get(clienteLogado) 
!= null){

  return invocation.invoke();
 }else{
  return clienteNaoLogado;
 }
}

}



AND MY STRUTS.XML

!DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts 
Configuration 2.0//EN 
http://struts.apache.org/dtds/struts-2.0.dtd;struts


package name=my-secure

extends=struts-default

interceptors

interceptor name=loginUsuarioInterceptor

class=br.com.dnasolution.site.interceptor.LoginUsuarioInterceptor

/interceptor

interceptor name=loginClienteInterceptor

class=br.com.dnasolution.site.interceptor.LoginClienteInterceptor

/interceptor

interceptor-stack name=secureStack

interceptor-ref name=loginUsuarioInterceptor/

interceptor-ref name=loginClienteInterceptor/

interceptor-ref name=defaultStack/

/interceptor-stack

/interceptors


default-interceptor-ref name=secureStack/


global-results

result name=clienteNaoLogado/jsp/usuario/loginUsuario.jsp

/result

result name=clienteNaoLogado/jsp/cliente/loginCliente.jsp

/result

/global-results


/package

/struts






and still dosen't work :(


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Help Struts2 + interceptor

2010-07-13 Thread Fabio Alves de Araujo Ebner - DnaSolution
The problem is: When he pass through interceptor and go to action 
cadastrarOrdemServico  my var cdProjetoOS are set with null :(


thanks, follow my all code:

CLASS LoginClienteInterceptor .java
---
package br.com.dnasolution.site.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class LoginClienteInterceptor implements Interceptor {

@Override
public void destroy() { }
@Override
public void init() { }

@Override
public String intercept(ActionInvocation invocation) throws Exception {
 if(invocation.getInvocationContext().getSession().get(clienteLogado) != 
null){

  return invocation.invoke();
 }else{
  return clienteNaoLogado;
 }
}

}

Class LoginUsuarioInterceptor

package br.com.dnasolution.site.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class LoginUsuarioInterceptor implements Interceptor {

@Override
public void destroy() {}

@Override
public void init() { }

@Override
public String intercept(ActionInvocation invocation) throws Exception {
 if(invocation.getInvocationContext().getSession().get(usuarioLogado) != 
null){

  return invocation.invoke();
 }else{
  return usuarioNaoLogado;
 }
}

}

My STruts.xml

!DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts 
Configuration 2.0//EN 
http://struts.apache.org/dtds/struts-2.0.dtd;struts

package name=my-secure
   extends=convention-default
 interceptors
  interceptor name=loginUsuarioInterceptor
  class=br.com.dnasolution.site.interceptor.LoginUsuarioInterceptor
  /interceptor
  interceptor name=loginClienteInterceptor
  class=br.com.dnasolution.site.interceptor.LoginClienteInterceptor
  /interceptor
  interceptor-stack name=secureStack
   interceptor-ref name=defaultStack/
   interceptor-ref name=loginClienteInterceptor/
   interceptor-ref name=loginUsuarioInterceptor/
  /interceptor-stack
 /interceptors

 default-interceptor-ref name=secureStack/

 global-results
  result name=clienteNaoLogado/jsp/usuario/loginUsuario.jsp
  /result
  result name=clienteNaoLogado/jsp/cliente/loginCliente.jsp
  /result
 /global-results

/package
/struts

My OrdemServicoAction.java



package br.com.dnasolution.site.action;

import java.util.Date;
import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;


import com.opensymphony.xwork2.ActionContext;

@ParentPackage(my-secure)
public class OrdemServicoAction {
@Action(value = cadastrarOrdemServico, results = {
  @Result(name = valido, location = 
/jsp/ordemservico/cadastro_sucesso.jsp),
  @Result(name = invalido, location = 
/jsp/ordemservico/cadastro_falha.jsp) }, interceptorRefs = { 
@InterceptorRef(loginClienteInterceptor) })

public String cadastrarOrdemServico() {
 try {
  TbProjeto projetoOS = projetoService
.getProjetoById(this.cdProjetoOS);
  TbTopicoOs topicoOs = topicoOsService.getTopicoById(cdTopicoOS);

} 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Session error while loading an object

2010-07-13 Thread abhishek jain
Hi,
thanks for the comments, i will check but i get this error only at times,
and not always.
Can this still be the cause of the problem.
thanks
abhishek

On Tue, Jul 13, 2010 at 6:39 PM, Robert Taylor rtay...@dtgresults.comwrote:

 Greetings,

 Does the Customer object implement Serializable interface?
 If not, try modifying Customer to implement Serializable and see if the
 error still persists.

 /robert
 - Original Message - From: abhishek jain 
 abhishek.netj...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 4:33 AM
 Subject: Session error while loading an object



  Hi friends,
 I am using tomcat 5.5 , struts 1.x and i encounter the following error:
 I actually store the object in session and retrieve that(for a shopping
 cart
 application), pl. advice what i can do to remove this error:

 Exception loading sessions from persistent
 storagejava.io.WriteAbortedException: writing aborted;
 java.io.NotSerializableException: com.cart.Customer
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
  at
 java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
  at
 java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
  at
 java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
  at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
  at

 org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1416)
  at

 org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:940)
  at

 org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
  at
 org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
  at

 org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
  at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:4202)
  at
 org.apache.catalina.core.StandardContext.reload(StandardContext.java:3056)
  at

 org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432)
  at

 org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1278)
  at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
  at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
  at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
  at

 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
  at java.lang.Thread.run(Thread.java:619)
 Caused by: java.io.NotSerializableException: com.cart.Customer
  at
 java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
  at

 java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
  at
 java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
  at

 java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
  at
 java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
  at
 java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
  at

 org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1492)
  at

 org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:957)
  at

 org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:517)
  at

 org.apache.catalina.session.StandardManager.unload(StandardManager.java:463)
  at
 org.apache.catalina.session.StandardManager.stop(StandardManager.java:667)
  at
 org.apache.catalina.core.StandardContext.stop(StandardContext.java:4362)
  at
 org.apache.catalina.core.StandardContext.reload(StandardContext.java:3050)
  ... 7 more






Re: Struts2 remote commands execution

2010-07-13 Thread Lukasz Lenart
2010/7/13 Johannes Geppert jo...@web.de:
 is version 2.2.0 also available with maven?

Not yet, still in stagging repo only and still under the Vote :-(


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Kapituła Javarsovia 2010 http://javarsovia.pl

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



How to use indexOf in s:if using struts2.

2010-07-13 Thread sharath karnati
Hi All,
 
   Say I have an String[] colors which is populated with thse 
values{red,blue,green,yellow,white,black}, the colors are declared 
in action class.
 
   I have an colorList(java.util.ListString) which is having all colors. In 
UI when I use s:iterator for looping colorList, when color value from 
colorList exists in colors array then I'd like to show Found message, if 
not I need to display Not Found message.
 
   How to use s:if to test color value from colorList exists in colors array??
 
   Can anyone please let me know, how to use indexOf in s:if condition.
 
   Thanks in advance.
 
Regards,
Sharath. 
 
 


  

Re: How to modify Struts2 start up process.

2010-07-13 Thread Chris Pratt
It's being called twice because, since you defined it as scope=singleton,
Spring is creating a singleton instance for you automatically on start-up.
Then your code is creating another instance in your getStartupService()
method.  You don't need to explicitly instantiate one, just let Spring
inject it where you need it.
  (*Chris*)

On Tue, Jul 13, 2010 at 11:42 AM, hisameer cool_sameer_fo...@yahoo.comwrote:


 Thanks for the suggestion. I have implemented it, but the issue is that the
 bean is called twice.I am using websphere server 6.1. Do you have any idea
 why its happening?

 Here is the code in ApplicationContext.xml

 bean id=initBean class=com.singleton.startup.service.StartUPService
 scope=singleton init-method=init
property name=flag value=true /
property name=days value=15 /
/bean


 and StartUPService.java class looks like this:
 public class StartUPService implements ApplicationContextAware {

private static StartUPService ref;

private ApplicationContext ctx;

private static Logger logger =
 Logger.getLogger(StartUPService.class);

private boolean flag= true;

private ServiceDAO dao;

private int days= 15;

private StartUPService() {
// no code req'd
}

public static StartUPService getStartUPService() {

if (ref == null) {
// it's ok, we can call this constructor
ref = new StartUPService();
}
return ref;
}

public void init() {

if (ref == null) {
// it's ok, we can call this constructor
ref = new StartUPService();
long startTime = System.currentTimeMillis();
loadRequiredObject();
long endTime = System.currentTimeMillis();
logger.info(The Total time taken is:  + (endTime
 - startTime)
+  ms);
}

}

  private void loadRequiredObject(){
   if (dao== null) {
dao= (ServiceDAO) ctx.getBean(daoBean);
}
   //here I will do some processing using the database access using dao
 service layer
 }


 satyanarayana katta wrote:
 
  Using the application level spring container would be sufficient with
 init
  method set.
 
  Sent from my iPhone
 
  On Jun 25, 2010, at 11:36 AM, hisameer cool_sameer_fo...@yahoo.com
  wrote:
 
 
  Hi,
 
  I am using Struts2.1.6+Spring2.5.6+Hibernate+JPA in my web application.
  The
  application server is JBOSS5. I have to implement a logic so that when
  the
  server starts I can execute some database scripts using my DAO service
  layer. And this class is responsible loading some required variables
 from
  the database. The class should execute only one on the start up.
 
  Please give me some suggestions how to do this. If possible write some
  sample code.
 
  Thanks,
  Sameer
  --
  View this message in context:
 
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p28995322.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

 --
 View this message in context:
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p29154226.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Currency Formatting

2010-07-13 Thread Chris Miles

At the moment I have in my struts.xml

constant name=struts.custom.i18n.resources value=ApplicationResources 
/


ApplicationResources.properties is being packaged within WEB-INF\classes 
within a WAR within an EAR.


The file contains: format.currency={0,number,currency}

In my JSP I have s:text name=format.currencys:property 
value=product.price//s:text


Without the s:text the price is displayed (a Double).

When the s:text is included all I get is: {0}

thanks

Chris
- Original Message - 
From: Chris Pratt thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Sunday, July 11, 2010 1:25 AM
Subject: Re: Currency Formatting



Define something like:

format.currency={0,number,currency}

In your applications.properties file, then use:

s:text name=format.currencys:param value=%{amount}//s:text

HTH
 (*Chris*)

On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org wrote:


Hi

If I am displaying a Double to a JSP page what is the recommended way to
format this is as a currency to two decimal points?

Thanks

Chris





-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Currency Formatting

2010-07-13 Thread Chris Pratt
try s:param instead of s:property.
  (*Chris*)

On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org wrote:

 At the moment I have in my struts.xml

 constant name=struts.custom.i18n.resources value=ApplicationResources
 /

 ApplicationResources.properties is being packaged within WEB-INF\classes
 within a WAR within an EAR.

 The file contains: format.currency={0,number,currency}

 In my JSP I have s:text name=format.currencys:property
 value=product.price//s:text

 Without the s:text the price is displayed (a Double).

 When the s:text is included all I get is: {0}

 thanks

 Chris
 - Original Message - From: Chris Pratt thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Sunday, July 11, 2010 1:25 AM
 Subject: Re: Currency Formatting



  Define something like:

 format.currency={0,number,currency}

 In your applications.properties file, then use:

 s:text name=format.currencys:param value=%{amount}//s:text

 HTH
  (*Chris*)

 On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org
 wrote:

  Hi

 If I am displaying a Double to a JSP page what is the recommended way to
 format this is as a currency to two decimal points?

 Thanks

 Chris




 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: How to modify Struts2 start up process.

2010-07-13 Thread hisameer

So basically you are saying is that remove scope=singleton  right?


Chris Pratt wrote:
 
 It's being called twice because, since you defined it as scope=singleton,
 Spring is creating a singleton instance for you automatically on start-up.
 Then your code is creating another instance in your getStartupService()
 method.  You don't need to explicitly instantiate one, just let Spring
 inject it where you need it.
   (*Chris*)
 
 On Tue, Jul 13, 2010 at 11:42 AM, hisameer
 cool_sameer_fo...@yahoo.comwrote:
 

 Thanks for the suggestion. I have implemented it, but the issue is that
 the
 bean is called twice.I am using websphere server 6.1. Do you have any
 idea
 why its happening?

 Here is the code in ApplicationContext.xml

 bean id=initBean class=com.singleton.startup.service.StartUPService
 scope=singleton init-method=init
property name=flag value=true /
property name=days value=15 /
/bean


 and StartUPService.java class looks like this:
 public class StartUPService implements ApplicationContextAware {

private static StartUPService ref;

private ApplicationContext ctx;

private static Logger logger =
 Logger.getLogger(StartUPService.class);

private boolean flag= true;

private ServiceDAO dao;

private int days= 15;

private StartUPService() {
// no code req'd
}

public static StartUPService getStartUPService() {

if (ref == null) {
// it's ok, we can call this constructor
ref = new StartUPService();
}
return ref;
}

public void init() {

if (ref == null) {
// it's ok, we can call this constructor
ref = new StartUPService();
long startTime = System.currentTimeMillis();
loadRequiredObject();
long endTime = System.currentTimeMillis();
logger.info(The Total time taken is:  + (endTime
 - startTime)
+  ms);
}

}

  private void loadRequiredObject(){
   if (dao== null) {
dao= (ServiceDAO) ctx.getBean(daoBean);
}
   //here I will do some processing using the database access using
 dao
 service layer
 }


 satyanarayana katta wrote:
 
  Using the application level spring container would be sufficient with
 init
  method set.
 
  Sent from my iPhone
 
  On Jun 25, 2010, at 11:36 AM, hisameer cool_sameer_fo...@yahoo.com
  wrote:
 
 
  Hi,
 
  I am using Struts2.1.6+Spring2.5.6+Hibernate+JPA in my web
 application.
  The
  application server is JBOSS5. I have to implement a logic so that when
  the
  server starts I can execute some database scripts using my DAO service
  layer. And this class is responsible loading some required variables
 from
  the database. The class should execute only one on the start up.
 
  Please give me some suggestions how to do this. If possible write some
  sample code.
 
  Thanks,
  Sameer
  --
  View this message in context:
 
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p28995322.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

 --
 View this message in context:
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p29154226.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


 
 

-- 
View this message in context: 
http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p29154837.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: How to modify Struts2 start up process.

2010-07-13 Thread Chris Pratt
Umm, no I'm saying let Spring manage the singleton, you don't need to do it
yourself.  Especially since the original question was how to have it created
at initialization time.  If you remove scope=prototype, it won't be
auto-created for you, and you will have defeated the whole point.
  (*Chris*)

On Tue, Jul 13, 2010 at 12:36 PM, hisameer cool_sameer_fo...@yahoo.comwrote:


 So basically you are saying is that remove scope=singleton  right?


 Chris Pratt wrote:
 
  It's being called twice because, since you defined it as scope=singleton,
  Spring is creating a singleton instance for you automatically on
 start-up.
  Then your code is creating another instance in your getStartupService()
  method.  You don't need to explicitly instantiate one, just let Spring
  inject it where you need it.
(*Chris*)
 
  On Tue, Jul 13, 2010 at 11:42 AM, hisameer
  cool_sameer_fo...@yahoo.comwrote:
 
 
  Thanks for the suggestion. I have implemented it, but the issue is that
  the
  bean is called twice.I am using websphere server 6.1. Do you have any
  idea
  why its happening?
 
  Here is the code in ApplicationContext.xml
 
  bean id=initBean class=com.singleton.startup.service.StartUPService
  scope=singleton init-method=init
 property name=flag value=true /
 property name=days value=15 /
 /bean
 
 
  and StartUPService.java class looks like this:
  public class StartUPService implements ApplicationContextAware {
 
 private static StartUPService ref;
 
 private ApplicationContext ctx;
 
 private static Logger logger =
  Logger.getLogger(StartUPService.class);
 
 private boolean flag= true;
 
 private ServiceDAO dao;
 
 private int days= 15;
 
 private StartUPService() {
 // no code req'd
 }
 
 public static StartUPService getStartUPService() {
 
 if (ref == null) {
 // it's ok, we can call this constructor
 ref = new StartUPService();
 }
 return ref;
 }
 
 public void init() {
 
 if (ref == null) {
 // it's ok, we can call this constructor
 ref = new StartUPService();
 long startTime = System.currentTimeMillis();
 loadRequiredObject();
 long endTime = System.currentTimeMillis();
 logger.info(The Total time taken is:  +
 (endTime
  - startTime)
 +  ms);
 }
 
 }
 
   private void loadRequiredObject(){
if (dao== null) {
 dao= (ServiceDAO) ctx.getBean(daoBean);
 }
//here I will do some processing using the database access using
  dao
  service layer
  }
 
 
  satyanarayana katta wrote:
  
   Using the application level spring container would be sufficient with
  init
   method set.
  
   Sent from my iPhone
  
   On Jun 25, 2010, at 11:36 AM, hisameer cool_sameer_fo...@yahoo.com
   wrote:
  
  
   Hi,
  
   I am using Struts2.1.6+Spring2.5.6+Hibernate+JPA in my web
  application.
   The
   application server is JBOSS5. I have to implement a logic so that
 when
   the
   server starts I can execute some database scripts using my DAO
 service
   layer. And this class is responsible loading some required variables
  from
   the database. The class should execute only one on the start up.
  
   Please give me some suggestions how to do this. If possible write
 some
   sample code.
  
   Thanks,
   Sameer
   --
   View this message in context:
  
 
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p28995322.html
   Sent from the Struts - User mailing list archive at Nabble.com.
  
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
  
 
  --
  View this message in context:
 
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p29154226.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 

 --
 View this message in context:
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p29154837.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: 

Problem with using json plugin

2010-07-13 Thread JP Cafaro
I was trying to use the json plugin that's bundled with struts but I'm 
running into a few snags.  Firstly, I like using annotations whenever 
possible so this is what my struts.xml looks like:


struts
   constant name=struts.devMode value=true /
  
   !--  Declare global results in this package --
   package name=my-default extends=json-default   
   global-results
   result name=login 
type=redirect/authenticate/login-page/result

   result name=error/error/error.html/result
   /global-results

   global-exception-mappings
   exception-mapping exception=java.lang.Exception
   result=error /
   /global-exception-mappings
   /package

   !-- Secure results use this package --
   package name=my-secure extends=my-default
   interceptors
   interceptor name=authenticationInterceptor 
class=interceptors.AuthenticationInterceptor /

   interceptor-stack name=secureStack
   interceptor-ref name=authenticationInterceptor /
   interceptor-ref name=defaultStack /
   /interceptor-stack
   /interceptors
   default-interceptor-ref name=secureStack /
   /package
/struts

You'll notice that my main package, extends json-default.  I did this 
because a) I assume json-default extended struts-default and b) Since I 
want to use annotations I don't want to have to make a whole package for 
the few actions that are going to be serialized. 


Then in my action class I have this:

@Result(name=success,type=json)

That way, this is the only class that will serialize.

I'm getting a weird error though when I start up my server:
Caused by: Unable to locate parent package [my-secure] - [unknown location]

my-secure is the name of the other package.  If I go back to not using 
json-default, and just extend struts-default in my-default, it works.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Where to find struts.xml documentation

2010-07-13 Thread Ken
I am looking for documentation for the struts.xml configuration file.
Are there different tags for different versions of struts.xml?
I'm using struts 2.1.8.1





Re: How to modify Struts2 start up process.

2010-07-13 Thread hisameer

Thanks for the input. The default scope is Singleton anyway. Also I am not
calling getStartUPService() method in my application. I have deleted this
method. But keeping the scope to singleton and init-method=init. The init
method is called twice. Not able to figure that out. 

I know something is messed up. It should not be doing that. But I am not
able to figure that out. I hope you understand my confusion.

Sameer.


 

Chris Pratt wrote:
 
 Umm, no I'm saying let Spring manage the singleton, you don't need to do
 it
 yourself.  Especially since the original question was how to have it
 created
 at initialization time.  If you remove scope=prototype, it won't be
 auto-created for you, and you will have defeated the whole point.
   (*Chris*)
 
 On Tue, Jul 13, 2010 at 12:36 PM, hisameer
 cool_sameer_fo...@yahoo.comwrote:
 

 So basically you are saying is that remove scope=singleton  right?


 Chris Pratt wrote:
 
  It's being called twice because, since you defined it as
 scope=singleton,
  Spring is creating a singleton instance for you automatically on
 start-up.
  Then your code is creating another instance in your getStartupService()
  method.  You don't need to explicitly instantiate one, just let Spring
  inject it where you need it.
(*Chris*)
 
  On Tue, Jul 13, 2010 at 11:42 AM, hisameer
  cool_sameer_fo...@yahoo.comwrote:
 
 
  Thanks for the suggestion. I have implemented it, but the issue is
 that
  the
  bean is called twice.I am using websphere server 6.1. Do you have any
  idea
  why its happening?
 
  Here is the code in ApplicationContext.xml
 
  bean id=initBean
 class=com.singleton.startup.service.StartUPService
  scope=singleton init-method=init
 property name=flag value=true /
 property name=days value=15 /
 /bean
 
 
  and StartUPService.java class looks like this:
  public class StartUPService implements ApplicationContextAware {
 
 private static StartUPService ref;
 
 private ApplicationContext ctx;
 
 private static Logger logger =
  Logger.getLogger(StartUPService.class);
 
 private boolean flag= true;
 
 private ServiceDAO dao;
 
 private int days= 15;
 
 private StartUPService() {
 // no code req'd
 }
 
 public static StartUPService getStartUPService() {
 
 if (ref == null) {
 // it's ok, we can call this constructor
 ref = new StartUPService();
 }
 return ref;
 }
 
 public void init() {
 
 if (ref == null) {
 // it's ok, we can call this constructor
 ref = new StartUPService();
 long startTime = System.currentTimeMillis();
 loadRequiredObject();
 long endTime = System.currentTimeMillis();
 logger.info(The Total time taken is:  +
 (endTime
  - startTime)
 +  ms);
 }
 
 }
 
   private void loadRequiredObject(){
if (dao== null) {
 dao= (ServiceDAO) ctx.getBean(daoBean);
 }
//here I will do some processing using the database access using
  dao
  service layer
  }
 
 
  satyanarayana katta wrote:
  
   Using the application level spring container would be sufficient
 with
  init
   method set.
  
   Sent from my iPhone
  
   On Jun 25, 2010, at 11:36 AM, hisameer cool_sameer_fo...@yahoo.com
   wrote:
  
  
   Hi,
  
   I am using Struts2.1.6+Spring2.5.6+Hibernate+JPA in my web
  application.
   The
   application server is JBOSS5. I have to implement a logic so that
 when
   the
   server starts I can execute some database scripts using my DAO
 service
   layer. And this class is responsible loading some required
 variables
  from
   the database. The class should execute only one on the start up.
  
   Please give me some suggestions how to do this. If possible write
 some
   sample code.
  
   Thanks,
   Sameer
   --
   View this message in context:
  
 
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p28995322.html
   Sent from the Struts - User mailing list archive at Nabble.com.
  
  
  
 -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
  
 -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
  
 
  --
  View this message in context:
 
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p29154226.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  

Re: How to modify Struts2 start up process.

2010-07-13 Thread Chris Pratt
One thing I find odd is that you're creating a static reference to an
instance of your class, from an instance of your class, why?  Spring has
already created and is managing an instance for you, there's no reason to
instantiate a second singleton instance (kinda defeats the whole singleton
thing anyway).
  (*Chris*)

On Tue, Jul 13, 2010 at 2:25 PM, hisameer cool_sameer_fo...@yahoo.comwrote:


 Thanks for the input. The default scope is Singleton anyway. Also I am not
 calling getStartUPService() method in my application. I have deleted this
 method. But keeping the scope to singleton and init-method=init. The init
 method is called twice. Not able to figure that out.

 I know something is messed up. It should not be doing that. But I am not
 able to figure that out. I hope you understand my confusion.

 Sameer.




 Chris Pratt wrote:
 
  Umm, no I'm saying let Spring manage the singleton, you don't need to do
  it
  yourself.  Especially since the original question was how to have it
  created
  at initialization time.  If you remove scope=prototype, it won't be
  auto-created for you, and you will have defeated the whole point.
(*Chris*)
 
  On Tue, Jul 13, 2010 at 12:36 PM, hisameer
  cool_sameer_fo...@yahoo.comwrote:
 
 
  So basically you are saying is that remove scope=singleton  right?
 
 
  Chris Pratt wrote:
  
   It's being called twice because, since you defined it as
  scope=singleton,
   Spring is creating a singleton instance for you automatically on
  start-up.
   Then your code is creating another instance in your
 getStartupService()
   method.  You don't need to explicitly instantiate one, just let Spring
   inject it where you need it.
 (*Chris*)
  
   On Tue, Jul 13, 2010 at 11:42 AM, hisameer
   cool_sameer_fo...@yahoo.comwrote:
  
  
   Thanks for the suggestion. I have implemented it, but the issue is
  that
   the
   bean is called twice.I am using websphere server 6.1. Do you have any
   idea
   why its happening?
  
   Here is the code in ApplicationContext.xml
  
   bean id=initBean
  class=com.singleton.startup.service.StartUPService
   scope=singleton init-method=init
  property name=flag value=true /
  property name=days value=15 /
  /bean
  
  
   and StartUPService.java class looks like this:
   public class StartUPService implements ApplicationContextAware {
  
  private static StartUPService ref;
  
  private ApplicationContext ctx;
  
  private static Logger logger =
   Logger.getLogger(StartUPService.class);
  
  private boolean flag= true;
  
  private ServiceDAO dao;
  
  private int days= 15;
  
  private StartUPService() {
  // no code req'd
  }
  
  public static StartUPService getStartUPService() {
  
  if (ref == null) {
  // it's ok, we can call this constructor
  ref = new StartUPService();
  }
  return ref;
  }
  
  public void init() {
  
  if (ref == null) {
  // it's ok, we can call this constructor
  ref = new StartUPService();
  long startTime = System.currentTimeMillis();
  loadRequiredObject();
  long endTime = System.currentTimeMillis();
  logger.info(The Total time taken is:  +
  (endTime
   - startTime)
  +  ms);
  }
  
  }
  
private void loadRequiredObject(){
 if (dao== null) {
  dao= (ServiceDAO) ctx.getBean(daoBean);
  }
 //here I will do some processing using the database access
 using
   dao
   service layer
   }
  
  
   satyanarayana katta wrote:
   
Using the application level spring container would be sufficient
  with
   init
method set.
   
Sent from my iPhone
   
On Jun 25, 2010, at 11:36 AM, hisameer 
 cool_sameer_fo...@yahoo.com
wrote:
   
   
Hi,
   
I am using Struts2.1.6+Spring2.5.6+Hibernate+JPA in my web
   application.
The
application server is JBOSS5. I have to implement a logic so that
  when
the
server starts I can execute some database scripts using my DAO
  service
layer. And this class is responsible loading some required
  variables
   from
the database. The class should execute only one on the start up.
   
Please give me some suggestions how to do this. If possible write
  some
sample code.
   
Thanks,
Sameer
--
View this message in context:
   
  
 
 http://old.nabble.com/How-to-modify-Struts2-start-up-process.-tp28995322p28995322.html
Sent from the Struts - User mailing list archive at Nabble.com.
   
   
   
  -
To unsubscribe, e-mail: 

Re: Currency Formatting

2010-07-13 Thread Chris Miles

Chris,

Hi that works perfectly for

s:text name=format.currencys:param value=total//s:text

where total is public Double getTotal

but causes all rendering to stop at the following within an iterator.

s:text name=format.currencys:param value=#product.price/

where ListProduct getProducts (for the iterator), public Product 
getProduct and public Double getPrice


and also fails just on

s:text name=format.currencys:param value=product.price//s:text

where public Product getProduct

Is there places where different mechanisms need to be used here? I dont 
understand the inconstistant result I now get.


Nothing in the log files on TRACE

Thanks

Chris
- Original Message - 
From: Chris Pratt thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 8:16 PM
Subject: Re: Currency Formatting



try s:param instead of s:property.
 (*Chris*)

On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org 
wrote:



At the moment I have in my struts.xml

constant name=struts.custom.i18n.resources 
value=ApplicationResources

/

ApplicationResources.properties is being packaged within WEB-INF\classes
within a WAR within an EAR.

The file contains: format.currency={0,number,currency}

In my JSP I have s:text name=format.currencys:property
value=product.price//s:text

Without the s:text the price is displayed (a Double).

When the s:text is included all I get is: {0}

thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Sunday, July 11, 2010 1:25 AM
Subject: Re: Currency Formatting



 Define something like:


format.currency={0,number,currency}

In your applications.properties file, then use:

s:text name=format.currencys:param value=%{amount}//s:text

HTH
 (*Chris*)

On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org
wrote:

 Hi


If I am displaying a Double to a JSP page what is the recommended way 
to

format this is as a currency to two decimal points?

Thanks

Chris






-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org







-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Currency Formatting

2010-07-13 Thread Chris Pratt
s:iterator puts the value on the top of the stack, so if you have a list
of doubles, we'll call it amounts, it would look something like this:

s:iterator value=%{amounts}
  s:text name=format.currencys:param value=%{top}//s:text
/s:iterator

  (*Chris*)

On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote:

 Chris,

 Hi that works perfectly for

 s:text name=format.currencys:param value=total//s:text

 where total is public Double getTotal

 but causes all rendering to stop at the following within an iterator.

 s:text name=format.currencys:param value=#product.price/

 where ListProduct getProducts (for the iterator), public Product
 getProduct and public Double getPrice

 and also fails just on

 s:text name=format.currencys:param value=product.price//s:text

 where public Product getProduct

 Is there places where different mechanisms need to be used here? I dont
 understand the inconstistant result I now get.

 Nothing in the log files on TRACE


 Thanks

 Chris
 - Original Message - From: Chris Pratt thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 8:16 PM
 Subject: Re: Currency Formatting



  try s:param instead of s:property.
  (*Chris*)

 On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org
 wrote:

  At the moment I have in my struts.xml

 constant name=struts.custom.i18n.resources
 value=ApplicationResources
 /

 ApplicationResources.properties is being packaged within WEB-INF\classes
 within a WAR within an EAR.

 The file contains: format.currency={0,number,currency}

 In my JSP I have s:text name=format.currencys:property
 value=product.price//s:text

 Without the s:text the price is displayed (a Double).

 When the s:text is included all I get is: {0}

 thanks

 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Sunday, July 11, 2010 1:25 AM
 Subject: Re: Currency Formatting



  Define something like:


 format.currency={0,number,currency}

 In your applications.properties file, then use:

 s:text name=format.currencys:param value=%{amount}//s:text

 HTH
  (*Chris*)

 On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org
 wrote:

  Hi


 If I am displaying a Double to a JSP page what is the recommended way
 to
 format this is as a currency to two decimal points?

 Thanks

 Chris




 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Finding out version of Struts2 by introspecting the struts2-core jar

2010-07-13 Thread Rohan Ranade
Hi all,

I want to find out the version of Struts2 (2.0.x or 2.1.x) by introspecting
the struts2 core jar file. Is there a class which can be introspected to
find this out? (similar to
http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/core/SpringVersion.htmlin
Spring)? Having looked at the struts2 core jar, I see that
core-jar/META-INF/maven/org.apache.struts/struts2-core/pom.properties
contains a version property. Is this a reliable way to check the version of
Struts2?

Can someone advise if there is a better way to do this?

Thanks and Regards,
Rohan


Re: Currency Formatting

2010-07-13 Thread Chris Miles

Chris,

I have a list of products which contain a double price.

I now have.

s:iterator value=products var=product
   span class=product-names:property value=#product.name//span
   span class=product-pricepound;s:text 
name=format.currencys:param value=#product.price//s:text/span

/s:iterator

Chris
- Original Message - 
From: Chris Pratt thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 11:04 PM
Subject: Re: Currency Formatting



s:iterator puts the value on the top of the stack, so if you have a list
of doubles, we'll call it amounts, it would look something like this:

s:iterator value=%{amounts}
 s:text name=format.currencys:param value=%{top}//s:text
/s:iterator

 (*Chris*)

On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org wrote:


Chris,

Hi that works perfectly for

s:text name=format.currencys:param value=total//s:text

where total is public Double getTotal

but causes all rendering to stop at the following within an iterator.

s:text name=format.currencys:param value=#product.price/

where ListProduct getProducts (for the iterator), public Product
getProduct and public Double getPrice

and also fails just on

s:text name=format.currencys:param value=product.price//s:text

where public Product getProduct

Is there places where different mechanisms need to be used here? I dont
understand the inconstistant result I now get.

Nothing in the log files on TRACE


Thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 8:16 PM
Subject: Re: Currency Formatting



 try s:param instead of s:property.

 (*Chris*)

On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org
wrote:

 At the moment I have in my struts.xml


constant name=struts.custom.i18n.resources
value=ApplicationResources
/

ApplicationResources.properties is being packaged within 
WEB-INF\classes

within a WAR within an EAR.

The file contains: format.currency={0,number,currency}

In my JSP I have s:text name=format.currencys:property
value=product.price//s:text

Without the s:text the price is displayed (a Double).

When the s:text is included all I get is: {0}

thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Sunday, July 11, 2010 1:25 AM
Subject: Re: Currency Formatting



 Define something like:



format.currency={0,number,currency}

In your applications.properties file, then use:

s:text name=format.currencys:param value=%{amount}//s:text

HTH
 (*Chris*)

On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org
wrote:

 Hi



If I am displaying a Double to a JSP page what is the recommended way
to
format this is as a currency to two decimal points?

Thanks

Chris






-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org







-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org







-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Currency Formatting

2010-07-13 Thread Chris Pratt
I've never used the iterator tag like that, the standard way to use the
Struts 2 Iterator would be:

s:iterator value=products
  span class=product-names:property value=name http://product.name/
//span
  span class=product-pricepound;s:text name=format.currencys:param
value=price//s:text/span
/s:iterator

Since the iterator tag puts the current value on the top of the stack,
there's no reason to define a variable to hold it.  It's much simpler to
just use the value stack to pull the values from.  Don't know if this might
help or not.
  (*Chris*)

On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote:

 Chris,

 I have a list of products which contain a double price.

 I now have.

 s:iterator value=products var=product
   span class=product-names:property value=#product.name//span
   span class=product-pricepound;s:text
 name=format.currencys:param value=#product.price//s:text/span
 /s:iterator


 Chris
 - Original Message - From: Chris Pratt thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 11:04 PM

 Subject: Re: Currency Formatting


  s:iterator puts the value on the top of the stack, so if you have a list
 of doubles, we'll call it amounts, it would look something like this:

 s:iterator value=%{amounts}
  s:text name=format.currencys:param value=%{top}//s:text
 /s:iterator

  (*Chris*)

 On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org
 wrote:

  Chris,

 Hi that works perfectly for

 s:text name=format.currencys:param value=total//s:text

 where total is public Double getTotal

 but causes all rendering to stop at the following within an iterator.

 s:text name=format.currencys:param value=#product.price/

 where ListProduct getProducts (for the iterator), public Product
 getProduct and public Double getPrice

 and also fails just on

 s:text name=format.currencys:param value=product.price//s:text

 where public Product getProduct

 Is there places where different mechanisms need to be used here? I dont
 understand the inconstistant result I now get.

 Nothing in the log files on TRACE


 Thanks

 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 8:16 PM
 Subject: Re: Currency Formatting



  try s:param instead of s:property.

  (*Chris*)

 On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org
 wrote:

  At the moment I have in my struts.xml


 constant name=struts.custom.i18n.resources
 value=ApplicationResources
 /

 ApplicationResources.properties is being packaged within
 WEB-INF\classes
 within a WAR within an EAR.

 The file contains: format.currency={0,number,currency}

 In my JSP I have s:text name=format.currencys:property
 value=product.price//s:text

 Without the s:text the price is displayed (a Double).

 When the s:text is included all I get is: {0}

 thanks

 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Sunday, July 11, 2010 1:25 AM
 Subject: Re: Currency Formatting



  Define something like:


 format.currency={0,number,currency}

 In your applications.properties file, then use:

 s:text name=format.currencys:param value=%{amount}//s:text

 HTH
  (*Chris*)

 On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org
 wrote:

  Hi


 If I am displaying a Double to a JSP page what is the recommended way
 to
 format this is as a currency to two decimal points?

 Thanks

 Chris




  -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Currency Formatting

2010-07-13 Thread Chris Miles
Thanks Chris. The reason I use this method in my iterators is there are a 
few places where I use nested iterators so the # notation is the only way to 
access the current iterator but also the parent iterator.


This specific iterator is not nested so I have changed it for learning and 
trial sake and it fails with the line


span class=product-prices:text name=format.currencys:param 
value=price//s:text/span


I can put

span class=product-prices:property value=price//span

and it displays the value fine.

Chris

- Original Message - 
From: Chris Pratt thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 11:28 PM
Subject: Re: Currency Formatting



I've never used the iterator tag like that, the standard way to use the
Struts 2 Iterator would be:

s:iterator value=products
 span class=product-names:property value=name http://product.name/
//span
 span class=product-pricepound;s:text 
name=format.currencys:param

value=price//s:text/span
/s:iterator

Since the iterator tag puts the current value on the top of the stack,
there's no reason to define a variable to hold it.  It's much simpler to
just use the value stack to pull the values from.  Don't know if this 
might

help or not.
 (*Chris*)

On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org wrote:


Chris,

I have a list of products which contain a double price.

I now have.

s:iterator value=products var=product
  span class=product-names:property value=#product.name//span
  span class=product-pricepound;s:text
name=format.currencys:param value=#product.price//s:text/span
/s:iterator


Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 11:04 PM

Subject: Re: Currency Formatting


 s:iterator puts the value on the top of the stack, so if you have a 
list

of doubles, we'll call it amounts, it would look something like this:

s:iterator value=%{amounts}
 s:text name=format.currencys:param value=%{top}//s:text
/s:iterator

 (*Chris*)

On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org
wrote:

 Chris,


Hi that works perfectly for

s:text name=format.currencys:param value=total//s:text

where total is public Double getTotal

but causes all rendering to stop at the following within an iterator.

s:text name=format.currencys:param value=#product.price/

where ListProduct getProducts (for the iterator), public Product
getProduct and public Double getPrice

and also fails just on

s:text name=format.currencys:param 
value=product.price//s:text


where public Product getProduct

Is there places where different mechanisms need to be used here? I dont
understand the inconstistant result I now get.

Nothing in the log files on TRACE


Thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 8:16 PM
Subject: Re: Currency Formatting



 try s:param instead of s:property.


 (*Chris*)

On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org
wrote:

 At the moment I have in my struts.xml



constant name=struts.custom.i18n.resources
value=ApplicationResources
/

ApplicationResources.properties is being packaged within
WEB-INF\classes
within a WAR within an EAR.

The file contains: format.currency={0,number,currency}

In my JSP I have s:text name=format.currencys:property
value=product.price//s:text

Without the s:text the price is displayed (a Double).

When the s:text is included all I get is: {0}

thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Sunday, July 11, 2010 1:25 AM
Subject: Re: Currency Formatting



 Define something like:



format.currency={0,number,currency}

In your applications.properties file, then use:

s:text name=format.currencys:param value=%{amount}//s:text

HTH
 (*Chris*)

On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org
wrote:

 Hi


If I am displaying a Double to a JSP page what is the recommended 
way

to
format this is as a currency to two decimal points?

Thanks

Chris





 -

To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org







-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org







-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org







-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, 

Re: Currency Formatting

2010-07-13 Thread Chris Pratt
Define fails, you get a stack trace? you don't get the output you
expected?  If so, what were you expecting vs. what did you get? I've used
that code a thousand times, so I'm not sure what could be going wrong...
  (*Chris*)

On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote:

 Thanks Chris. The reason I use this method in my iterators is there are a
 few places where I use nested iterators so the # notation is the only way to
 access the current iterator but also the parent iterator.

 This specific iterator is not nested so I have changed it for learning and
 trial sake and it fails with the line

 span class=product-prices:text name=format.currencys:param
 value=price//s:text/span

 I can put

 span class=product-prices:property value=price//span

 and it displays the value fine.


 Chris

 - Original Message - From: Chris Pratt thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 11:28 PM
 Subject: Re: Currency Formatting


  I've never used the iterator tag like that, the standard way to use the
 Struts 2 Iterator would be:

 s:iterator value=products
  span class=product-names:property value=name http://product.name/
 

 //span
  span class=product-pricepound;s:text
 name=format.currencys:param
 value=price//s:text/span
 /s:iterator

 Since the iterator tag puts the current value on the top of the stack,
 there's no reason to define a variable to hold it.  It's much simpler to
 just use the value stack to pull the values from.  Don't know if this
 might
 help or not.
  (*Chris*)

 On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org
 wrote:

  Chris,

 I have a list of products which contain a double price.

 I now have.

 s:iterator value=products var=product
  span class=product-names:property value=#product.name//span
  span class=product-pricepound;s:text
 name=format.currencys:param value=#product.price//s:text/span
 /s:iterator


 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 11:04 PM

 Subject: Re: Currency Formatting


  s:iterator puts the value on the top of the stack, so if you have a
 list

 of doubles, we'll call it amounts, it would look something like this:

 s:iterator value=%{amounts}
  s:text name=format.currencys:param value=%{top}//s:text
 /s:iterator

  (*Chris*)

 On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org
 wrote:

  Chris,


 Hi that works perfectly for

 s:text name=format.currencys:param value=total//s:text

 where total is public Double getTotal

 but causes all rendering to stop at the following within an iterator.

 s:text name=format.currencys:param value=#product.price/

 where ListProduct getProducts (for the iterator), public Product
 getProduct and public Double getPrice

 and also fails just on

 s:text name=format.currencys:param
 value=product.price//s:text

 where public Product getProduct

 Is there places where different mechanisms need to be used here? I dont
 understand the inconstistant result I now get.

 Nothing in the log files on TRACE


 Thanks

 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 8:16 PM
 Subject: Re: Currency Formatting



  try s:param instead of s:property.

   (*Chris*)

 On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org
 wrote:

  At the moment I have in my struts.xml


 constant name=struts.custom.i18n.resources
 value=ApplicationResources
 /

 ApplicationResources.properties is being packaged within
 WEB-INF\classes
 within a WAR within an EAR.

 The file contains: format.currency={0,number,currency}

 In my JSP I have s:text name=format.currencys:property
 value=product.price//s:text

 Without the s:text the price is displayed (a Double).

 When the s:text is included all I get is: {0}

 thanks

 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Sunday, July 11, 2010 1:25 AM
 Subject: Re: Currency Formatting



  Define something like:


  format.currency={0,number,currency}

 In your applications.properties file, then use:

 s:text name=format.currencys:param value=%{amount}//s:text

 HTH
  (*Chris*)

 On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles ch...@chrismiles.org
 wrote:

  Hi


  If I am displaying a Double to a JSP page what is the recommended
 way
 to
 format this is as a currency to two decimal points?

 Thanks

 Chris





  -

 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





  -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional 

Re: Currency Formatting

2010-07-13 Thread Chris Miles

HTML rendering just completely stops at that point. I get the following:

span class=product-nameThis is a product name/span
span class=product-price

And nothing else for the rest of the page. Nothing in the logs. Nothing :)

Chris
- Original Message - 
From: Chris Pratt thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, July 14, 2010 12:03 AM
Subject: Re: Currency Formatting



Define fails, you get a stack trace? you don't get the output you
expected?  If so, what were you expecting vs. what did you get? I've used
that code a thousand times, so I'm not sure what could be going wrong...
 (*Chris*)

On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org wrote:


Thanks Chris. The reason I use this method in my iterators is there are a
few places where I use nested iterators so the # notation is the only way 
to

access the current iterator but also the parent iterator.

This specific iterator is not nested so I have changed it for learning 
and

trial sake and it fails with the line

span class=product-prices:text name=format.currencys:param
value=price//s:text/span

I can put

span class=product-prices:property value=price//span

and it displays the value fine.


Chris

- Original Message - From: Chris Pratt 
thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 11:28 PM
Subject: Re: Currency Formatting


 I've never used the iterator tag like that, the standard way to use the

Struts 2 Iterator would be:

s:iterator value=products
 span class=product-names:property value=name 
http://product.name/



//span
 span class=product-pricepound;s:text
name=format.currencys:param
value=price//s:text/span
/s:iterator

Since the iterator tag puts the current value on the top of the stack,
there's no reason to define a variable to hold it.  It's much simpler to
just use the value stack to pull the values from.  Don't know if this
might
help or not.
 (*Chris*)

On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org
wrote:

 Chris,


I have a list of products which contain a double price.

I now have.

s:iterator value=products var=product
 span class=product-names:property value=#product.name//span
 span class=product-pricepound;s:text
name=format.currencys:param 
value=#product.price//s:text/span

/s:iterator


Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 11:04 PM

Subject: Re: Currency Formatting


 s:iterator puts the value on the top of the stack, so if you have a
list


of doubles, we'll call it amounts, it would look something like this:

s:iterator value=%{amounts}
 s:text name=format.currencys:param value=%{top}//s:text
/s:iterator

 (*Chris*)

On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org
wrote:

 Chris,



Hi that works perfectly for

s:text name=format.currencys:param value=total//s:text

where total is public Double getTotal

but causes all rendering to stop at the following within an iterator.

s:text name=format.currencys:param value=#product.price/

where ListProduct getProducts (for the iterator), public Product
getProduct and public Double getPrice

and also fails just on

s:text name=format.currencys:param
value=product.price//s:text

where public Product getProduct

Is there places where different mechanisms need to be used here? I 
dont

understand the inconstistant result I now get.

Nothing in the log files on TRACE


Thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 8:16 PM
Subject: Re: Currency Formatting



 try s:param instead of s:property.

  (*Chris*)


On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org
wrote:

 At the moment I have in my struts.xml



constant name=struts.custom.i18n.resources
value=ApplicationResources
/

ApplicationResources.properties is being packaged within
WEB-INF\classes
within a WAR within an EAR.

The file contains: format.currency={0,number,currency}

In my JSP I have s:text name=format.currencys:property
value=product.price//s:text

Without the s:text the price is displayed (a Double).

When the s:text is included all I get is: {0}

thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Sunday, July 11, 2010 1:25 AM
Subject: Re: Currency Formatting



 Define something like:


 format.currency={0,number,currency}


In your applications.properties file, then use:

s:text name=format.currencys:param 
value=%{amount}//s:text


HTH
 (*Chris*)

On Sat, Jul 10, 2010 at 5:53 AM, Chris Miles 
ch...@chrismiles.org

wrote:

 Hi


 If I am displaying a Double to a JSP page what is the recommended

way
to
format this is as a currency to two decimal points?

Thanks

Chris






 

Re: Currency Formatting

2010-07-13 Thread Chris Pratt
That's weird I've never experienced anything like that were rendering stops
without putting anything into the logs.  Looks like you'll have to dig into
the code.
  (*Chris*)

On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote:

 HTML rendering just completely stops at that point. I get the following:

 span class=product-nameThis is a product name/span
 span class=product-price

 And nothing else for the rest of the page. Nothing in the logs. Nothing :)


 Chris
 - Original Message - From: Chris Pratt thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Wednesday, July 14, 2010 12:03 AM

 Subject: Re: Currency Formatting


  Define fails, you get a stack trace? you don't get the output you
 expected?  If so, what were you expecting vs. what did you get? I've used
 that code a thousand times, so I'm not sure what could be going wrong...
  (*Chris*)

 On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org
 wrote:

  Thanks Chris. The reason I use this method in my iterators is there are a
 few places where I use nested iterators so the # notation is the only way
 to
 access the current iterator but also the parent iterator.

 This specific iterator is not nested so I have changed it for learning
 and
 trial sake and it fails with the line

 span class=product-prices:text name=format.currencys:param
 value=price//s:text/span

 I can put

 span class=product-prices:property value=price//span

 and it displays the value fine.


 Chris

 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 11:28 PM
 Subject: Re: Currency Formatting


  I've never used the iterator tag like that, the standard way to use the

 Struts 2 Iterator would be:

 s:iterator value=products
  span class=product-names:property value=name 
 http://product.name/
 

 //span
  span class=product-pricepound;s:text
 name=format.currencys:param
 value=price//s:text/span
 /s:iterator

 Since the iterator tag puts the current value on the top of the stack,
 there's no reason to define a variable to hold it.  It's much simpler to
 just use the value stack to pull the values from.  Don't know if this
 might
 help or not.
  (*Chris*)

 On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org
 wrote:

  Chris,


 I have a list of products which contain a double price.

 I now have.

 s:iterator value=products var=product
  span class=product-names:property value=#product.name//span
  span class=product-pricepound;s:text
 name=format.currencys:param
 value=#product.price//s:text/span
 /s:iterator


 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 11:04 PM

 Subject: Re: Currency Formatting


  s:iterator puts the value on the top of the stack, so if you have a
 list

  of doubles, we'll call it amounts, it would look something like this:

 s:iterator value=%{amounts}
  s:text name=format.currencys:param value=%{top}//s:text
 /s:iterator

  (*Chris*)

 On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org
 wrote:

  Chris,


 Hi that works perfectly for

 s:text name=format.currencys:param value=total//s:text

 where total is public Double getTotal

 but causes all rendering to stop at the following within an iterator.

 s:text name=format.currencys:param value=#product.price/

 where ListProduct getProducts (for the iterator), public Product
 getProduct and public Double getPrice

 and also fails just on

 s:text name=format.currencys:param
 value=product.price//s:text

 where public Product getProduct

 Is there places where different mechanisms need to be used here? I
 dont
 understand the inconstistant result I now get.

 Nothing in the log files on TRACE


 Thanks

 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Tuesday, July 13, 2010 8:16 PM
 Subject: Re: Currency Formatting



  try s:param instead of s:property.

  (*Chris*)


 On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles ch...@chrismiles.org
 
 wrote:

  At the moment I have in my struts.xml


  constant name=struts.custom.i18n.resources
 value=ApplicationResources
 /

 ApplicationResources.properties is being packaged within
 WEB-INF\classes
 within a WAR within an EAR.

 The file contains: format.currency={0,number,currency}

 In my JSP I have s:text name=format.currencys:property
 value=product.price//s:text

 Without the s:text the price is displayed (a Double).

 When the s:text is included all I get is: {0}

 thanks

 Chris
 - Original Message - From: Chris Pratt 
 thechrispr...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Sunday, July 11, 2010 1:25 AM
 Subject: Re: Currency Formatting



  Define something like:


  format.currency={0,number,currency}


 

Re: result-type using annotations

2010-07-13 Thread Allen Lee
You can do this via the json plugin
(https://cwiki.apache.org/WW/json-plugin.html - bundled with struts
2.1.7+) that provides the json result type, i.e., @Result(name=foo,
type=json, ...) or you could set the contentType in your @Result
params as application/json and have your associated template emit the
exact json that you want to return.


On Tue, Jul 13, 2010 at 5:34 AM, JP Cafaro jcafar...@gmail.com wrote:
 Is it possible to declare result-type using annotations?  For example, when
 trying to return an object, that gets serialized to json, is it possible to
 move away from the struts.xml result-type and do it via annotations

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





-- 
Allen Lee
Center for the Study of Institutional Diversity [http://csid.asu.edu]
Arizona State University | P.O. Box 872402 | Tempe, Arizona 85287-2402
Office: 480.727.0401 | Fax: 480.965.7671

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Currency Formatting

2010-07-13 Thread Chris Miles
Yeah I was hoping I did not need to. Not at midnight though. Will look 
tomorrow now haha.


Thanks very much for the help.

Chrid

- Original Message - 
From: Chris Pratt thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, July 14, 2010 12:10 AM
Subject: Re: Currency Formatting


That's weird I've never experienced anything like that were rendering 
stops
without putting anything into the logs.  Looks like you'll have to dig 
into

the code.
 (*Chris*)

On Tue, Jul 13, 2010 at 4:05 PM, Chris Miles ch...@chrismiles.org wrote:


HTML rendering just completely stops at that point. I get the following:

span class=product-nameThis is a product name/span
span class=product-price

And nothing else for the rest of the page. Nothing in the logs. Nothing 
:)



Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com

To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, July 14, 2010 12:03 AM

Subject: Re: Currency Formatting


 Define fails, you get a stack trace? you don't get the output you
expected?  If so, what were you expecting vs. what did you get? I've 
used

that code a thousand times, so I'm not sure what could be going wrong...
 (*Chris*)

On Tue, Jul 13, 2010 at 3:56 PM, Chris Miles ch...@chrismiles.org
wrote:

 Thanks Chris. The reason I use this method in my iterators is there are 
a
few places where I use nested iterators so the # notation is the only 
way

to
access the current iterator but also the parent iterator.

This specific iterator is not nested so I have changed it for learning
and
trial sake and it fails with the line

span class=product-prices:text name=format.currencys:param
value=price//s:text/span

I can put

span class=product-prices:property value=price//span

and it displays the value fine.


Chris

- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 11:28 PM
Subject: Re: Currency Formatting


 I've never used the iterator tag like that, the standard way to use 
the



Struts 2 Iterator would be:

s:iterator value=products
 span class=product-names:property value=name 
http://product.name/


//span
 span class=product-pricepound;s:text
name=format.currencys:param
value=price//s:text/span
/s:iterator

Since the iterator tag puts the current value on the top of the stack,
there's no reason to define a variable to hold it.  It's much simpler 
to

just use the value stack to pull the values from.  Don't know if this
might
help or not.
 (*Chris*)

On Tue, Jul 13, 2010 at 3:23 PM, Chris Miles ch...@chrismiles.org
wrote:

 Chris,



I have a list of products which contain a double price.

I now have.

s:iterator value=products var=product
 span class=product-names:property 
value=#product.name//span

 span class=product-pricepound;s:text
name=format.currencys:param
value=#product.price//s:text/span
/s:iterator


Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 11:04 PM

Subject: Re: Currency Formatting


 s:iterator puts the value on the top of the stack, so if you have 
a

list

 of doubles, we'll call it amounts, it would look something like 
this:


s:iterator value=%{amounts}
 s:text name=format.currencys:param value=%{top}//s:text
/s:iterator

 (*Chris*)

On Tue, Jul 13, 2010 at 2:43 PM, Chris Miles ch...@chrismiles.org
wrote:

 Chris,



Hi that works perfectly for

s:text name=format.currencys:param value=total//s:text

where total is public Double getTotal

but causes all rendering to stop at the following within an 
iterator.


s:text name=format.currencys:param value=#product.price/

where ListProduct getProducts (for the iterator), public Product
getProduct and public Double getPrice

and also fails just on

s:text name=format.currencys:param
value=product.price//s:text

where public Product getProduct

Is there places where different mechanisms need to be used here? I
dont
understand the inconstistant result I now get.

Nothing in the log files on TRACE


Thanks

Chris
- Original Message - From: Chris Pratt 
thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, July 13, 2010 8:16 PM
Subject: Re: Currency Formatting



 try s:param instead of s:property.

 (*Chris*)



On Tue, Jul 13, 2010 at 12:11 PM, Chris Miles 
ch...@chrismiles.org


wrote:

 At the moment I have in my struts.xml


 constant name=struts.custom.i18n.resources

value=ApplicationResources
/

ApplicationResources.properties is being packaged within
WEB-INF\classes
within a WAR within an EAR.

The file contains: format.currency={0,number,currency}

In my JSP I have s:text name=format.currencys:property
value=product.price//s:text

Without the s:text the price is displayed (a Double).

When the s:text is included all I get is: {0}

thanks

Chris
- Original Message 

Re: result-type using annotations

2010-07-13 Thread JP Cafaro
Thanks for the response.  I've been actually looking into the json 
plugin but having problems...


I'm using the json plugin that comes with struts 2 (json-lib-2.1.jar) 
and trying to follow the website to set it up.


Here's my struts.xml

   struts
  package name=example  extends=json-default
 action name=AjaxRetrieveUser class=actions.view.RetrieveUser
result type=json/
 /action
  /package
   /struts

but I get this warning:
SEVERE: Unable to find parent packages json-default

Is there something else I'm supposed to do?

Allen Lee wrote:

You can do this via the json plugin
(https://cwiki.apache.org/WW/json-plugin.html - bundled with struts
2.1.7+) that provides the json result type, i.e., @Result(name=foo,
type=json, ...) or you could set the contentType in your @Result
params as application/json and have your associated template emit the
exact json that you want to return.


On Tue, Jul 13, 2010 at 5:34 AM, JP Cafaro jcafar...@gmail.com wrote:
  

Is it possible to declare result-type using annotations?  For example, when
trying to return an object, that gets serialized to json, is it possible to
move away from the struts.xml result-type and do it via annotations

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org







  


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Finding out version of Struts2 by introspecting the struts2-core jar

2010-07-13 Thread Don Brown
On Wed, Jul 14, 2010 at 8:08 AM, Rohan Ranade rohan.ran...@gmail.com wrote:
 Hi all,

 I want to find out the version of Struts2 (2.0.x or 2.1.x) by introspecting
 the struts2 core jar file. Is there a class which can be introspected to
 find this out? (similar to
 http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/core/SpringVersion.htmlin
 Spring)? Having looked at the struts2 core jar, I see that
 core-jar/META-INF/maven/org.apache.struts/struts2-core/pom.properties
 contains a version property. Is this a reliable way to check the version of
 Struts2?

Yes, this is reliable as long as Struts 2 is built with Maven 2, which
is highly likely to be the case for the foreseeable future.  Is there
a specific use case you have in mind in which you need to know the
version?

Don

 Can someone advise if there is a better way to do this?

 Thanks and Regards,
 Rohan


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Finding out version of Struts2 by introspecting the struts2-core jar

2010-07-13 Thread Rohan Ranade
IDE integration. I maintain the NetBeans Struts2 plugin (
http://nbstruts2support.dev.java.net). To quote one use case: When creating
a new project, the user has a choice of selecting Struts 2.0.x or
Struts2.1.x libraries to be added to the classpath from a location specified
by the user. Depending on the version chosen by the user, the netbeans
plugin has to either add the FilterDispatcher (for 2.0.x) or the
StrutsPrepareAndExecute filter (2.1.x) to the web.xml.

Thanks and Regards,
Rohan

On Tue, Jul 13, 2010 at 5:27 PM, Don Brown mr...@twdata.org wrote:

 On Wed, Jul 14, 2010 at 8:08 AM, Rohan Ranade rohan.ran...@gmail.com
 wrote:
  Hi all,
 
  I want to find out the version of Struts2 (2.0.x or 2.1.x) by
 introspecting
  the struts2 core jar file. Is there a class which can be introspected to
  find this out? (similar to
 
 http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/core/SpringVersion.htmlin
  Spring)? Having looked at the struts2 core jar, I see that
  core-jar/META-INF/maven/org.apache.struts/struts2-core/pom.properties
  contains a version property. Is this a reliable way to check the version
 of
  Struts2?

 Yes, this is reliable as long as Struts 2 is built with Maven 2, which
 is highly likely to be the case for the foreseeable future.  Is there
 a specific use case you have in mind in which you need to know the
 version?

 Don
 
  Can someone advise if there is a better way to do this?
 
  Thanks and Regards,
  Rohan
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Finding out version of Struts2 by introspecting the struts2-core jar

2010-07-13 Thread Don Brown
Gotcha, so in that case, yes, that properties file is exactly what you want.

Don

On Wed, Jul 14, 2010 at 11:31 AM, Rohan Ranade rohan.ran...@gmail.com wrote:
 IDE integration. I maintain the NetBeans Struts2 plugin (
 http://nbstruts2support.dev.java.net). To quote one use case: When creating
 a new project, the user has a choice of selecting Struts 2.0.x or
 Struts2.1.x libraries to be added to the classpath from a location specified
 by the user. Depending on the version chosen by the user, the netbeans
 plugin has to either add the FilterDispatcher (for 2.0.x) or the
 StrutsPrepareAndExecute filter (2.1.x) to the web.xml.

 Thanks and Regards,
 Rohan

 On Tue, Jul 13, 2010 at 5:27 PM, Don Brown mr...@twdata.org wrote:

 On Wed, Jul 14, 2010 at 8:08 AM, Rohan Ranade rohan.ran...@gmail.com
 wrote:
  Hi all,
 
  I want to find out the version of Struts2 (2.0.x or 2.1.x) by
 introspecting
  the struts2 core jar file. Is there a class which can be introspected to
  find this out? (similar to
 
 http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/core/SpringVersion.htmlin
  Spring)? Having looked at the struts2 core jar, I see that
  core-jar/META-INF/maven/org.apache.struts/struts2-core/pom.properties
  contains a version property. Is this a reliable way to check the version
 of
  Struts2?

 Yes, this is reliable as long as Struts 2 is built with Maven 2, which
 is highly likely to be the case for the foreseeable future.  Is there
 a specific use case you have in mind in which you need to know the
 version?

 Don
 
  Can someone advise if there is a better way to do this?
 
  Thanks and Regards,
  Rohan
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: how can i get the validation in japanese

2010-07-13 Thread Salish S
Thanks for the reply
but my problem is not solved,
i had a jsp page in which user enter japanese char there has to use client
side validation so that validation message has to be in japanese and if all
are correct that has to enter in the mysql db's table in that i'm not sure
what the encoding used for table and on listing the entered values also has
to show in japanese in jsp page
ob using utf-16 some error appear  in xml as well as the eclipse java code
also changed to japanes on selecting the whole project'properties and change
the encoding to UTF-16 what should i do

Thanks in advance


On Tue, Jul 13, 2010 at 5:30 PM, Martin Gainty mgai...@hotmail.com wrote:


 UTF-8 wont handle dbcs or tbcs languages
 i would suggest change all encodings (parameter and file,input and output)
 to UTF-16



 ?xml version=1.0 encoding=UTF-8 ?

 change all XML declaration tags for all XML files to UTF-16 e.g.

 ?xml version=1.0 encoding=UTF-16 ?



 freemarker and velocity have their language specific scripts which you will
 need to modify or insert located at

 /WEB-INF/velocity/tiles-defs_ja_JA.xml

 /WEB-INF/freemarker/tiles-defs_ja_JA.xml



 if you use the embeddedjsp plugin you will need to provide
 LocalStrings_ja.properties in resources folder


 \plugins\embeddedjsp\src\main\resources\org\apache\struts2\jasper\resources\LocalStrings_ja.properties



 if you are using portlets in portlet.xml change
 supported-localeen/supported-locale to
 supported-localeja/supported-locale



 set the locale for your sessions to ja_JA via i18n-interceptor

 https://cwiki.apache.org/WW/i18n-interceptor.html


 Martin Gainty
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
 de ceci est interdite. Ce message sert à l'information seulement et n'aura
 pas n'importe quel effet légalement obligatoire. Étant donné que les email
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
 aucune responsabilité pour le contenu fourni.





  Date: Tue, 13 Jul 2010 13:04:56 +0530
  Subject: how can i get the validation in japanese
  From: ssal...@gmail.com
  To: user@struts.apache.org
 
  Hi all
  I'm facing a problem ,
 
  in a sample there is a username and password there two has to show in
  japanese if the user didnt enter the values the validation also has also
 be
  shown in japanese i had changed the page encoding ,changed to
 validation.xml
  to property file there also on saving eclise is shwing cant encode to
 utf-8
  some ISO ... is enabled so i change the language support of my
  sys,in eclipse also Window-PrefencesGeneral---Workspace to
  UTF-8 but on deplaying the validation is showing in  why what
 is
  the problem and how can i get it correct
  Thanks in advance

 _
 The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
 Hotmail.

 http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5