Author Login
Post Reply
user Digest 25 Jun 2008 14:59:55 -0000 Issue 8108
Topics (messages 188051 through 188080):
Re: html:link throwing null pointer
188051 by: Antonio Petrelli
188052 by: Dimitris Mouchritsas
188055 by: Antonio Petrelli
Re: Closing tag for html:hidden
188053 by: Dimitris Mouchritsas
Re: Struts Validator Framework: client-side validation problem with submitting buttons
188054 by: cacodemon79
Jazoon 08 conference wo/Struts 2 :(
188056 by: Giovanni Azua
188057 by: Musachy Barroso
188059 by: Ian Roughley
Struts Validator Framework: problem with Custom Validator
188058 by: cacodemon79
use OGNL to automatically look in the session?
188060 by: Brad A Cupit
188061 by: Dave Newton
188062 by: Musachy Barroso
188063 by: Brad A Cupit
188064 by: Martin
188065 by: Brad A Cupit
188066 by: Chris Pratt
188067 by: Brad A Cupit
188079 by: Brad A Cupit
internationalization problem..
188068 by: Narayana S
188073 by: Narayana S
188075 by: Dave Newton
Re: Slow performance with Struts2
188069 by: yorlick kilroy
188070 by: Pawe³ Wielgus
188071 by: Pawe³ Wielgus
[S2] autocompleter action extension
188072 by: Pierre Goupil
validation problem
188074 by: Anshu Dhamija
188076 by: Dave Newton
188077 by: ManiKanta G
188078 by: Dave Newton
Struts2 UI Tag HTML Compliance?
188080 by: albertooi
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_188051.ezm (zipped)2008/6/24 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
> I've corrected the code and I'm trying to find out how to rebuild struts.
I don't think it is necessary, it has been released in 1.3.9.
http://struts.apache.org/download.cgi#struts139
Antonio

Attachment:
user_188052.ezm (zipped)Antonio Petrelli wrote:
> 2008/6/24 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
>
>> I've corrected the code and I'm trying to find out how to rebuild struts.
>>
>
> I don't think it is necessary, it has been released in 1.3.9.
> http://struts.apache.org/download.cgi#struts139
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
But 1.3.9 is still beta. btw do you know when it will be released?
Anyway I've just installed the new jar and everything is working great now.
A great thank you to you Antonio, for all your support.
Dimitris

Attachment:
user_188055.ezm (zipped)2008/6/24 Dimitris Mouchritsas <dimitris.mouchritsas@(protected)>:
> But 1.3.9 is still beta. btw do you know when it will be released?
Struts 1.3.9 is release. It was declared as beta for this bug:
https://issues.apache.org/struts/browse/STR-3081
See the mail thread:
http://www.nabble.com/-S1---VOTE--Struts-1.3.9-Quality-td11486284.html
Eventually you want Struts 1.3.10 to be released, but for these
questions I think you may want to ask the Struts Developers mailing
list:
http://struts.apache.org/dev/dev-mail.html
Antonio

Attachment:
user_188053.ezm (zipped)Martin wrote:
> Dimitris
> Congratulations..I think You found a bug
>
> /WEB-INF/struts-config.xml
> /WEB-INF/classes/ApplicationResources.properties
> prompt.search=Search
> prompt.Greece=Greece
> prompt.advanced.search=AdvancedSearch
>
> <html>
> <head>
> <%@(protected)"%>
> <%@(protected)"%>
> </head>
> <body>
> <bean:define id="curDate" value="01-01-1970"/>
> <div id="Search">
> <p class="Time">
> <bean:message key="prompt.Greece" />
> <bean:write name="curDate" format="HH:mm:ss zz" />
> </p>
> <form action="#">
> <p>
> <label for="SearchSelect"><bean:message
> key="prompt.search"/>:</label>
> <select name="SearchSelect" id="SearchSelect">
> <option selected="selected">Select...</option>
> </select>
> <input type="text" name="SearchInput" id="SearchInput"
> class="Text" />
> <input type="submit" name="SearchBTN" id="SearchBTN"
> class="SearchBTN" value="Search" />
> <html:link action="prepareAdvancedSearch">
> <bean:message key="prompt.advanced.search" />
> </html:link>
> <a href="#">Advanced Search</a>
> </p>
> </form>
> </div>
> </body>
> </html>
>
> displays properly..if I change
> ----- Original Message ----- From: "Dimitris Mouchritsas"
> <dimitris.mouchritsas@(protected)>
> To: "Struts Users Mailing List" <user@(protected)>
> Sent: Tuesday, June 24, 2008 9:17 AM
> Subject: Re: Closing tag for html:hidden
>
>
>> Dimitris Mouchritsas wrote:
>>> Well, one solution is to move the tld's to a directory and define
>>> them in web.xml. This seems to be working.
>>> However I've got some strange problems. For example in a tile I
>>> render a link for advanced search:
>>>
>>> <%@(protected)"%>
>>> <%@(protected)"%>
>>>
>>> <%--<bean:define id="currentDate" name="java.util.Date"
>>> type="java.util.Date" />--%>
>>> <jsp:useBean id="curDate" class="java.util.Date" />
>>> <div id="Search">
>>> <p class="Time">
>>> <bean:message key="prompt.Greece" />
>>> <bean:write name="curDate" format="HH:mm:ss zz" />
>>> </p>
>>> <form action="#">
>>> <p>
>>> <label for="SearchSelect"><bean:message
>>> key="prompt.search" />:</label>
>>> <select name="SearchSelect" id="SearchSelect">
>>> <option selected="selected">Select...</option></select>
>>> <input type="text" name="SearchInput" id="SearchInput"
>>> class="Text" />
>>> <input type="submit" name="SearchBTN" id="SearchBTN"
>>> class="SearchBTN" value="Search" />
>>> <html:link action="prepareAdvancedSearch">
>>> <bean:message key="prompt.advanced.search" />
>>> </html:link>
>>> <%--<a href="#">Advanced Search</a>--%>
>>> </p>
>>> </form>
>>> </div><!-- Search -->
>>>
>>> and I get
>>>
>>> javax.servlet.jsp.JspException: ServletException in
>>> '/WEB-INF/jsp/common/search.jsp': null
>>> at
>>> org.apache.struts.tiles.taglib.InsertTag$InsertHandler.doEndTag(InsertTag.java:927)
>>>
>>> at
>>> org.apache.struts.tiles.taglib.InsertTag.doEndTag(InsertTag.java:465)
>>> at _web_2d_inf._jsp._common._layout._jspService(_layout.java:133)
>>> [SRC:/WEB-INF/jsp/common/layout.jsp:80]
>>>
>>> I know it's the link, because if I comment it out I get an exception
>>> on a different jsp and
>>> the tile shows up.
>>> I've also testet <bean:message> outside the link and it works.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>> BTW is there an option in struts-config.xml (for v.1.3.8 at least) or
>> somewhere else to notify struts to use xhtml compatible elements
>> everywhere? So as to avoid having <html:xhtml /> in every jsp?
>>
>> Dimitris
>>
>> ---------------------------------------------------------------------
>> 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)
>
The bug report already exists and it's from last year, see:
https://issues.apache.org/struts/browse/STR-3015

