Author Login
Post Reply
user Digest 26 Jun 2008 11:41:59 -0000 Issue 8110
Topics (messages 188106 through 188123):
Multi-row tabular forms
188106 by: Kleiderman, Matthew
188107 by: Dave Newton
188122 by: Nikhil Walvekar
Re: weird problem <s:iterator> tag.
188108 by: Martin Gainty
188117 by: Pawe³ Wielgus
Struts 2 - Repopulate controls when validation fails
188109 by: bob fuller
188110 by: bob fuller
188116 by: Lukasz Lenart
Including XML files in maven war file
188111 by: Oren Livne
188114 by: Lukasz Lenart
Re: Struts Themes Problem - help
188112 by: Narayana S
Re: validation problem
188113 by: ManiKanta G
188115 by: Lukasz Lenart
How to get all sessions in one web application
188118 by: Joey
188119 by: Lukasz Lenart
188120 by: Jorge Martín Cuervo
188121 by: Wendy Smoak
jUnit Testing Problem with Tiles
188123 by: ezgi
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_188106.ezm (zipped)I'm trying create a form that maps to a collection of data objects, so
that a user can edit any property of any object, and submit the changes.
I'm using an s:iterator tag to draw each item in the collection as a row
in a table, and the xhtml template. The table is getting drawn
properly, with data filled in from the collection - but the Action
receiving the data always has the Collection set to null. Here's a
stripped-down excerpt of what the .jsp looks like:
<s:form theme="xhtml" id="configureobjects" action="DoConfigureObjects">
<s:label theme="xhtml" label="Name" name="Name" />
<s:hidden name="Name" />
<table>
<tbody>
<s:iterator value="DataObjects" var="CurrentObject">
<tr>
<td>
<s:property value="CurrentObject.Property1" />
<s:hidden name="CurrentObject.Property1"
value="CurrentObject.Property1" />
</td>
<td>
<s:textfield name="CurrentObject.Property2" />
</td>
<td>
<s:textfield name="CurrentObject.Property3" />
</td>
</tr>
</s:iterator>
</tbody>
</table>
<sx:submit label="Configure" />
</s:form>
What am I doing wrong?
Thanks in advance,
Matt Kleiderman

Attachment:
user_188107.ezm (zipped)Is that actually rendering properly?!
I thought you had to add an index to the field name manually so it would be sent back as foo.bar[1], but perhaps I'm wrong.
Dave
--- On Wed, 6/25/08, Kleiderman, Matthew <Matthew.Kleiderman@(protected):
> From: Kleiderman, Matthew <Matthew.Kleiderman@(protected)>
> Subject: Multi-row tabular forms
> To: user@(protected)
> Date: Wednesday, June 25, 2008, 6:46 PM
> I'm trying create a form that maps to a collection of
> data objects, so
> that a user can edit any property of any object, and submit
> the changes.
> I'm using an s:iterator tag to draw each item in the
> collection as a row
> in a table, and the xhtml template. The table is getting
> drawn
> properly, with data filled in from the collection - but
> the Action
> receiving the data always has the Collection set to null.
> Here's a
> stripped-down excerpt of what the .jsp looks like:
>
> <s:form theme="xhtml"
> id="configureobjects"
> action="DoConfigureObjects">
> <s:label theme="xhtml"
> label="Name" name="Name" />
> <s:hidden name="Name" />
> <table>
> <tbody>
> <s:iterator value="DataObjects"
> var="CurrentObject">
> <tr>
> <td>
> <s:property
> value="CurrentObject.Property1" />
> <s:hidden
> name="CurrentObject.Property1"
> value="CurrentObject.Property1" />
> </td>
> <td>
> <s:textfield
> name="CurrentObject.Property2" />
> </td>
> <td>
> <s:textfield
> name="CurrentObject.Property3" />
> </td>
> </tr>
> </s:iterator>
> </tbody>
> </table>
> <sx:submit label="Configure" />
> </s:form>
>
> What am I doing wrong?
>
> Thanks in advance,
>
> Matt Kleiderman
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment:
user_188122.ezm (zipped)Hi Matt,
For Struts 1.1, I used to do following things:
<logic:iterate id="dataObjects" property="dataObjects" indexId="cnt">
<html:text name="dataObjects" property="property1" indexed="true"/>
<html:text name="dataObjects" property="property2" indexed="true"/>
</html:iterate>
Syntax may be wrong (tried 2 yrs back :D ).
But with this, I got another error, while populating data into form. The
collection needs to have required number of objects.
If you know that only 2 rows will be present then you can populate
collection with 2 empty object, else you might get NullPointer.
Regards,
Nikhil
On Thu, Jun 26, 2008 at 4:16 AM, Kleiderman, Matthew <
Matthew.Kleiderman@(protected):
> I'm trying create a form that maps to a collection of data objects, so
> that a user can edit any property of any object, and submit the changes.
> I'm using an s:iterator tag to draw each item in the collection as a row
> in a table, and the xhtml template. The table is getting drawn
> properly, with data filled in from the collection - but the Action
> receiving the data always has the Collection set to null. Here's a
> stripped-down excerpt of what the .jsp looks like:
>
> <s:form theme="xhtml" id="configureobjects" action="DoConfigureObjects">
> <s:label theme="xhtml" label="Name" name="Name" />
> <s:hidden name="Name" />
> <table>
> <tbody>
> <s:iterator value="DataObjects" var="CurrentObject">
> <tr>
> <td>
> <s:property value="CurrentObject.Property1" />
> <s:hidden name="CurrentObject.Property1"
> value="CurrentObject.Property1" />
> </td>
> <td>
> <s:textfield name="CurrentObject.Property2" />
> </td>
> <td>
> <s:textfield name="CurrentObject.Property3" />
> </td>
> </tr>
> </s:iterator>
> </tbody>
> </table>
> <sx:submit label="Configure" />
> </s:form>
>
> What am I doing wrong?
>
> Thanks in advance,
>
> Matt Kleiderman
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Nikhil

