Problem assiging elements in to list

2008-03-14 Thread Vamsi Gmail!
Hi all,

 I have a requirement where I need to assign a Objects to a list.
I tried the example given in showcase there is working (in the site).
But It is not assigning to that list

I am also attaching code for your refernce.

---Vamsi
/*
 * $Id: PersonAction.java 471756 2006-11-06 15:01:43Z husted $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * License); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package test.actions;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.PersistenceUnit;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.exception.ConstraintViolationException;

import test.examples.Person;

import com.opensymphony.xwork2.ActionSupport;


@SuppressWarnings(serial)

public class PersonAction extends ActionSupport {

//private Person person;
private List persons = new ArrayList();

private Log _logger = LogFactory.getLog(PersonAction.class);




public List getPersons() {
return persons;
}

public void setPersons(List persons) {
this.persons = persons;
}

@SuppressWarnings(unchecked)

public String save()  {
EntityManager e = SfmsEntityManagerFactory.getEntityManager();
EntityTransaction txn  =e.getTransaction();
txn.begin();
try{
_logger.error(Person ::);
_logger.error(Person ::);
for (Object object :persons) {
Person person  = (Person) object;
_logger.error(Person 
:: + person);

e.persist(person);
}
_logger.error(Person ::);
_logger.error(Person ::);
txn.commit();
addActionMessage(Record Added);
read(e);
}catch(ConstraintViolationException e1) {
addActionError(Record Already There);
}catch(IllegalStateException e1){

}catch(Exception e1) {
addActionError(Error Inserting);
txn.rollback();
}

return SUCCESS;
}

private void read(EntityManager e)  {   
persons = e.createQuery(From Person).getResultList();

}





   

}package test.examples;

import static javax.persistence.FetchType.LAZY;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Person implements Persister{


@Id
private String name;

@Basic(fetch=LAZY)
private int age;

public String getName() {
return name;
}

public int getAge() {
return age;
}

public void setName(String name) {
this.name = name;
}

public void setAge(int age) {
this.age = age;
}

@Override
public String toString() {

return name +  + age;
}

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

Question regarding OGNL

2008-03-14 Thread Thomas Ramapuram
Hi, 
I have query regarding OGNL Expression.   
Can the #name kind of expression be used anywhere? Or are they 
applicable only in certain attributes of struts tags 

Till now I was using the %{name} expression and that too in the some 
attribute of a tag 

I tried using #name expression but it does not work.  Is there any 
settings to be set (for example in web.xml) 
Any pointers would be a great help. 
Thanks 
Thomas


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



Re: Getting error in using tag library : The Tag class 'org.apache.struts.taglib.html.FormTag' has no setter method corresponding to TLD declared attribute 'acceptCharset', (JSP 1.1 spec, 5.4.1)

2008-03-14 Thread Antonio Petrelli
2008/3/14, kannan_307 [EMAIL PROTECTED]:


 I am using the struts version 1.2.4



It was a bug that seems to be fixed:
https://issues.apache.org/struts/browse/STR-1636
It is fixed in 1.2 Family: I checked and it is fixed in Struts 1.2.9.
I suggest you to upgrade to Struts 1.2.9 or, better, to 1.3.8.

Ciao
Antonio


Re: struts wml

2008-03-14 Thread Antonio Petrelli
2008/3/13, CarloSilva [EMAIL PROTECTED]:

 Laurie Harper, email-me please. I think I have help to you.
 An emabrace



WTF?


Re: struts wml

2008-03-14 Thread Al Sutton
I think it's a babelfish (babel.altavista.com) translation from another 
language.


Anyway, isn't it nice to offer free embraces :).

Al.


- Original Message - 
From: Antonio Petrelli [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org; CarloSilva 
[EMAIL PROTECTED]

Sent: Friday, March 14, 2008 8:17 AM
Subject: Re: struts wml



2008/3/13, CarloSilva [EMAIL PROTECTED]:


Laurie Harper, email-me please. I think I have help to you.
An emabrace




WTF?




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



Re: Multiple Actions for a single page. Is this possible

2008-03-14 Thread Ralf Fischer
Hi,

On 3/14/08, ravi_eze [EMAIL PROTECTED] wrote:
  We have two pages a.jsp and b.jsp developed with the action class mehods
  Ac.a()  Ac.b() that render these pages. Now we need to develop a new page
  c.jsp which is combination of both a  b.jsps.

  i can include the jsps into the c.jsp. But what abt the action class behind?
  can they not get automatically invoked and the pages get populated? More
  over i have some logic to be performed based on the inputs made in the two
  sections of c.jsp. Is it possible for me to only do this part as a layer?

  any ideas as how to go abt this? pl help.

Check out the s:action / tag, when c.jsp is rendered you can place
actions on it. All the stuff including interceptors will be invoked
for each action by creating a new action proxy. Don't forget to set
executeResult=true so the output gets' rendered.

The surrounding action (if c.jsp is an action result) will still be on
the stack.

Cheers,
-Ralf

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



Re: Multiple Actions for a single page. Is this possible

2008-03-14 Thread Bently Drake
Hi,

Action class gets populated when you invoke them by clicking on any button or 
link or anywhere
if you invoke the class a by clicking on a.jsp and same with b,
and when you include then into c.jsp
they will work as usual no change requires!!

please correct me if I didnt get your question,

Warm Regards,



- Original Message 
From: Ralf Fischer [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Friday, March 14, 2008 2:41:52 PM
Subject: Re: Multiple Actions for a single page. Is this possible

Hi,

On 3/14/08, ravi_eze [EMAIL PROTECTED] wrote:
  We have two pages a.jsp and b.jsp developed with the action class mehods
  Ac.a()  Ac.b() that render these pages. Now we need to develop a new page
  c.jsp which is combination of both a  b.jsps.

  i can include the jsps into the c.jsp. But what abt the action class behind?
  can they not get automatically invoked and the pages get populated? More
  over i have some logic to be performed based on the inputs made in the two
  sections of c.jsp. Is it possible for me to only do this part as a layer?

  any ideas as how to go abt this? pl help.

Check out the s:action / tag, when c.jsp is rendered you can place
actions on it. All the stuff including interceptors will be invoked
for each action by creating a new action proxy. Don't forget to set
executeResult=true so the output gets' rendered.

The surrounding action (if c.jsp is an action result) will still be on
the stack.

Cheers,
-Ralf

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


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


Issue In Autocompleter

2008-03-14 Thread Ankur Agar

Hi All,
  I am tryin to make an autocomplete work with its theme=ajax
I am using struts 2.0.x
The data coming from the action is in JSON format

{Arizona:AZ,Arkansas:AR,Armed:AE,California:CA,Florida:FL}
the jsp code is
%@ taglib prefix=s uri=/struts-tags %
html
  head
s:head theme=ajax debug=true/
  /head
 s:property value=jsonList/
  body
 s:url id=ajaxCallUrl value=autocompleter1.action
 /s:url
h1Struts 2 Autocompleter Example!/h1
s:label name=stateName value=Select State Name: /
br
 s:autocompleter name=state theme=ajax  href=%{ajaxCallUrl}
loadOnTextChange=true loadMinimumCount=1/
br
  /body
/html

But still the autocomplete is not working gives a syntax error on page when
run in debug mode. In one of the links I found that struts-dojo-tags has to
be used as a plugin in struts 2.0.x  But also in one of the links it was
specified that its embedded in struts-core.jar.
Please help me out.
Regards,
Ankur

=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




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



Codebehind + zero config options

2008-03-14 Thread Alex Shneyderman
I am a bit confused by how it works maybe you guys could shed some light :-)

I have a package structure and JSP pages structure that match. To be
concrete actions are placed like this:

/com/mypackge/my/namespace/IndexAction.java
/com/mypackge/my/namespace/EditAction.java

and pages are placed like so:

/WEB-INF/pages/my/namespace/index.jsp
/WEB-INF/pages/my/namespace/edit.jsp

now when I request a page I would like to configure struts/codebehind
combo so if I user requests:

/my/namespace - index.action should kick in (of course it does not
exists so index.jsp should be the result with the help of codebehind
plugin. And in that page I can do what I need to

So, I tried to make an entry in struts.xml

struts

constant name=struts.codebehind.pathPrefix value=/WEB-INF/pages/ /

package name=my.namespace namespace=/my/namesapce
default-action-ref name=index /
/package

/struts

this does not seem to work as I get

HTTP ERROR: 404
NOT_FOUND

Any idea on how I could achieve this ?

Thanks,
Alex.

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



Re: Question regarding OGNL

2008-03-14 Thread Rushikesh Thakkar
AFAIK you can use OGNL expression in any attribute of your struts2 tag.
Your problem could be 'what is the proper syntax for using OGNL
expression?'.
Can you post your relevant code? I might get an idea of what you are trying
to achieve.

-Rushikesh

On Fri, Mar 14, 2008 at 7:29 AM, Thomas Ramapuram 
[EMAIL PROTECTED] wrote:

 Hi,
 I have query regarding OGNL Expression.
 Can the #name kind of expression be used anywhere? Or are they
 applicable only in certain attributes of struts tags

 Till now I was using the %{name} expression and that too in the some
 attribute of a tag

 I tried using #name expression but it does not work.  Is there any
 settings to be set (for example in web.xml)
 Any pointers would be a great help.
 Thanks
 Thomas


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




Struts2 - Validating several fields depending on values of other fields

2008-03-14 Thread Dirk Schumacher

Hello out there,

I am relativley new to S2 and I got stuck on a validation problem.

2 fields/properties to be set on my Action:
startDate(String)
endDate(String)

When setting a value first of all the String must be parsed into a Date 
object. I know how to handle that.

The endDate must be after the startDate. And that's the problem.

I'd like to annotate the properties-setters, so an implementing 
validator takes care of the validation.


sth like this.:
@CustomizableS2Validator ( message=Insuffient Start Date, 
when=before, otherDate=endDate )

public void setStartDate(String inDate) {
 date = inDate;
}

Implementing a FieldValidatorSupport does not work because I only know 
how to access the validated property. But I need another property of the 
Action object.


I know it would be solveable by the @FieldExpressionValidator where its 
expression can be filled with a complex OGNL-Expression.
But if evaluating the expression internally throws an Exception, the 
evaluation does not terminate right. (I'd be fine with a negative validation
and re-jecting to the input page, but if the OGNL is not evaluateable it 
passes the validation)


Another way is to validate within the executed action method. I want a 
Validator.
Yet, another is to implement a Validator which accesses Porperties via 
Reflection and analyzing the Annotations.


But I'd like to have a Validator object handling the validation concern.

Big question?
Is there even a way to do this.
Is it possible to customize the parameters of an annotation?
What do I have to replace for @CustomizableS2Validator

Best wondering greetings from cologne
Dirk

--
softwareentwickler

denkwerk gmbh | vogelsanger straße 66 | d-50823 köln
telefon +49 221 2942 100 | telefax +49 221 2942 101
GF: Axel Schmiegelow, Marco Zingler, Jochen Schlaier, Frank Zimpel
HRB 32063 Amtsgericht Köln  -  www.denkwerk.com


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



Re: Struts2 - Validating several fields depending on values of other fields

2008-03-14 Thread Dave Newton
--- Dirk Schumacher wrote:
 2 fields/properties to be set on my Action:
 startDate(String)
 endDate(String)
 
 When setting a value first of all the String must be parsed into a Date 
 object.

FYI, that can be handled automatically by the framework via type conversion
[1] unless there's some compelling reason to explicitly convert from a
string.

 I'd like to annotate the properties-setters, so an implementing 
 validator takes care of the validation.
 
 sth like this.:
 @CustomizableS2Validator ( message=Insuffient Start Date, 
 when=before, otherDate=endDate )
 public void setStartDate(String inDate) {
   date = inDate;
 }

IIRC using an annotation for a custom validator is a bit more complicated
than that because of how annotations work (they can't be subclassed) and
XWork sets things up with regards to validation annotations. You'd probably
have to use @CustomValidator [2].

 Is it possible to customize the parameters of an annotation?

@ValidationParameter [3] sets parameters for @CustomValidator. I find it
pretty unwieldy, but because of the way XWork looks for validation
annotations I'm not sure what the options are at this point. Perhaps somebody
else will have a better solution.

Dave

[1] http://struts.apache.org/2.x/docs/type-conversion.html
[2] http://struts.apache.org/2.x/docs/customvalidator-annotation.html
[3] http://struts.apache.org/2.x/docs/validationparameter-annotation.html



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



Re: Problem assiging elements in to list

2008-03-14 Thread Cesar Arevalo
HI Vamsi,

by the time you get to the for loop I don't see the list initialized, unless 
you are doing this from your jsp I don't think it will work as how you have it, 
a better way would be with a normal for like this :

for (int index = 0; index  someLimit; index++) {
   Person person = new Person();
   persons.add(index, person);
_logger.error(Person :: + person);

e.persist(person);
}

hope this helps.

Cesar

- Original Message 
From: Vamsi Gmail! [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Thursday, March 13, 2008 11:14:53 PM
Subject: Problem assiging elements in to list

Hi all,
 
 I have a requirement where I need to assign a Objects to a list.
I tried the example given in showcase there is working (in the site).
But It is not assigning to that list
 
I am also attaching code for your refernce.
 
---Vamsi


-Inline Attachment Follows-

/*
 * $Id: PersonAction.java 471756 2006-11-06 15:01:43Z husted $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * License); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0

 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package test.actions;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.PersistenceUnit;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.exception.ConstraintViolationException;

import test.examples.Person;

import com.opensymphony.xwork2.ActionSupport;


@SuppressWarnings(serial)

public class PersonAction extends ActionSupport {

//private Person person;
private List persons = new ArrayList();

private Log _logger = LogFactory.getLog(PersonAction.class);




public List getPersons() {
return persons;
}

public void setPersons(List persons) {
this.persons = persons;
}

@SuppressWarnings(unchecked)

public String save()  {
EntityManager e = SfmsEntityManagerFactory.getEntityManager();
EntityTransaction txn  =e.getTransaction();
txn.begin();
try{
_logger.error(Person ::);
_logger.error(Person ::);
for (Object object :persons) {
Person person  = (Person) object;
_logger.error(Person :: + person);

e.persist(person);
}
_logger.error(Person ::);
_logger.error(Person ::);
txn.commit();
addActionMessage(Record Added);
read(e);
}catch(ConstraintViolationException e1) {
addActionError(Record Already There);
}catch(IllegalStateException e1){

}catch(Exception e1) {
addActionError(Error Inserting);
txn.rollback();
}

return SUCCESS;
}

private void read(EntityManager e)  {
persons = e.createQuery(From Person).getResultList();

}





   

}


-Inline Attachment Follows-

package test.examples;

import static javax.persistence.FetchType.LAZY;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Person implements Persister{


@Id
private String name;

@Basic(fetch=LAZY)
private int age;

public String getName() {
return name;
}

public int getAge() {
return age;
}

public void setName(String name) {
this.name = name;
}

public void setAge(int age) {
this.age = age;
}

@Override
public String toString() {

return name +  + age;
}

}

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




Re: Problem assiging elements in to list

2008-03-14 Thread Dave Newton
--- Cesar Arevalo [EMAIL PROTECTED] wrote:
 by the time you get to the for loop I don't see the list initialized,
 unless you are doing this from your jsp I don't think it will work as how
 you have it, a better way would be with a normal for like this :
 
 for (int index = 0; index  someLimit; index++) {
Person person = new Person();
persons.add(index, person);
 _logger.error(Person :: +
 person);
 
 e.persist(person);
 }
 
 hope this helps.

That would create a list of empty Person instances (then persist the last
empty Person, but I'm assuming that's a typo).

All of this is done automatically by the framework.

 From: Vamsi Gmail! [EMAIL PROTECTED]

  I have a requirement where I need to assign a Objects to a list.
 I tried the example given in showcase there is working (in the site).
 But It is not assigning to that list
  
 I am also attaching code for your reference.

 [code]

You never really state how you're expecting the list to be filled: is this
from a form with multiple Person form fields, or...?

Dave


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



Re: Problem assiging elements in to list

2008-03-14 Thread Cesar Arevalo
Just out of curiosity, when you say All of this is done automatically by the 
framework do you mean  if you populate from a form? or how do you mean the 
framework does this automatically?

Cesar

- Original Message 
From: Dave Newton [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Friday, March 14, 2008 10:27:19 AM
Subject: Re: Problem assiging elements in to list

--- Cesar Arevalo [EMAIL PROTECTED] wrote:
 by the time you get to the for loop I don't see the list initialized,
 unless you are doing this from your jsp I don't think it will work as how
 you have it, a better way would be with a normal for like this :
 
 for (int index = 0; index  someLimit; index++) {
Person person = new Person();
persons.add(index, person);
 _logger.error(Person :: +
 person);
 
 e.persist(person);
 }
 
 hope this helps.

That would create a list of empty Person instances (then persist the last
empty Person, but I'm assuming that's a typo).

All of this is done automatically by the framework.

 From: Vamsi Gmail! [EMAIL PROTECTED]

  I have a requirement where I need to assign a Objects to a list.
 I tried the example given in showcase there is working (in the site).
 But It is not assigning to that list
  
 I am also attaching code for your reference.

 [code]

You never really state how you're expecting the list to be filled: is this
from a form with multiple Person form fields, or...?

Dave


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






Re: Problem assiging elements in to list

2008-03-14 Thread Dave Newton
--- Cesar Arevalo [EMAIL PROTECTED] wrote:
 when you say All of this is done automatically by the framework 
 do you mean if you populate from a form?

Yes.

Dave


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



Re: Problem assiging elements in to list

2008-03-14 Thread Dave Newton
--- Cesar Arevalo [EMAIL PROTECTED] wrote:
 when you say All of this is done automatically by the framework
 do you mean if you populate from a form?

Actually, let me re-answer that: yes, with caveats.

For example, in the source provided the list isn't genericized, so without a
type conversion properties file I don't think it would work.

It can also depend on what type conversion(s) are being attempted; simple
property types are supported out-of-the-box. Sometimes custom type converters
would have to be written.

Without knowing what the original poster was trying to do it's hard to say
what problem s/he is experiencing.

Dave


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



Re: struts wml

2008-03-14 Thread Laurie Harper
lol true :) I keep a jar of them on my desk for people passing by to 
help themselves... oh, wait, that's Chup Chups ;-)


Al Sutton wrote:
I think it's a babelfish (babel.altavista.com) translation from another 
language.


Anyway, isn't it nice to offer free embraces :).

Al.


- Original Message - From: Antonio Petrelli 
[EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org; CarloSilva 
[EMAIL PROTECTED]

Sent: Friday, March 14, 2008 8:17 AM
Subject: Re: struts wml



2008/3/13, CarloSilva [EMAIL PROTECTED]:


Laurie Harper, email-me please. I think I have help to you.
An emabrace




WTF?




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



Re: Latest Quickstart Sitemesh

2008-03-14 Thread Laurie Harper

Doug Pham wrote:

Hi All,
 I took the current quickstart application and added sitemesh to the pom.xml and 
added all the necessary files for sitemesh, the dojo that listed the Persons broke.  The 
decorator works but the ajax failed with Error loading '/quickstart/list.action' 
(200 OK)  Is there any special settings I need to do to fix this problem?


It's rather hard to say without knowing what settings you added/changed 
while integrating Sitemesh. Post more details of what you did and how it 
is failing if you still need help.


L.


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



[S2] DEBUG NPE

2008-03-14 Thread Hoying, Ken

I have created a template which utilizes parameters that are passed into
it to generate HTML conditionally based on those parameters.  For
example:

s:component theme=scaTheme templateDir=template
template=Header.jsp
s:param name=titleKey
value=%{'title.appNpc'} /
s:param name=helpPage
value=%{'Non_Premier_Contract_Home_Page.htm'} /
/s:component

However, I do not wish to require that all the parameters be required.
For example, it would be ok if the helpPage parameter was not
specified.  At runtime, everything works fine if I do not specify the
helpPage parameter.  However if I place my logging level at DEBUG, I
my log is cluttered with NPEs like the one below.  I cannot seem to find
any kind of syntax to reference the parameter to even test if it is null
without generating this NPE in DEBUG.  Does anyone know if it is
possible to avoid these NPEs?  I make heavy use of templates with
optional parameters and it is really cluttering up the logs when trying
to debug.  Am I doing something wrong?  Should this maybe be readdressed
in the Struts code base?  I understand why the DEBUG statement is
logged.  Just not sure since it is a DEBUG statement, if the stack trace
is warranted.

Thanks in advance!


2008-03-14 14:30:14,364 DEBUG (http-127.0.0.1-8080-2:)
[com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer] Error while
retrieving generic property class for property=parameters
java.lang.NullPointerException
at
com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer.getClass(Gener
icsObjectTypeDeterminer.java:222)
at
com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer.getKeyClass(Ge
nericsObjectTypeDeterminer.java:44)
at
com.opensymphony.xwork2.util.XWorkMapPropertyAccessor.getKey(XWorkMapPro
pertyAccessor.java:136)
at
com.opensymphony.xwork2.util.XWorkMapPropertyAccessor.getProperty(XWorkM
apPropertyAccessor.java:68)
at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643)
at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTChain.getValueBody(ASTChain.java:109)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTAnd.getValueBody(ASTAnd.java:56)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.Ognl.getValue(Ognl.java:333)
at
com.opensymphony.xwork2.util.OgnlUtil.getValue(OgnlUtil.java:194)
at
com.opensymphony.xwork2.util.OgnlValueStack.findValue(OgnlValueStack.jav
a:238)
at
org.apache.struts2.components.Component.findValue(Component.java:322)
at org.apache.struts2.components.If.start(If.java:85)
at
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTag
Support.java:54)
at
org.apache.jsp.template.scaTheme.Header_jsp._jspx_meth_s_005fif_005f0(He
ader_jsp.java:273) 



-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.  

should I learn struts 1 first before learning struts 2?

2008-03-14 Thread akoo

Hi, forgive me if this has been asked before.  I am just starting on struts
and wondering if I should first learn Struts 1 or just jump straight to
struts 2?  Will spending time on struts 1 help me with struts 2 or will it
get in the way since everything in struts 2 is different from Struts 1?  I
have all of the requisites for starting struts 1.  
Thanks.
-- 
View this message in context: 
http://www.nabble.com/should-I-learn-struts-1-first-before-learning-struts-2--tp16049420p16049420.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



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

2008-03-14 Thread Antonio Petrelli
2008/3/14, akoo [EMAIL PROTECTED]:

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

Struts 1 and 2 are so different that they deserve a different name :-)
Seriously, Struts 1 and 2 are not related, learn Struts 2 directly.

Antonio

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



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

2008-03-14 Thread Musachy Barroso
I am starting to doubt about that, I was denied a job because I didn't
have enough struts 1 experience, almost funny anyway :)

musachy

On Fri, Mar 14, 2008 at 2:53 PM, Antonio Petrelli
[EMAIL PROTECTED] wrote:
 2008/3/14, akoo [EMAIL PROTECTED]:

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

  Struts 1 and 2 are so different that they deserve a different name :-)
  Seriously, Struts 1 and 2 are not related, learn Struts 2 directly.

  Antonio



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





-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Question regarding OGNL

2008-03-14 Thread Laurie Harper

Thomas Ramapuram wrote:
Hi, 
I have query regarding OGNL Expression.   
Can the #name kind of expression be used anywhere? Or are they 
applicable only in certain attributes of struts tags 

Till now I was using the %{name} expression and that too in the some 
attribute of a tag 

I tried using #name expression but it does not work.  Is there any 
settings to be set (for example in web.xml) 
Any pointers would be a great help. 
Thanks 
Thomas


The expressions %{name} and %{#name} have different meanings. Anywhere 
one is valid, the other is valid too but obviously each will only 'work' 
if the expression resolves to a value.


 - %{name} will look for a property named 'name' on your action (i.e. 
will result in a call to getName() on your action)


 - %{#name} will look for a property or attribute named 'name' anywhere 
in the value stack, including in the request/session/application scopes


AFAIK, %{#name} is equivalent to %{name} when there is a getName() on 
the action, i.e. OGNL will look at the action first then search the rest 
of the value stack.


L.


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



Re: Multiple Actions for a single page. Is this possible

2008-03-14 Thread matt.payne

chaining is one way to accomplish this.
http://struts.apache.org/2.x/docs/action-chaining.html



ravi_eze wrote:
 
 hi,
 
 We have two pages a.jsp and b.jsp developed with the action class mehods
 Ac.a()  Ac.b() that render these pages. Now we need to develop a new page
 c.jsp which is combination of both a  b.jsps.
 
 i can include the jsps into the c.jsp. But what abt the action class
 behind? can they not get automatically invoked and the pages get
 populated? More over i have some logic to be performed based on the inputs
 made in the two sections of c.jsp. Is it possible for me to only do this
 part as a layer? 
 
 any ideas as how to go abt this? pl help.
 
 regards,
 ravi 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Multiple-Actions-for-a-single-page.-Is-this-possible-tp16044652p16050493.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



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

2008-03-14 Thread Antonio Petrelli
2008/3/14, Musachy Barroso [EMAIL PROTECTED]:
 I am starting to doubt about that, I was denied a job because I didn't
  have enough struts 1 experience, almost funny anyway :)

Then you had to learn Struts 1 instead of 2 :-D

Antonio

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



Re: Best practices to reduce execution time in struts

2008-03-14 Thread matt.payne

Also, include don't use Dojo or the Ajax theme unless you want to increase
your request size by 400KB.
Unfortunately for ajax, in the current form you need to roll your own if you
want to avoid the Dojo penality.



newton.dave wrote:
 
 --- Raghu varma bhupathiraju wrote:
 give me the list of best practices to follow for reducing the 
 execution time in struts.
 
 http://struts.apache.org/2.x/docs/performance-tuning.html
 
 Dave
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Best-practices-to-reduce-execution-time-in-struts-tp16007451p16050685.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Issue In Autocompleter

2008-03-14 Thread Laurie Harper

Ankur Agar wrote:

Hi All,
  I am tryin to make an autocomplete work with its theme=ajax
I am using struts 2.0.x
The data coming from the action is in JSON format

[...]

But still the autocomplete is not working gives a syntax error on page when


Including the actual error message would help. Is it reporting a JSP 
syntax error? A Javascript error in the browser? Something else?...



run in debug mode. In one of the links I found that struts-dojo-tags has to
be used as a plugin in struts 2.0.x  But also in one of the links it was
specified that its embedded in struts-core.jar.


Dojo and the Ajax tags have been moved to a plugin in Struts 2.1.x. They 
are bundled in 2.0.x.


L.


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



Re: Question regarding OGNL

2008-03-14 Thread Dave Newton
--- Laurie Harper [EMAIL PROTECTED] wrote:
 AFAIK, %{#name} is equivalent to %{name} when there is a getName() on 
 the action, i.e. OGNL will look at the action first then search the rest 
 of the value stack.

Mmm, I'm not sure about that. The # should look explicitly for a named
object in the stack context rather than calling getXxx() on stack objects.

For example, if I have:

  pProp from Sanity action: s:property value=sanityCheck//p
  pProp from Sanity action: s:property value=#sanityCheck//p

only the first one will print the action's getSanityCheck() value.

Not that I just happened to have that example laying around or anything geeky
like that.

*ahem*

Chup Chups!

Dave


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



Re: Struts2 - Validating several fields depending on values of other fields

2008-03-14 Thread Laurie Harper

Dirk Schumacher wrote:
I know it would be solveable by the @FieldExpressionValidator where its 
expression can be filled with a complex OGNL-Expression.
But if evaluating the expression internally throws an Exception, the 
evaluation does not terminate right. (I'd be fine with a negative 
validation
and re-jecting to the input page, but if the OGNL is not evaluateable it 
passes the validation)


The expression shouldn't be so complicated; you're just comparing two 
dates, after all. And why would the OGNL expression throw an exception? 
The only issue I would expect is with one or both dates being null, 
which you can avoid using a 'required' validator.


I would think working through any issues with this approach would be a 
lot less pain than going for a custom validator in this case.


L.


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



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

2008-03-14 Thread matt.payne

No, don't bother.  Its not a chapter of book.  
Skip some of the stuff you don't need to know any longer and roll up your
sleeves with struts 2.


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

-- 
View this message in context: 
http://www.nabble.com/should-I-learn-struts-1-first-before-learning-struts-2--tp16049420p16050490.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



[OT] Complete List of Logged In Users

2008-03-14 Thread Mike Duffy
I marked this as other because this is probably sever specific (in my case I am 
using JBoss).

Using the Struts framework is there some simple way to get a list of all the 
users logged into the server?

Thx.

Mike


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


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



Re: [OT] Complete List of Logged In Users

2008-03-14 Thread Dave Newton
--- Mike Duffy [EMAIL PROTECTED] wrote:
 Using the Struts framework is there some simple way to get a list of all
 the users logged into the server?

Using the Struts framework? No; this doesn't have anything to do with Struts.

You might use a SessionContextListener to provide a potentially useful
number, but it would still be approximate as a user might just close their
window without logging out, etc.

There are probably some other solutions, though.

Dave


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



Re: [struts] Re: Question regarding OGNL

2008-03-14 Thread Dale Newfield

Laurie Harper wrote:
The expressions %{name} and %{#name} have different meanings. Anywhere 
one is valid, the other is valid too but obviously each will only 'work' 
if the expression resolves to a value.


Correct.  I'm sorry to pick nits, but if you don't mind, I'll clarify 
your following statements in the hopes that this becomes clearer to more 
people:


 - %{name} will look for a property named 'name' on your action (i.e. 
will result in a call to getName() on your action)


%{name} will look for name on the Value Stack.  Typically while 
executing in .jsp's the top item in that stack is your Action, but 
within an iterator, for example, there might be something on top of 
the Action, and there are always other objects below the Action.


OGNL will start at the top of the stack and search each object for a 
getName() getter, returning the results of the first such getter found.


 - %{#name} will look for a property or attribute named 'name' anywhere 
in the value stack, including in the request/session/application scopes


%{#name} will not look in the value stack at all.  It will look for a an 
object named name stored in a separate MapString,Object separately 
from the VS (StackObject).  Some struts tags push/pop items on to the 
top of the VS, some just store in this hash.  (Possibly some do both 
when asked to, in which case it's the same object both in the VS and 
directly referencible through that Map.)


AFAIK, %{#name} is equivalent to %{name} when there is a getName() on 
the action, i.e. OGNL will look at the action first then search the rest 
of the value stack.


AFAIK that is incorrect.

Special items in that Map:

#application
#session
#request
#parameters

I believe at least some of those are also in the VS.

#attr searches the normal (EL) scopes in normal (EL) order (application, 
session, request, and page)  (Note, #page is not in the Map.)


-Dale

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



Re: struts wml

2008-03-14 Thread CarloSilva

Hi Laurie.
I have the struts-wml.jar  for struts 1.2.
I´m sorry for my bad English.
Other embrace.



- Original Message - 
From: Laurie Harper [EMAIL PROTECTED]

To: user@struts.apache.org
Sent: Friday, March 14, 2008 3:24 PM
Subject: Re: struts wml


lol true :) I keep a jar of them on my desk for people passing by to help 
themselves... oh, wait, that's Chup Chups ;-)


Al Sutton wrote:
I think it's a babelfish (babel.altavista.com) translation from another 
language.


Anyway, isn't it nice to offer free embraces :).

Al.


- Original Message - From: Antonio Petrelli 
[EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org; CarloSilva 
[EMAIL PROTECTED]

Sent: Friday, March 14, 2008 8:17 AM
Subject: Re: struts wml



2008/3/13, CarloSilva [EMAIL PROTECTED]:


Laurie Harper, email-me please. I think I have help to you.
An emabrace




WTF?




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



__ Informação do NOD32 IMON 2946 (20080313) __

Esta mensagem foi verificada pelo NOD32 sistema antivírus
http://www.eset.com.br





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



redirection problem

2008-03-14 Thread matthieu martin
Hi all.

I am handling login issue through an interceptor. Basically it looks in the
session if a user entry exists before letting you go through to the
administration panels. This works fine.

In my admin, I use a lot of Ajax (with dojo) so I never have a single full
page reload. I use submits or anchor tags to do that. Those tags use the
targets parameter to know which part of the page is to be refreshed.

And here is my problem :

I click on a s:a or a s:submit tag, my interceptor catches the request,
sees that I am not logged in anymore, and does the redirection towards the
login page ... inside the div specified as a target !

I understand very well this matter, and it's all too logical. Nevertheless,
I've been turning this issue upside down for days now and I can't figure a
way to refresh the whole page when I'm not logged in anymore, or only
refresh the div I want when my interceptor says everything's fine.

Is there a way to break to target parameter so that I could simply redirect
toward an action which would refresh the whole page ?

Does anyone have an idea ?

I'm sort of out of solutions 

Matthieu


Re: Question regarding OGNL

2008-03-14 Thread Martin Gainty
dave is is correct..

#foo.blah // returns foo.getBlah()
#bar.blah // returns bar.getBlah()
blah  // returns foo.getBlah() because foo is the root

http://struts.apache.org/2.x/docs/ognl-basics.html

Martin-
- Original Message -
From: Dave Newton [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Friday, March 14, 2008 2:19 PM
Subject: Re: Question regarding OGNL


 --- Laurie Harper [EMAIL PROTECTED] wrote:
  AFAIK, %{#name} is equivalent to %{name} when there is a getName() on
  the action, i.e. OGNL will look at the action first then search the rest
  of the value stack.

 Mmm, I'm not sure about that. The # should look explicitly for a named
 object in the stack context rather than calling getXxx() on stack objects.

 For example, if I have:

   pProp from Sanity action: s:property value=sanityCheck//p
   pProp from Sanity action: s:property value=#sanityCheck//p

 only the first one will print the action's getSanityCheck() value.

 Not that I just happened to have that example laying around or anything
geeky
 like that.

 *ahem*

 Chup Chups!

 Dave


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




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



Re: [struts] Question regarding OGNL

2008-03-14 Thread Dale Newfield

Martin Gainty wrote:

dave is is correct..


The following example without the proceeding situation setup is quite 
misleading (so here it is) :


For example, suppose we are using standard OGNL (not using XWork) and 
there are two objects in the OgnlContext map: foo - foo and bar - 
bar and that the foo object is also configured to be the single root 
object. The following code illustrates how OGNL deals with these three 
situations:



#foo.blah // returns foo.getBlah()
#bar.blah // returns bar.getBlah()
blah  // returns foo.getBlah() because foo is the root


So the third line is only true because in this scenario foo is BOTH #foo 
AND the VS root.



http://struts.apache.org/2.x/docs/ognl-basics.html


-Dale


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