Attachment:
user_188054.ezm (zipped)
Thank you very much.
Laurie Harper wrote:
>
> I did what I should have done in the first place and looked it up:
> Form.submit() is specified to *not* call the onsubmit handler, so this
> is the correct behaviour (and should be consistent across all browsers).
>
> When in doubt, check the documentation :-)
>
> L.
>
> cacodemon79 wrote:
>> Bingo!
>> Now it works!
>> Thanks a lot.
>> However i can't understand why the onsubmit handler is not triggered by
>> the
>> submit() function!
>>
>>
>> Laurie Harper wrote:
>>> Did you confirm whether calling the form's submit() method triggers its
>>> onsubmit handler? It may be that calling submit() bypasses it, in which
>>> case an explicit guard in your submit function might do the trick:
>>>
>>> function submitRegistrazioneUtenteForm(nomeForm){
>>> var form = ...;
>>> if (validateRegistrazioneUtenteForm(form)) {
>>> form.submit();
>>> }
>>> return false;
>>> }
>>>
>>> L.
>>>
>>> cacodemon79 wrote:
>>>> No suggestions? :(
>>>>
>>>> I also tried to use
>>>> document.registrazioneUtenteForm.submit()")
>>>> instead of
>>>> eval("document."+nomeForm+".submit()")
>>>> but the result is the same. The form is submitted but I can't see any
>>>> javascript alerts.
>>>>
>>>> I can't understand where is the problem.
>>>>
>>>> I hope you can help me.
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>> cacodemon79 wrote:
>>>>> Hi, I'm using Struts Validator Framework (Struts 1.3).
>>>>> Server-side validation works well.
>>>>> The problem is in client-side validation.
>>>>>
>>>>> The form name I have to validate is: RegistrazioneUtenteForm.
>>>>>
>>>>> In my jsp page I have 2 buttons:
>>>>> 1) <html:link
>>>>> href="javascript:submitRegistrazioneUtenteForm('registrazioneUtenteForm')"><bean:message
>>>>> key='form.submit'/></html:link>
>>>>> 2) <html:submit />
>>>>> and the following form declaration:
>>>>> <html:form action="/registrazioneUtente" method="post"
>>>>> focus="username"
>>>>> onsubmit="return validateRegistrazioneUtenteForm(this)">
>>>>> Moreover I have enabled javascript validation:
>>>>> <html:javascript formName="registrazioneUtenteForm" cdata="false" />
>>>>>
>>>>> The javascript function submitRegistrazioneUtenteForm is the
>>>>> following:
>>>>> function submitRegistrazioneUtenteForm(nomeForm){
>>>>> eval("document."+nomeForm+".submit()");
>>>>> }
>>>>>
>>>>> If I click on the second button (html:submit), all works well (I get
>>>>> javascript alerts).
>>>>> If I click on the first button (html:link), the form is submitted but
>>>>> I
>>>>> can't see any javascript alerts.
>>>>>
>>>>> I can't understand where is the problem.
>>>>>
>>>>> Can you help me?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188056.ezm (zipped)Hi,
I attended today the Jazoon conference here in Zurich and there were no
Struts2 presentations... pity :( ... maybe next year?
http://jazoon.com/en.html
There were many interesting topics covered e.g. Ajax push framework
<http://www.icefaces.org/> where different parts of a page are rendered
using AJAX without an explicit request initiated from the page i.e. the web
server proactively pushing the data onto the specific client page. I
actually recently needed such pattern but could only implement it in Struts2
by means of inefficient periodic polling using the Dojo remote div.
Regards,
Giovanni

Attachment:
user_188057.ezm (zipped)I think DWR implements this (comet right?) very nicely, check it out.
musachy
On Tue, Jun 24, 2008 at 3:11 PM, Giovanni Azua <bravegag@(protected):
> Hi,
>
> I attended today the Jazoon conference here in Zurich and there were no
> Struts2 presentations... pity :( ... maybe next year?
> http://jazoon.com/en.html
>
>
> There were many interesting topics covered e.g. Ajax push framework
> <http://www.icefaces.org/> where different parts of a page are rendered
> using AJAX without an explicit request initiated from the page i.e. the web
> server proactively pushing the data onto the specific client page. I
> actually recently needed such pattern but could only implement it in Struts2
> by means of inefficient periodic polling using the Dojo remote div.
>
> Regards,
> Giovanni
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_188059.ezm (zipped)I was thinking about submitting a talk for Jazoon - not sure what
happened, I think the deadline passed before I realized (and the
deadline, from what I remember, was really early - maybe 7 months before).
/Ian
Giovanni Azua wrote:
> Hi,
>
> I attended today the Jazoon conference here in Zurich and there were no
> Struts2 presentations... pity :( ... maybe next year?
> http://jazoon.com/en.html
>
>
> There were many interesting topics covered e.g. Ajax push framework
> <http://www.icefaces.org/> where different parts of a page are rendered
> using AJAX without an explicit request initiated from the page i.e. the web
> server proactively pushing the data onto the specific client page. I
> actually recently needed such pattern but could only implement it in Struts2
> by means of inefficient periodic polling using the Dojo remote div.
>
> Regards,
> Giovanni
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_188058.ezm (zipped)
I'm using Struts 1.3.
I'm trying to write a custom validator to check that 2 fields are identical.
1) I modified my validator-rules.xml by adding my own validator (called
"uguale"):
**************
validator-rules.xml
**************
<validator name="uguale"
classname="it.sfidiamoci.validator.ValidatorPersonalizzati"
method="validateUguale"
methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,org.apache.struts.action.ActionErrors,javax.servlet.http.HttpServletRequest"
depends="required"
msg="errors.uguale">
<javascript><![CDATA[
function validateUguale(form) {
var bValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oTwoFields = new twofields();
for (x in oTwoFields) {
var field = form[oTwoFields[x][0]];
var secondField = form[oTwoFields[x][2]("secondProperty")];
if (field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'select-one' ||
field.type == 'radio' ||
field.type == 'password') {
var value;
var secondValue;
// get field's value
if (field.type == "select-one") {
var si = field.selectedIndex;
value = field.options[si].value;
secondValue = secondField.options[si].value;
} else {
value = field.value;
secondValue = secondField.value;
}
if (value != secondValue) {
if (i == 0) {
focusField = field;
}
fields[i++] = oTwoFields[x][1];
bValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return bValid;
}]]></javascript>
</validator>
2) I modified my validation.xml by adding the new validator (called
"uguale"):
**************
validator-rules.xml
**************
<i<field property="password" depends="required,minlength,mask,uguale">
<arg position="0" key="errors.password" />
<arg position="1" name="minlength" key="${var:minlength}"
resource="false" />
<msg name="mask" key="errors.mask.password" />
<msg name="uguale" key="errors.password.uguale" />
<var>
<var-name>minlength</var-name>
<var-value>8</var-value>
</var>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z0-9_.]*$</var-value>
</var>
<var>
<var-name>secondProperty</var-name>
<var-value>password2</var-value>
</var>
</field>
3) I added the key "errors.password.uguale" in
ApplicationResources.properties
***********************
ApplicationResources.properties
***********************
errors.password.uguale=Le password inserite non sono uguali
4) I created the class "ValidatorPersonalizzati" to handle the custom
validator "validateUguale":
********************
ValidatorPersonalizzati.java
********************
package it.sfidiamoci.validator;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.util.ValidatorUtils;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.validator.Resources;
public class ValidatorPersonalizzati{
public static boolean validateUguale(Object bean, ValidatorAction va,Field
field, ActionErrors errors,HttpServletRequest request){
String value = ValidatorUtils.getValueAsString(bean,field.getProperty());
System.out.println("value="+value);
String sProperty2 = field.getVarValue("secondProperty");
String value2 = ValidatorUtils.getValueAsString(bean,sProperty2);
System.out.println("value2="+value2);
if (!GenericValidator.isBlankOrNull(value)){
try{
if (!value.equals(value2)){
errors.add(field.getKey(),Resources.getActionMessage(request, va,
field));
return false;
}
}
catch (Exception e){
errors.add(field.getKey(),Resources.getActionMessage(request, va,
field));
return false;
}
}
return true;
}
}
5) I have two fields ("password", "password2") to check in my jsp:
******
test.jsp
******
<tr>
<td class="col1"><bean:message
key='registrazioneUtente.password.label'/></td>
<td><html:password property="password" styleId="password"
maxlength="<%= passwordMaxLength %>" /></td>
<td><bean:message key='registrazioneUtente.password2.label'/></td>
<td><html:password property="password2" styleId="password2"
maxlength="<%= passwordMaxLength %>" /></td>
</tr>
When I submit the form in my jsp, standard validations (e.g. required,
minlength, ...) of other fields are performed in the correct way.
Instead, my own validation called "uguale" ("password==password2") doesn't
work!
On the client-side, I see a javascript warning in browser: "twofields is not
defined" but no javascript alert.
On the server-side, I get the following exception:
value=cvcxvxvczczx
value2=czzxcczxczczczcz
24-giu-2008 20.54.30 org.apache.commons.validator.ValidatorAction
executeValidationMethod
GRAVE: Unhandled exception thrown during validation: null
java.lang.NullPointerException
at
it.sfidiamoci.validator.ValidatorPersonalizzati.validateUguale(ValidatorPersonalizzati.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:544)
at org.apache.commons.validator.Field.validateForRule(Field.java:796)
at org.apache.commons.validator.Field.validate(Field.java:876)
at org.apache.commons.validator.Form.validate(Form.java:288)
at org.apache.commons.validator.Validator.validate(Validator.java:351)
at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:116)
at
org.apache.struts.chain.commands.servlet.ValidateActionForm.validate(ValidateActionForm.java:58)
at
org.apache.struts.chain.commands.AbstractValidateActionForm.execute(AbstractValidateActionForm.java:120)
at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
In the log I have left 2 System.out.println to be sure that "value" and
"value2" variables had the correct value submitted through the form.
Moreover, I'm not sure that
Resources.getActionMessage(request, va, field)
method in my custom validator class is correct. This method is deprecated
and I don't know how to replace it.
I can't understand where is the problem both on client-side and on
server-side validation.
Can you help me?
Thanks in advance.
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188060.ezm (zipped)I have an object that I need to access in a JSP, and the object has a
getter on my Action. When the page is initially viewed the object is
retrieved off the Value Stack, but if the user is redirected back to the
page (due to validation errors) the value comes from the session.
When using EL things work as expected: ${myObject.property} first looks
in the request, then in the session, so the page doesn't need any
special case code.
What I was hoping was the OGNL would check the Value Stack, and if it
didn't find it there, it would automatically look in the request, then
the session, etc.
I'm using the Scope plugin to put this object in the session (FLASH
scope), so unfortunately the object isn't there until after the result
has been executed.
The goal is to have the same syntax for accessing the object, regardless
of where the object is (on the ValueStack or in the session).
I've got a few ideas, but none of them are very nice.
Brad Cupit
Louisiana State University - UIS