Attachment:
user_188108.ezm (zipped)
agree that should work...
<s:if test="deploymentVersion != 'All'">
<s:set name="title" value="%{'Deployment Version is NOT ALL'}"/>
</s:if>
<s:else>
<s:set name="title" value="%{'Deployment Version is ALL'}"/>
</s:else>
http://struts.apache.org/2.0.11.1/docs/crud-demo-i.html
(another alternative is to push <OGNL> value into a property and then test the value of the property)
HTH
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> Date: Wed, 25 Jun 2008 23:12:44 +0200
> From: lukasz.lenart@(protected)
> To: user@(protected)
> Subject: Re: weird problem <s:iterator> tag.
>
> > <s:if test="%{deploymentVersion !='All'}">
>
> Maybe use <s:if/> tag instead?
> http://struts.apache.org/2.1.2/docs/if.html
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
_________________________________________________________________
The other season of giving begins 6/24/08. Check out the i’m Talkathon.
http://www.imtalkathon.com?source=TXT_EML_WLH_SeasonOfGiving

Attachment:
user_188117.ezm (zipped)Hi Sarath,
this is content of my TestAction:
---------------------------------------------------------------------------
public List<String> getMyList() {
ArrayList<String> result = new ArrayList<String>();
result.add("1.");
result.add("2..");
result.add("3...");
return result;
}
public String getDeploymentVersion() {
return "All";
}
---------------------------------------------------------------------------
this is content of my test.jsp
---------------------------------------------------------------------------
Test:<br>
<s:iterator value="myList" id="entr">
entry: <s:property value="entr"/>, <s:property value="length()"/>
<s:if test="deploymentVersion != 'All'">
not equal
</s:if>
<s:if test="deploymentVersion == 'All'">
equal
</s:if>
<br>
</s:iterator>
---------------------------------------------------------------------------
and this is the output:
---------------------------------------------------------------------------
Test:
entry: 1., 2 equal
entry: 2.., 3 equal
entry: 3..., 4 equal
---------------------------------------------------------------------------
So if i properly understod Your problem i have no such one.
Any thoughts?
My environement: S2 2.0.11.1
Best greetings,
Paweł Wielgus.
On 26/06/2008, sharath karnati <karnatis@(protected):
> The deploymentVersion is from 'action'. I even tried with <c:if> and it is also having same issue.
>
> Thanks,
> Sharath.
>
> --- On Wed, 6/25/08, Paweł Wielgus <poulwiel@(protected):
>
> From: Paweł Wielgus <poulwiel@(protected)>
> Subject: Re: weird problem <s:iterator> tag.
> To: "Struts Users Mailing List" <user@(protected)
> Date: Wednesday, June 25, 2008, 5:38 PM
>
>
> Hi Sarath,
> where from this deploymentVersion is from (action, session)?
> Such construction works for me in many places, so i would like to
> replicate this problem.
>
> Best greetings,
> Paweł Wielgus.
>
>
> 2008/6/25 sharath karnati <karnatis@(protected)>:
> > Hi All,
> >
> > In .jsp file, I'm having following code which is using
> <s:iterator> tag.
> >
> > <s:iterator value="userCommentsList"
> id="usercomment">
> > <tr>
> > <td align="center"> <s:property
> value="#usercomment.projectNm" /> </td>
> > <td align="center"> <s:property
> value="#usercomment.subject" /> </td>
> > <td align="center"> <s:property
> value="#usercomment.comments" /> </td>
> >
> > <s:if test="%{deploymentVersion !='All'}">
> > <td align="center"> <s:date
> name="#usercomment.closingDate" format="MM/dd/yyyy" />
> </td>
> > </s:if>
> > </tr>
> > </s:iterator>
> >
> > The <s:iterator> tag is showing properties values(projectNm,
> subject,comments)correctly. 'deploymentVersion' property is not a
> member of 'usercomment' and when it is having value 'All'
> still it is displaying '#usercomment.closingDate' value. I think that
> it is not validating <s:if> condition correctly inside
> <s:iterator>. If I move this condition outside of <s:iterator> it
> is working as expected.
> >
> > Please let me know, how to validate the properties which are not member
> of <s:iterator> value.
> >
> > Thanks,Sharath.
> >
> >
> >
> >
>
>
>