Attachment:
user_188061.ezm (zipped)JSP EL? It checks JEE scopes first then the stack due to S2's custom request doohickey.
Dave
--- On Tue, 6/24/08, Brad A Cupit <brad@(protected):
> From: Brad A Cupit <brad@(protected)>
> Subject: use OGNL to automatically look in the session?
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Tuesday, June 24, 2008, 5:51 PM
> I have an object that I need to access in a JSP, and the
> object has a
> getter on my Action. When the page is initially viewed the
> object is
> retrieved off the Value Stack, but if the user is
> redirected back to the
> page (due to validation errors) the value comes from the
> session.
>
> When using EL things work as expected: ${myObject.property}
> first looks
> in the request, then in the session, so the page
> doesn't need any
> special case code.
>
> What I was hoping was the OGNL would check the Value Stack,
> and if it
> didn't find it there, it would automatically look in
> the request, then
> the session, etc.
>
> I'm using the Scope plugin to put this object in the
> session (FLASH
> scope), so unfortunately the object isn't there until
> after the result
> has been executed.
>
> The goal is to have the same syntax for accessing the
> object, regardless
> of where the object is (on the ValueStack or in the
> session).
>
> I've got a few ideas, but none of them are very nice.
>
> Brad Cupit
> Louisiana State University - UIS
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment:
user_188062.ezm (zipped)"#attr" does something similar:
http://struts.apache.org/2.x/docs/ognl.html
musachy
On Tue, Jun 24, 2008 at 5:51 PM, Brad A Cupit <brad@(protected):
> I have an object that I need to access in a JSP, and the object has a
> getter on my Action. When the page is initially viewed the object is
> retrieved off the Value Stack, but if the user is redirected back to the
> page (due to validation errors) the value comes from the session.
>
> When using EL things work as expected: ${myObject.property} first looks
> in the request, then in the session, so the page doesn't need any
> special case code.
>
> What I was hoping was the OGNL would check the Value Stack, and if it
> didn't find it there, it would automatically look in the request, then
> the session, etc.
>
> I'm using the Scope plugin to put this object in the session (FLASH
> scope), so unfortunately the object isn't there until after the result
> has been executed.
>
> The goal is to have the same syntax for accessing the object, regardless
> of where the object is (on the ValueStack or in the session).
>
> I've got a few ideas, but none of them are very nice.
>
> Brad Cupit
> Louisiana State University - UIS
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Attachment:
user_188063.ezm (zipped)Musachy Barroso wrote:
> "#attr" does something similar:
right, but it's kind of yucky in the sense that each of these objects
needs a block like this:
<s:if test="%{myObject == null}">
<s:set name="myObject" value="%{#session.myObject}" />
</s:if>
<s:else>
<s:set name="myObject" value="%{myObject}" />
</s:else>
and then I change use of it from:
<s:label value="%{myObject.property}" />
to:
<s:label value="%{#myObject.property}" />
I can live with that, but it seems like a step backward. JSP EL could
automatically look in the session, but now I have to explicitly state
that it's in the session.
Maybe I'm in the minority here...
Brad Cupit
Louisiana State University - UIS

Attachment:
user_188064.ezm (zipped)The OGNL creators/authors were definitely 'page' centric e.g.
#attr['foo'] or #attr.foo
resolves to
1)Access to PageContext if available, otherwise searches
2)request
3)session
4)application respectively
http://struts.apache.org/2.0.11.1/docs/ognl-basics.html
IMHO
Martin
----- Original Message -----
From: "Brad A Cupit" <brad@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Tuesday, June 24, 2008 6:19 PM
Subject: RE: use OGNL to automatically look in the session?
Musachy Barroso wrote:
> "#attr" does something similar:
right, but it's kind of yucky in the sense that each of these objects
needs a block like this:
<s:if test="%{myObject == null}">
<s:set name="myObject" value="%{#session.myObject}" />
</s:if>
<s:else>
<s:set name="myObject" value="%{myObject}" />
</s:else>
and then I change use of it from:
<s:label value="%{myObject.property}" />
to:
<s:label value="%{#myObject.property}" />
I can live with that, but it seems like a step backward. JSP EL could
automatically look in the session, but now I have to explicitly state
that it's in the session.
Maybe I'm in the minority here...
Brad Cupit
Louisiana State University - UIS
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_188065.ezm (zipped)Musachy Barroso wrote:
> "#attr" does something similar:
oh wow! you gave me the answer and I didn't read it!
I incorrectly assumed you were using attr to refer to a property on the
value stack. I should have followed the link instead of being arrogant.
Sorry!
Thanks for the answer Musachy! That's exactly what I was looking for!!
Brad Cupit
Louisiana State University - UIS