Attachment:
user_188109.ezm (zipped)
I'm following the "How do we repopulate controls when validation fails" FAQ located at...
http://struts.apache.org/2.x/docs/how-do-we-repopulate-controls-when-validation-fails.html
Of the two methods it suggests I am trying to use the 'action tag' method. Using the simple example from the FAQ works fine, but once I move beyond the simple and try to drop my "Languages" control inside the tag of another action I have problems.
Here's my pseudo JSP (note MyAction)...
MyAction implements validateable and I am validating foo0 and foo1 inside the validate() method. Here's my validate() code...
public void validate() {
if (foo0 == null || foo0.length() == 0)
addFieldError("foo0", "Foo0 is required");
else
foo0 = foo0 + " VALIDATED";
if (foo1 == null || foo1.length() == 0)
addFieldError("foo1", "Foo1 is required");
else
foo1 = foo1 + " VALIDATED";
}
The important thing to note about my validation code is that when the validation succeeds the data entered by the user is updated with the word "VALIDATED". This may seem like an odd thing to do, but it's part of the requirements of the project I'm working on.
Visiting http://localhost/MyAction/myAction_input.action works great. The page draws, foo0 is empty, the languages control has languages to choose from, foo1 is empty, the submit button appears. Submitting the form is when I get into problems. Here are three submit paths and their results...
1. foo0 is empty, foo1 is empty. click submit. RESULT - foo0 is empty. foo1 is empty. SUCCESS!
2. foo0 = 'A', foo1 is empty. click submit. RESULT - page redraws. foo0 = 'A VALIDATED'. foo1 is empty. SUCCESS!
3. foo0 is empty, foo1 = 'A'. click submit. RESULT - page redraws. foo0 is empty. foo1 = 'A'. FAIL! - foo1 should say 'A VALIDATED'
For some reason MyAction.setFoo1() is being invoked *again* after I set foo1 to 'A VALIDATED' in my validate() code. Why is that happening? I know it has something to do with the Languages control that appears before the foo1 text field, because when I remove the Languages control everything works as expected.
Anyone have any ideas about what the Languages control is doing that is causing my foo1 field to get reset to the original submit value? I'd really like to be able to use the 'action tags' approach for repopulating controls, but 'dropping wherever', as suggested in the FAQ (see link above), does not seem to be as easy as it sounds.
Thanks.
_________________________________________________________________
The other season of giving begins 6/24/08. Check out the i’m Talkathon.
http://www.imtalkathon.com?source=TXT_EML_WLH_SeasonOfGiving