Attachment:
user_188066.ezm (zipped)According to http://struts.apache.org/2.0.11.1/docs/ognl-basics.html
"Struts 2 places request parameters and request, session, and
application attributes on the OGNL stack." So, you'd think you could
just request the attribute and it would search the stack for the
value, but I agree that I haven't seen this behavior work in practice.
#attr doesn't sound like it will work in your case since it only
searches the old four scopes, and never searches the value stack.
Your best bet might be to use the old JSP EL and let the, aptly named,
request doohickey check the value stack for you.
(*Chris*)
On Tue, Jun 24, 2008 at 3:19 PM, Brad A Cupit <brad@(protected):
> Musachy Barroso wrote:
>> "#attr" does something similar:
>
> right, but it's kind of yucky in the sense that each of these objects
> needs a block like this:
>
> <s:if test="%{myObject == null}">
> <s:set name="myObject" value="%{#session.myObject}" />
> </s:if>
> <s:else>
> <s:set name="myObject" value="%{myObject}" />
> </s:else>
>
> and then I change use of it from:
> <s:label value="%{myObject.property}" />
>
> to:
> <s:label value="%{#myObject.property}" />
>
> I can live with that, but it seems like a step backward. JSP EL could
> automatically look in the session, but now I have to explicitly state
> that it's in the session.
>
> Maybe I'm in the minority here...
>
> Brad Cupit
> Louisiana State University - UIS
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_188067.ezm (zipped)Chris Pratt wrote:
> #attr doesn't sound like it will work in your case since
> it only searches the old four scopes, and never searches
> the value stack.
After I figured out that Musachy had given me the right answer (and
Martin also gave the right answer), I was a little worried that this
wouldn't do what I wanted, which is to search the Value Stack, then the
page, then the request, then the session, then the application. So I
wrote a quick little experiment and #attr actually does search the value
stack.
I'm not sure which order the scopes are checked, but it works great for
my needs!
I wonder if the request that it's checking is the 'raw' request or the
specially-wrapped request which delegates to the value stack. If it's
the second one, then that makes sense why #attr does what I want!
Thanks again for the help guys!!
Brad Cupit
Louisiana State University - UIS

Attachment:
user_188079.ezm (zipped)Brad Cupit wrote:
> I'm not sure which order the scopes are checked
For anyone who's interested, #attr appears to check scopes in the
following order:
1. page / action *
2. request
3. value stack
4. session
5. application
* I used <s:set> to set one value at page scope and one at action scope,
and whichever was declared last was the one that #attr found first.
<s:set name="stuff" value="%{'action'}" scope="action" />
<s:set name="stuff" value="%{'page'}" scope="page" />
<s:label value="%{#attr.stuff}" />
outputs page
<s:set name="stuff" value="%{'page'}" scope="page" />
<s:set name="stuff" value="%{'action'}" scope="action" />
<s:label value="%{#attr.stuff}" />
outputs action
I'm not really sure what the action scope is. Perhaps it's only related
to <s:action>. Either way, maybe this post will help someone searching
the mailing list!
Brad Cupit
Louisiana State University - UIS

Attachment:
user_188068.ezm (zipped)Hi,
i am applying simple theme for my struts 2 page, when the theme is
default it could read values from resource bundle, after i changed theme to
simple, it couldn't read the values from the resource bundle.
<s:form action="SimpleAction" method="post" theme="simple">
<s:label key="app.indexheader" />
---
</s:form>
This is how i am creating the form. am i missing any thing? please help me.

Attachment:
user_188073.ezm (zipped)Hi,
please reply, i was kind of stuck because of this issue,.
On Wed, Jun 25, 2008 at 9:20 AM, Narayana S <narayanasgs1@(protected):
> Hi,
>
> i am applying simple theme for my struts 2 page, when the theme is
> default it could read values from resource bundle, after i changed theme to
> simple, it couldn't read the values from the resource bundle.
>
> <s:form action="SimpleAction" method="post" theme="simple">
> <s:label key="app.indexheader" />
> ---
> </s:form>
>
> This is how i am creating the form. am i missing any thing? please help me.
>
>

Attachment:
user_188075.ezm (zipped)People *have* responded, both Laurie and I attempted to help. We asked questions, we provided links. Not sure what else we can do--what about the help wasn't helpful?
Dave
--- On Wed, 6/25/08, Narayana S <narayanasgs1@(protected):
> From: Narayana S <narayanasgs1@(protected)>
> Subject: Re: internationalization problem..
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Wednesday, June 25, 2008, 7:15 AM
> Hi,
>
> please reply, i was kind of stuck because of this
> issue,.
>
> On Wed, Jun 25, 2008 at 9:20 AM, Narayana S
> <narayanasgs1@(protected):
>
> > Hi,
> >
> > i am applying simple theme for my struts 2
> page, when the theme is
> > default it could read values from resource bundle,
> after i changed theme to
> > simple, it couldn't read the values from the
> resource bundle.
> >
> > <s:form action="SimpleAction"
> method="post" theme="simple">
> > <s:label key="app.indexheader" />
> > ---
> > </s:form>
> >
> > This is how i am creating the form. am i missing any
> thing? please help me.
> >
> >