Attachment:
user_188110.ezm (zipped)
Trying again to give out my pseudo JSP...
s:form name="myAction"
s:textfield name="foo0"/
s:action name="languages" executeResult="true"/
s:textfield name="foo1"/
s:submit/
/s:form
> From: bobfuller30004@(protected)
> To: user@(protected)
> Subject: Struts 2 - Repopulate controls when validation fails
> Date: Thu, 26 Jun 2008 02:14:28 +0000
>
>
> I'm following the "How do we repopulate controls when validation fails" FAQ located at...
>
> http://struts.apache.org/2.x/docs/how-do-we-repopulate-controls-when-validation-fails.html
>
> Of the two methods it suggests I am trying to use the 'action tag' method. Using the simple example from the FAQ works fine, but once I move beyond the simple and try to drop my "Languages" control inside the tag of another action I have problems.
>
> Here's my pseudo JSP (note MyAction)...
>
>
>
>
>
>
>
>
>
> MyAction implements validateable and I am validating foo0 and foo1 inside the validate() method. Here's my validate() code...
>
> public void validate() {
> if (foo0 == null || foo0.length() == 0)
> addFieldError("foo0", "Foo0 is required");
> else
> foo0 = foo0 + " VALIDATED";
>
> if (foo1 == null || foo1.length() == 0)
> addFieldError("foo1", "Foo1 is required");
> else
> foo1 = foo1 + " VALIDATED";
> }
>
> The important thing to note about my validation code is that when the validation succeeds the data entered by the user is updated with the word "VALIDATED". This may seem like an odd thing to do, but it's part of the requirements of the project I'm working on.
>
> Visiting http://localhost/MyAction/myAction_input.action works great. The page draws, foo0 is empty, the languages control has languages to choose from, foo1 is empty, the submit button appears. Submitting the form is when I get into problems. Here are three submit paths and their results...
>
> 1. foo0 is empty, foo1 is empty. click submit. RESULT - foo0 is empty. foo1 is empty. SUCCESS!
> 2. foo0 = 'A', foo1 is empty. click submit. RESULT - page redraws. foo0 = 'A VALIDATED'. foo1 is empty. SUCCESS!
> 3. foo0 is empty, foo1 = 'A'. click submit. RESULT - page redraws. foo0 is empty. foo1 = 'A'. FAIL! - foo1 should say 'A VALIDATED'
>
> For some reason MyAction.setFoo1() is being invoked *again* after I set foo1 to 'A VALIDATED' in my validate() code. Why is that happening? I know it has something to do with the Languages control that appears before the foo1 text field, because when I remove the Languages control everything works as expected.
>
> Anyone have any ideas about what the Languages control is doing that is causing my foo1 field to get reset to the original submit value? I'd really like to be able to use the 'action tags' approach for repopulating controls, but 'dropping wherever', as suggested in the FAQ (see link above), does not seem to be as easy as it sounds.
>
> Thanks.
>
>
>
>
>
>
>
>
>
>
>
> _________________________________________________________________
> The other season of giving begins 6/24/08. Check out the i’m Talkathon.
> http://www.imtalkathon.com?source=TXT_EML_WLH_SeasonOfGiving
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
_________________________________________________________________
The i’m Talkathon starts 6/24/08. For now, give amongst yourselves.
http://www.imtalkathon.com?source=TXT_EML_WLH_LearnMore_GiveAmongst

Attachment:
user_188116.ezm (zipped)Hi,
As I know, use of s:action tag should be avoided, the better option is
to use Preparable interface, you can use prepare<MethodName>() method
also.
http://struts.apache.org/2.x/docs/prepare-interceptor.html
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_188111.ezm (zipped)Dear All,
I am building my first Struts 2 application. I'm using maven 2.0.9, jdk
1.6.0_06 and jetty 6.1.10 to deploy inline in maven.
Here is my src/main/resources/struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" namespace="/" extends="struts-default">
</package>
<include file="net/ruready/web/front/front.xml" />
</struts>
It points to front.xml, which sits in
src/main/java/net/ruready/web/front and looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="front" extends="struts-default">
<!-- Home page -->
<action name="home">
<result>/jsp/front/home.jsp</result>
</action>
</package>
</struts>
However, when I run "mvn jetty:run", Struts 2 doesn't find the action
"front/home.action". I looked in the target directory as well as in the
war file packaged with the command "mvn package", and I saw that
front.xml was NOT included in WEB-INF/classes/net/ruready/web/front. How
can I include it? I would like to use xml files in my source folders. I
tried to tweak the maven war plugin but to no avail.
Could you kindly help me?
Thanks,
Oren
--
===========================================================================
I can stand brute force, but brute reason is quite unbearable.
-- Oscar Wilde
---------------------------------------------------------------------------
Oren Livne, Ph.D.
RUReady Software Architect
Academic Outreach and Continuing Education, 1901 E South Campus Dr.
Room 2197-D, University of Utah, Salt Lake City, UT 84112-9399
Tel : (801) 581-6831 Cell: (801) 631-3885 Fax: (801) 585-5414
Email: olivne@(protected)
===========================================================================