Attachment:
user_188069.ezm (zipped)Thanks for the performance-tuning links Dave. I Found a couple of
useful hints there.
Still... the "problem" seems to be the OGNL implementation in struts2.
It seems to me as if one should be VERY careful when using OGNL i.e.
make use of it very sparingly. in some of my jsps I descend fairly
deeply into my complex value objects consisting of maps and lists etc.
I dont have any benchmark results but it "feels" like the time taken
to render a jsp with lots of OGNL expressions increases exponentially
proportional to the depth of the used OGNL expression, for example:
<s:iterate ... >
<s:property value="#object.a.b.c.name"/>
<s:property value="#object.a.b.c.phone"/>
</s:iterate>
Which isn't a performance problem when writing the above code in pure
java - only when done in struts2 OGNL
Can anyone confirm this?
Perhaps OGNL is only meant to be used for accessing only immediate
properties of an object and not to descend down into complex
tree-object-graphs.?
--- Joe
On 6/24/08, Dave Newton <newton.dave@(protected):
> http://struts.apache.org/2.x/docs/performance-tuning.html
>
> Dave
>
>
> --- On Tue, 6/24/08, yorlick kilroy <wgtlogs@(protected):
>
>> From: yorlick kilroy <wgtlogs@(protected)>
>> Subject: Slow performance with Struts2
>> To: user@(protected)
>> Date: Tuesday, June 24, 2008, 10:23 AM
>> Hi,
>>
>> I was wondering if there is a way to tweak struts2
>> performance.
>> I ported an old struts1 application to struts2. I have jsps
>> that have
>> rather large and complex lists that I now iterate using
>> Struts2
>> <s:iterate> and OGNL instead of <logic:iterate>
>> and EL used in
>> struts1. I noticed that the performance using Struts2 is
>> pretty much
>> lower than that of the Struts1 application, especially when
>> displaying
>> large lists and descending into complex objects using OGNL.
>> I read that using dojo can cause this, but as far as I know
>> I'm not
>> (consciously) using dogo, ajax etc. just plain struts2
>> core.
>>
>> -- Joe
>>
>> ---------------------------------------------------------------------
>> 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_188070.ezm (zipped)Hi Joe,
i had similiar problem in struts
On 25/06/2008, yorlick kilroy <wgtlogs@(protected):
> Thanks for the performance-tuning links Dave. I Found a couple of
> useful hints there.
> Still... the "problem" seems to be the OGNL implementation in struts2.
> It seems to me as if one should be VERY careful when using OGNL i.e.
> make use of it very sparingly. in some of my jsps I descend fairly
> deeply into my complex value objects consisting of maps and lists etc.
> I dont have any benchmark results but it "feels" like the time taken
> to render a jsp with lots of OGNL expressions increases exponentially
> proportional to the depth of the used OGNL expression, for example:
>
> <s:iterate ... >
> <s:property value="#object.a.b.c.name"/>
> <s:property value="#object.a.b.c.phone"/>
> </s:iterate>
>
> Which isn't a performance problem when writing the above code in pure
> java - only when done in struts2 OGNL
>
> Can anyone confirm this?
>
> Perhaps OGNL is only meant to be used for accessing only immediate
> properties of an object and not to descend down into complex
> tree-object-graphs.?
>
> --- Joe
>
> On 6/24/08, Dave Newton <newton.dave@(protected):
> > http://struts.apache.org/2.x/docs/performance-tuning.html
> >
> > Dave
> >
> >
> > --- On Tue, 6/24/08, yorlick kilroy <wgtlogs@(protected):
> >
> >> From: yorlick kilroy <wgtlogs@(protected)>
> >> Subject: Slow performance with Struts2
> >> To: user@(protected)
> >> Date: Tuesday, June 24, 2008, 10:23 AM
> >> Hi,
> >>
> >> I was wondering if there is a way to tweak struts2
> >> performance.
> >> I ported an old struts1 application to struts2. I have jsps
> >> that have
> >> rather large and complex lists that I now iterate using
> >> Struts2
> >> <s:iterate> and OGNL instead of <logic:iterate>
> >> and EL used in
> >> struts1. I noticed that the performance using Struts2 is
> >> pretty much
> >> lower than that of the Struts1 application, especially when
> >> displaying
> >> large lists and descending into complex objects using OGNL.
> >> I read that using dojo can cause this, but as far as I know
> >> I'm not
> >> (consciously) using dogo, ajax etc. just plain struts2
> >> core.
> >>
> >> -- Joe
> >>
> >> ---------------------------------------------------------------------
> >> 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)
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_188071.ezm (zipped)Hi Joe,
sorry for the previus post, too fast fingers ;-)
Long time ago I had similiar problem in struts 1, when accesing lists
with logic:iterate it turned out that if i used <logic:iterate
name="bean" property="myList"> and this getMyList() method was not
really a getter but some logic that was building myList, logic:iterate
was accesing myList like getMyList().get(0), then getMyList().get(1)
and so on. Which obvoiusly kills the performance. I'm not using such
getters since then, but that may be the case in s2 also.
Best greetings,
Paweł Wielgus.
On 25/06/2008, Paweł Wielgus <poulwiel@(protected):
> Hi Joe,
> i had similiar problem in struts
>
>
> On 25/06/2008, yorlick kilroy <wgtlogs@(protected):
> > Thanks for the performance-tuning links Dave. I Found a couple of
> > useful hints there.
> > Still... the "problem" seems to be the OGNL implementation in struts2.
> > It seems to me as if one should be VERY careful when using OGNL i.e.
> > make use of it very sparingly. in some of my jsps I descend fairly
> > deeply into my complex value objects consisting of maps and lists etc.
> > I dont have any benchmark results but it "feels" like the time taken
> > to render a jsp with lots of OGNL expressions increases exponentially
> > proportional to the depth of the used OGNL expression, for example:
> >
> > <s:iterate ... >
> > <s:property value="#object.a.b.c.name"/>
> > <s:property value="#object.a.b.c.phone"/>
> > </s:iterate>
> >
> > Which isn't a performance problem when writing the above code in pure
> > java - only when done in struts2 OGNL
> >
> > Can anyone confirm this?
> >
> > Perhaps OGNL is only meant to be used for accessing only immediate
> > properties of an object and not to descend down into complex
> > tree-object-graphs.?
> >
> > --- Joe
> >
> > On 6/24/08, Dave Newton <newton.dave@(protected):
> > > http://struts.apache.org/2.x/docs/performance-tuning.html
> > >
> > > Dave
> > >
> > >
> > > --- On Tue, 6/24/08, yorlick kilroy <wgtlogs@(protected):
> > >
> > >> From: yorlick kilroy <wgtlogs@(protected)>
> > >> Subject: Slow performance with Struts2
> > >> To: user@(protected)
> > >> Date: Tuesday, June 24, 2008, 10:23 AM
> > >> Hi,
> > >>
> > >> I was wondering if there is a way to tweak struts2
> > >> performance.
> > >> I ported an old struts1 application to struts2. I have jsps
> > >> that have
> > >> rather large and complex lists that I now iterate using
> > >> Struts2
> > >> <s:iterate> and OGNL instead of <logic:iterate>
> > >> and EL used in
> > >> struts1. I noticed that the performance using Struts2 is
> > >> pretty much
> > >> lower than that of the Struts1 application, especially when
> > >> displaying
> > >> large lists and descending into complex objects using OGNL.
> > >> I read that using dojo can cause this, but as far as I know
> > >> I'm not
> > >> (consciously) using dogo, ajax etc. just plain struts2
> > >> core.
> > >>
> > >> -- Joe
> > >>
> > >> ---------------------------------------------------------------------
> > >> 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)
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>

Attachment:
user_188072.ezm (zipped)Hello all,
I would like my S2 project to be mapped to .html actions, so I have
set this up :
- struts.action.extension=html in my struts.properties
- <constant name="xwork.action.extension" value="html" /> in my
xwork-default.xml
- <constant name="struts.action.extension" value="html" /> in my
struts-default.xml.
Please note that for the two last ones, I have simply added the
property to the original file provided in the jar.
It works, in the sense that my actions respond and display my JSPs as
desired. BUT I can't figure out how to have the auto-completer tag to
work. If I use the .html extension, I get the following exception :
---
Could not find action or result
There is no Action mapped for action name ComboBox. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
---
I think this is because Struts is looking for an .action action
extension : if I revert back to the default .action extension, it all
works. But as you can guess, I would like to be able to use whatever
extension I wish to.
A clue, anyone ?
Thanx in advance,
Pierre GOUPIL

Attachment:
user_188074.ezm (zipped)hi
i am new to struts 2.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

Attachment:
user_188076.ezm (zipped)--- On Wed, 6/25/08, Anshu Dhamija <anshu.dhamija@(protected):
> 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

Attachment:
user_188077.ezm (zipped)Anshu Dhamija wrote:
> hi
> i am new to struts 2.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
>
>
Hi,
In struts2 there is a provision for handling the error messages by field
and action level.
If the message u want to display is not related to any particular field,
then u can use *<s:actionerrors />* tag at the top of ur page.
If the validation message is particular to a field, u can use
*<s:fielderrors />* tag at the top of the page. This will displays all
the field validation errors.
To display validation errors specific to a field, use *<s:fielderrors />
tag with <s:param>*, like below
*<s:fielderror>
<s:param>*/fieldName/*</s:param>
</s:fielderror>*
Like this u can place individual field errors in ur custom layout in ur
way, using tables, divs or something else.
When you explore the validation framework, what u see is more types of
validation, which includes field validatiors & non-field validators.
Field validators are specific to a field, and thus adds a field error.
Non-field validators are NOT specific to any single field and thus the
error message will be added as action level error (action error).
U can get more info regarding validations from Struts2 documentation.
Feel free to ask if u've need any clarification.
Regards,
ManiKanta G
********** 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_188078.ezm (zipped)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

Attachment:
user_188080.ezm (zipped)
Anyone aware if the Struts2 UI tags are HTML compliant? Which version of HTML
Specs? E.g 4.x? Need to ascertain which browser is supported if struts2 ui
tags are being used.
--
Sent from the Struts - User mailing list archive at Nabble.com.