Attachment:
user_188114.ezm (zipped)Hi
> <package name="front" extends="struts-default">
Add namespace attribute like this namespace="/front"
> However, when I run "mvn jetty:run", Struts 2 doesn't find the action
> "front/home.action". I looked in the target directory as well as in the war
> file packaged with the command "mvn package", and I saw that front.xml was
> NOT included in WEB-INF/classes/net/ruready/web/front. How can I include it?
Put fron.txml file with whole path under src/main/resources, maven
only looks for classes from src/main/java and all other *.proeprties,
*.xml should be unser src/main/resources
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_188112.ezm (zipped)Hi Laurie / Dave,
can you please help on this?
---------- Forwarded message ----------
From: Narayana S <narayanasgs1@(protected)>
Date: Tue, Jun 24, 2008 at 3:12 PM
Subject: Re: Struts Themes Problem - help
To: Struts Users Mailing List <user@(protected)
Hi laurie,
<s:form action="TestAction" method="post">
<s:label key="app.indexheader" />
<s:textfield name="cname" key="app.cname"/><br>
This is a part of the form i am creating, when the theme is default(xhtml)
the label could get value app.indexheader from resource bundle and working
fine, the text fields also could generate a label with the values given for
app.cname, but when simple theme is given ( like <s:form action="TestAction"
method="post" theme="simple"> ) the label is not rendered!!
can you help me on solving this >?
On Mon, Jun 23, 2008 at 11:18 PM, Laurie Harper <laurie@(protected):
> Narayana S wrote:
>
>> Hi Dave,
>>
>> thanks for your reply, but when i use simple theme, my application is
>> not getting any values from resource bundle..
>>
>
> How is it failing? Note that the 'simple' theme generates a lot less
> markup, and doesn't generate everything the other themes do. Are I18N
> resources failing to get resolved, or is the theme just not generating the
> things you were expecting to see?
>
> will this problem be solved by extending theme ?
>>
>> can you provide any best link to extend a theme if it is the solution... ?
>>
>
> See the Themes and Templates documentation:
>
> http://struts.apache.org/2.0.11.1/docs/themes-and-templates.html
>
> L.
>
>
> On Sun, Jun 22, 2008 at 8:25 PM, Dave Newton <newton.dave@(protected)>
>> wrote:
>>
>> --- On Sun, 6/22/08, Narayana S <narayanasgs1@(protected):
>>>
>>>> The problem is here struts 2 is applying it's own styles to
>>>> my page, i want to give my own styles instead of using struts
>>>> default styles,
>>>>
>>> The easiest answer is to just supply your own CSS styles. You can also
>>> extend an existing, or create your own, theme.
>>>
>>> Dave
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_188113.ezm (zipped)Hi,
Even I've this problem... Here is my requirement....
I've 3 fields. On successful validation of 1st field ONLY the 2nd field
should be validated, and only with the successful validation of second,
then only the 3rd field should be validated against some validation.
I did this by using field validator of type expression, like below...
*<validators>
<field name="returnTo">
<field-validator type="requiredstring" >
<message>Select 'Return to'</message>
</field-validator>
</field>
<field name="sourceId">
<field-validator type="fieldexpression">
<param name="expression">
<![CDATA[((returnTo == null) ||
((sourceId != null) && (sourceId != "--
Select --")))]]></param>
<message>Select company/dealer name</message>
</field-validator>
</field>
<field name="drug">
<field-validator type="fieldexpression">
<param name="expression">
<![CDATA[(((returnTo == null) || ((sourceId == null)
|| (sourceId == "-- Select --"))) ||
((drugsList.size <= 0) || ((drug != null)
&& (drug != "-- Select --"))))]]></param>
<message>Select drug</message>
</field-validator>
</field>
</validators>*
With this, the second case working as it supposed. The second field will
be validated ONLY when the first field is not empty (as in the second
field expression, I m using */returnTo == null/* with short-circuit OR,
and then the actual validation logic of second field).
But the validation logic of the third field (select box) is not working
as is supposed to. When I print the expression value using *<s:property
value="expression_of_the_third_field_....."/>*, it is printing false,
but the validation is being bypassed.
I've tried many ways. But non of 'em worked for me. Is any one got
success with this type of validations.
I can implement custom validation using validate(), but I've around 30
transactional forms with this type of requirements.
Am I doing any this wrong? Can anybody please guide me with this...
Thanks,
ManiKanta
Dave Newton wrote:
> You either do conditional validations, implement custom validators, or as Lukasz suggested write your own validate() method. When validation is very complex the last may be the best options.
>
> Dave
>
> --- On Wed, 6/25/08, Istvan Kozma <kozma_istvan@(protected):
>
>> How the validation should be done for fields which are only
>> displayed in certain conditions? If I do this through the
>> XML file the validation is done all the time even when the
>> field is not visible.
>>
>> Istvan
>>
>>
>> ----- Original Message ----
>> From: Dave Newton <newton.dave@(protected)>
>> To: Struts Users Mailing List
>> <user@(protected)>
>> Sent: Wednesday, June 25, 2008 3:37:38 PM
>> Subject: Re: validation problem
>>
>> Whoops, as the other reply said, it's the
>> <s:fielderror...> tag [1], not <s:actionerror>.
>>
>> Dave
>>
>> [1] http://struts.apache.org/2.x/docs/fielderror.html
>>
>> --- On Wed, 6/25/08, Dave Newton
>> <newton.dave@(protected):
>>
>>> --- On Wed, 6/25/08, Anshu Dhamija wrote:
>>>
>>>> i am facing problem in performing validation
>>>>
>> through
>>
>>>> xml actually i want to display message at the top
>>>>
>> of
>>
>>>> my form instaed of at field level
>>>> can anyone please help me
>>>>
>>> The validation messages are placed in the form by the
>>>
>> S2
>>
>>> form element tags. If you want to modify the output of
>>> those tags you can modify or create a theme [1].
>>>
>>> Using the "simple" theme will also remove
>>>
>> the
>>
>>> validation messages, but you'll lose other useful
>>> functionality--but that might not be an issue
>>>
>> depending on
>>
>>> your usecase.
>>>
>>> The <s:actionerror...> tag [2] will render any
>>>
>> error
>>
>>> messages. A combination of either the simple theme or
>>>
>> a
>>
>>> modified theme plus the action error tag may do what
>>>
>> you
>>
>>> need.
>>>
>>> Dave
>>>
>>> [1]
>>>
>>>
>> http://struts.apache.org/2.x/docs/themes-and-templates.html
>>
>>> [2] http://struts.apache.org/2.x/docs/actionerror.html
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail:
>> user-help@(protected)
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to
Sify Limited and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If this is a
forwarded message, the content of this E-MAIL may not have been sent with
the authority of the Company. If you are not the intended recipient, an
agent of the intended recipient or a person responsible for delivering the
information to the named recipient, you are notified that any use,
distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you have
received this communication in error, please delete this mail & notify us
immediately at admin@(protected)

Attachment:
user_188115.ezm (zipped)> I can implement custom validation using validate(), but I've around 30
> transactional forms with this type of requirements.
Maybe it will be better if you implement your own validator for thoese
30 forms? I think it will be soft option then very compilcated
expression above ;-)
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_188118.ezm (zipped)Hi,
Just want to know how to get all sessions.
now, I used a listener to add ActionContext.getContext().getSession()
to a list by myself, I just wondering maybe there is a struts API can
get all sessions.
Thanks.
Joey

Attachment:
user_188119.ezm (zipped)Hi,
The best option is to build your own session listener like that [1]
and register it with web.xml
[1] http://www.java2s.com/Code/Java/Servlets/Servletsessionlistener.htm
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_188120.ezm (zipped)Hi Joey, i think this is not a struts issue. As far as i know, you can't
access all sessions with servlet 2.3 compliant container (i don't know
earlier versions)
You can try to use session listeners to session store info in a common
place or jmx solution.
El jue, 26-06-2008 a las 18:53 +0800, Joey escribió:
> Hi,
>
> Just want to know how to get all sessions.
> now, I used a listener to add ActionContext.getContext().getSession()
> to a list by myself, I just wondering maybe there is a struts API can
> get all sessions.
>
> Thanks.
>
> Joey
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
--
;-)
____________________________________
Jorge Martin Cuervo
Outsourcing Emarketplace
deFacto Powered by Standards
email <jorge.martin@(protected)>
voice +34 984 832 659
voice +34 660 026 384
____________________________________
DE FACTO STANDARDS, S.L., le informa que su dirección de correo electrónico, así
como el resto de los datos de carácter personal que nos facilite, serán objeto
de tratamiento automatizado en nuestros ficheros, con la finalidad del envío de
información comercial y/o personal por vía electrónica. Vd. podrá en cualquier
momento ejercer el derecho de acceso, rectificación, cancelación y oposición en
los términos establecidos en la Ley Orgánica de Protección de Datos de Carácter
Personal (LOPD. 15/1999), dirigiendo un escrito a C/ Rivero 31 1º Izda. - 33402
AVILES (Asturias), o a nuestra dirección de correo electrónico
(info@(protected)
e-mail es CONFIDENCIAL, siendo para uso exclusivo del destinatario arriba
mencionado. Si Usted lee este mensaje y no es el destinatario indicado, le
informamos que está totalmente prohibida cualquier utilización, divulgación,
distribución y/o reproducción de esta comunicación sin autorización expresa en
virtud de la legislación vigente. Si ha recibido este mensaje por error, le
rogamos nos lo notifique inmediatamente por esta misma vía y proceda a su
eliminación.
This e-mail contains information that will be added to our computerised guest
data base and will be trated in the strict confidence. If you wish to access,
correct, oppose or cancel your details, as specified the Law 15/99, December
13th, please send a certified letter to this effect to DE FACTO STANDARDS,
S.L.., (C/ Rivero 31 1º Izda. - 33402 AVILES (Asturias) SPAIN). If you read this
message, and is not the destinatary, we informal you that is forbidden anything
utility, distribution, divulgation or reproduction of this communication without
express authorization, of the present law. If you received this message for
mistake, we proud in order to the present law, immediate communication to us,
and please erase this e-mail

Attachment:
user_188121.ezm (zipped)On Thu, Jun 26, 2008 at 3:53 AM, Joey <joey.information@(protected):
> Just want to know how to get all sessions.
> now, I used a listener to add ActionContext.getContext().getSession()
> to a list by myself, I just wondering maybe there is a struts API can
> get all sessions.
AFAIK there is no 'getSessions' method anywhere in the Servlet spec.
(You should be able to see the session you are in, but not the
others.)
What problem are you trying to solve by doing this?
--
Wendy

Attachment:
user_188123.ezm (zipped)
I want to test an action with jUnit. I have found a way to test Struts2 from
http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit
this tutorial. I set the configuration file to struts.xml file. It works as
expected if I do not include tiles.
My test class extends BaseStrutsTestCase, and the place where I set the
configuration file is
private static final String CONFIG_LOCATIONS = "file:src/struts.xml" ;
------------struts.xml ----------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="pack" namespace = "/" extends="struts-default">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="Name">
<result type="tiles"> tvq.NameCollector </result>
</action>
<action name="HelloWorld" class = "pack.HelloWorld">
<result name = "SUCCESS" type="tiles" >tvq.ListTasks</result>
<result name = "ERROR" >/error.jsp</result>
</action>
<action name="AddTask">
<result type="tiles"> tvq.addTask</result>
</action>
</package>
</struts>
If I include the tiles part in struts.xml, it gives a NullPointerException :
java.lang.NullPointerException
at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:355)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:141)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:248)
at
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:124)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:170)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:170)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:104)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:84)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:208)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:88)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:130)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:137)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:130)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.DefaultActionProxy.execute(DefaultActionProxy.java:130)
at pack.HelloWorldTest.testHelloWorldAction(HelloWorldTest.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
If you look at the tutorial I refer, you can understand that I am not the
only one who have this problem. I try to set the configuration file to
tiles.defs.xml as suggested, but it gave an XML parse exception. What can
be the solution;?
Thanks
jUnit newbie Ezgi :)
--
Sent from the Struts - User mailing list archive at Nabble.com.