Author Login
Post Reply
user Digest 12 Jul 2008 02:11:03 -0000 Issue 8136
Topics (messages 188738 through 188767):
[S1] Options from database for a view use case. Recommended way?
188738 by: Eduardo Pérez Ureta
Re: REST plugin URL syntax
188739 by: Wes Wannemacher
validation.xml and struts-config.xml error
188740 by: semaj2008
fileUpload vs custom servlet
188741 by: webdev2
188746 by: Joachim Rohde
188758 by: Laurie Harper
Re: getting Session from one to another namespace - possible?
188742 by: Michael Obster
Re: Struts-Tiles - Missing Content
188743 by: Antonio Petrelli
188744 by: Antonio Petrelli
Re: This is odd, sometimes my requests 'miss' the Struts2 filter
188745 by: Lyallex
188748 by: Alberto A. Flores
about security
188747 by: hns
188749 by: Struts Two
question about submitting checkboxes
188750 by: Eric Hamacher
textarea Encoding
188751 by: Juan Pablo Pizarro
188761 by: Joachim Rohde
For the authors of Mannings Struts 2 in Action, a question
188752 by: Lyallex
188753 by: Jim Kiley
188754 by: Wes Wannemacher
188759 by: Pawe³ Wielgus
@CustomValidator error
188755 by: tangy
188756 by: Dave Newton
188757 by: tangy
Re: [S2] Recipe for Action and View
188760 by: Andreas Mähler
188765 by: Gabriel Belingueres
188767 by: Andreas Mähler
Re: Struts2 application doesn't work with Firefox 3
188762 by: Pierrot52
188763 by: Dave Newton
Re: [S1] div update and struts
188764 by: Lalchandra Rampersaud
Problem with s:set and s:if
188766 by: Othon Reyes Sanchez
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_188738.ezm (zipped)I have a list of items in DB:
ITEMS contain rows ID and NAME
I would like to know what is the recommended way to have a form that
lets the user select an option from the database list of items and when
the uses clicks the preview action the selected item is shown prior to
the last action of confirmation.
Should I get the list of items from the form?
(setting it in the form does not make sense to me as a form is just for
user input and that list is not user input)
Or from the action? (request.setAttribute())
(setting them from the action associates that list with a view and I am
only supposed to let the controller know what to do next not what view to
display)
Or from any other place?
Could someone show me the recommended way on how to do it showing me the
Form(s), Actions and struts-config.xml?

Attachment:
user_188739.ezm (zipped)
http://struts.apache.org/2.x/docs/building-the-framework-from-source.html
The instructions are pretty straight-forward. If you've
never used maven
before, it's a bit tricky at first, but once you run
through it a few
times, it's pretty easy. If you're building from
trunk, then you might
want to grab the XWork2 sources and build them as well -
http://www.opensymphony.com/xwork/cvs.action
-Wes

Attachment:
user_188740.ezm (zipped)
Hi,
I am getting following errors in validation.xml and struts-config.xml at
line 1 in Eclipse.
Referenced file contains errors
(http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd). For more
information, right click on the message and select "Show Details..."
Referenced file contains errors
(http://struts.apache.org/dtds/struts-config_1_3.dtd). For more
information, right click on the message and select "Show Details..."
http://www.nabble.com/file/p18395591/Untitled.gif
Could anybody tell me what is causing the problem and how to resolve it?
Thank you,
semaj
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188741.ezm (zipped)
I upgraded my app to Struts2, which provides file uploading. Now my custom
servlet for uploading an attachment no longer receives the request. Is
there a configurable option for restoring the old functionality of having
the custom servlet upload the attachment? Thanks.
FYI - 1) Initially an exception was thrown as a result of
FilterDispatcher.doFilter handing off multipart handling. This was due to
a jar mismatch. So, I got the correct versions of the commons-io.jar and
commons-fileupload.jar, and the exception is gone. But my servlet never
receives the request. 2) I have a custom interceptor stack containing
defaultStack. That means the fileUpload interceptor is available.
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188746.ezm (zipped)If you don't need the file-upload interceptor then remove it from your
interceptor stack or exclude it for those actions which rely on your
custom fileupload-servlet.
webdev2 schrieb:
> I upgraded my app to Struts2, which provides file uploading. Now my custom
> servlet for uploading an attachment no longer receives the request. Is
> there a configurable option for restoring the old functionality of having
> the custom servlet upload the attachment? Thanks.
>
> FYI - 1) Initially an exception was thrown as a result of
> FilterDispatcher.doFilter handing off multipart handling. This was due to
> a jar mismatch. So, I got the correct versions of the commons-io.jar and
> commons-fileupload.jar, and the exception is gone. But my servlet never
> receives the request. 2) I have a custom interceptor stack containing
> defaultStack. That means the fileUpload interceptor is available.

Attachment:
user_188758.ezm (zipped)webdev2 wrote:
> I upgraded my app to Struts2, which provides file uploading. Now my custom
> servlet for uploading an attachment no longer receives the request. Is
> there a configurable option for restoring the old functionality of having
> the custom servlet upload the attachment? Thanks.
What old functionality? You don't mention what you upgraded *from*...
Struts 1? In any case, it sounds like the problem is probably a conflict
in you servlet/filter mappings in web.xml.
> FYI - 1) Initially an exception was thrown as a result of
> FilterDispatcher.doFilter handing off multipart handling. This was due to
> a jar mismatch. So, I got the correct versions of the commons-io.jar and
> commons-fileupload.jar, and the exception is gone. But my servlet never
> receives the request. 2) I have a custom interceptor stack containing
> defaultStack. That means the fileUpload interceptor is available.
The obvious question is, why use a custom servlet to handle uploads,
rather than let Struts deal with it for you? Does your servlet do some
special processing you can't easily migrate into an action?
L.

Attachment:
user_188742.ezm (zipped)Hi,
thanks for the hint, but I used namespace="/secure" already. Only typed
it wrong into the mail.
Also compared namespace names between struts.xml and my nav.jsp. Thats
also correct, so I looked if the user (a variable in the session) is
null. But the user is not null.
So it looks like there is another problem with the lib which connect to
LDAP server.
As I can see for the moment I have no problem with the session but with
my user object.
Cheers,
Michael
Randy Burgess schrieb:
> Is the namespace the same as what is defined in your struts.xml? Have you
> tried namespace="/secure" for instance?
>
> Regards,
> Randy Burgess
> Sr. Software Architect
> D5 Systems, LLC
>
>
>> The LoginAction forwards the user into the secure namespace. There I
>> have a menu with
>> <a href="<s:url action="action1" namespace="secure"/>">link1</a>
>> <a href="<s:url action="action2" namespace="secure"/>">link2</a>
>> <a href="
>> <s:url action="action3" namespace="usermanager"/>
>> ">link3</a>
>>

Attachment:
user_188743.ezm (zipped)2008/7/10 Ryan Henson <nwstraith@(protected)>:
> <logic:notPresent name="data">
> I do not see your data
> </logic:notPresent>
>
> <logic:present name="data">
> <logic:iterate name="data" id="person" indexId="num">
It could be that you have an empty collection, so the bean is present
but it is empty, and the <logic:iterate> does not execute.
Antonio

Attachment:
user_188744.ezm (zipped)2008/7/10 Ryan Henson <nwstraith@(protected)>:
> SUCCESS! I figured out what was going wrong with my code. Whew, what a tangled mess.
Errr... then ignore my last email :-)
Ciao
Antonio

Attachment:
user_188745.ezm (zipped)On Thu, Jul 10, 2008 at 5:59 PM, Alberto A. Flores <aaflores@(protected):
> You are correct, the default is REQUEST (if no dispatcher is specified).
...
> The spec clearly doesn't specify whether a forward or a response.redirect()
> is used. This means that it is up to the container to decide how this is
> implemented. Depending on your portability requirements, this may or may not
> be an issue (Tomcat vs Weblogic, Resin, etc)...
Hmm, the whole point of 'following the spec' as you put it and indeed
as I see it is to avoid portability problems ...
Translocatability ... that's a big 'Buzzword Bingo' word that I
remember from my training days, or maybe that's something else,
Anyway if moving to a different container might mean having to change
something (anything?) because Struts2 breaks if you don't, might mean
not using Struts2 ... which would be a shame because after years of
avoiding frameworks because ... well just because I like rolling my
own, I actually like some of the Struts2 features ... i18n is a breeze
for example (this whole idea of binding form input fields to buisness
component private attributes on the other hand is just plain NASTY).
Anyway, I will struggle on and no doubt come to a conclusion eventually
Thanks again for all the input on this
lyallex
>
>
> Lyallex wrote:
>>
>> OK, I think I've twigged this now
>>
>> Every jsp page has this include
>>
>> <jsp:include page="header.jsp"></jsp:include>
>>
>> recently I have included this in header.jsp (I'm messing around with
>> Struts2 i18n)
>>
>> <%@(protected)" %>
>> ...
>> <span class='header'><s:text name="header.welcome"/></span>
>>
>> If I go back to this config in web.xml ..
>>
>> <filter-mapping>
>> <filter-name>struts2</filter-name>
>> <url-pattern>/*</url-pattern>
>> </filter-mapping>
>>
>> ...
>>
>> <welcome-file-list>
>> <welcome-file>/welcome.jsp</welcome-file>
>> </welcome-file-list>
>>
>> ... when I access the site the welcome page with it's included header
>> loads fine.
>> So obviously the request is going through the filter.
>>
>> If I then click the login link it all goes horribly wrong.
>> looking at the exception trace it appears that login.jsp which also
>> loads the header is where the problem lies
>> So, it appears that there is a forward going on (or at least a redirect)
>> somewhere when Tomcat sees that I am trying to access a protected resource
>> This makes sense as I'm trying to access a servlet (Login) but I
>> actually get a jsp (login.jsp)
>>
>> according to http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd another
>> valid value for
>> <dispatcher> is INCLUDE so I tried this on it's own ... boom, it all
>> went wrong,
>> so it looks like the default behaviour for the filter mapping thing is
>> REQUEST.
>> If you add any dispatcher then that seems to override the default config.
>>
>> Distressingly (perhaps)
>>
>> <filter-mapping>
>> <filter-name>struts2</filter-name>
>> <url-pattern>/*</url-pattern>
>> <dispatcher>REQUEST</dispatcher>
>> <dispatcher>INCLUDE</dispatcher>
>> </filter-mapping>
>>
>> Doesn't do it, it has to be
>>
>> <filter-mapping>
>> <filter-name>struts2</filter-name>
>> <url-pattern>/*</url-pattern>
>> <dispatcher>REQUEST</dispatcher>
>> <dispatcher>FORWARD</dispatcher>
>> </filter-mapping>
>>
>> phew, got there in the end
>>
>> I'm still not entirely convinced I've got to the bottom of things as
>> I'm sure I had this working with the tags in the header
>> but without the <dispatcher> stuff ... then again it's been a long
>> week and I'm probably mistaken.
>>
>> Anyway, whoever said there was a forward going on ... take a bow, you
>> were right and I was talking tosh
>>
>> If it's true that this fix does indeed break in some versions of IE
>> then we are in a spot of bother with this.
>>
>> Thanks for the input, it got me thinking.
>>
>> Rgds
>>
>> lyallex
>>
>>
>> On Thu, Jul 10, 2008 at 11:11 AM, Lyallex <lyallex@(protected):
>>>
>>> Hello
>>>
>>> Tomcat version 5.5.26
>>> Struts2 version 2.0.11.1
>>>
>>> I'm trying to understand why, given the following in web.xml requests
>>> sometimes 'miss out' the Struts2 filter
>>>
>>> <filter>
>>> <filter-name>struts2</filter-name>
>>>
>>> <filter-class>
org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>>> </filter>
>>>
>>> <filter-mapping>
>>> <filter-name>struts2</filter-name>
>>> <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>>
>>>
>>> It appears to really only be an issue with web.xml declarative security
>>>
>>> Reading around the various archives it appears that this is a know issue
>>> when trying to use Struts2 Actions as the target but I'm not trying to do
>>> that
>>> I just use a standard jsp.
>>>
>>> <odd>
>>>
>>> The really odd thing is that the login process works perfectly
>>> sometimes and sometimes it fails with the (apparently well known) message
>>>
>>> The Struts dispatcher cannot be found.
>>> This is usually caused by using Struts tags without the associated filter
>>> ...
>>>
>>> </odd>
>>>
>>> Here's the login config
>>>
>>> <login-config>
>>> <auth-method>FORM</auth-method>
>>> <realm-name>Form based authentication</realm-name>
>>> <form-login-config>
>>> <form-login-page>/login.jsp</form-login-page>
>>> <form-error-page>/login.jsp</form-error-page>
>>> </form-login-config>
>>> </login-config>
>>>
>>> Someone, somwhere on my journey through the archives suggested this fix.
>>>
>>> <filter-mapping>
>>> <filter-name>struts2</filter-name>
>>> <url-pattern>/*</url-pattern>
>>> <dispatcher>REQUEST</dispatcher>
>>> <dispatcher>FORWARD</dispatcher>
>>> </filter-mapping>
>>>
>>> It does appear to solve the problem I was just wondering why ?
>>>
>>> Is there a definitive resolution to this problem out there somewhere ?
>>>
>>> TIA
>>>
>>> lyallex
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
> --
>
> Alberto A. Flores
> http://www.linkedin.com/in/aflores
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_188748.ezm (zipped)
>> The spec clearly doesn't specify whether a forward or a response.redirect()
>> is used. This means that it is up to the container to decide how this is
>> implemented. Depending on your portability requirements, this may or may not
>> be an issue (Tomcat vs Weblogic, Resin, etc)...
>
>
> Hmm, the whole point of 'following the spec' as you put it and indeed
> as I see it is to avoid portability problems ...
>
Although this is the real intent, 100% portability is not unfortunately
true (due to some vague concepts/definitions in the spec). AFAIK, this
is the reason why you see some issues with some frameworks where special
handling/configuration is necessary when deployed in some containers.
Good luck!

Attachment:
user_188747.ezm (zipped)
hi
i have successfully converted and deployed struts 2.0.11 application to
client
but still have some security questions because i have less knowledge of jaas
,realm or role based security
i have done authentication using query fire in database for user name and
password when user authenticated
i have stored his user name and user id and user type
(admin,executive,branch head) in session
problems
1. users can login from diff node or diff explorer n with same user name
,how to solve it
2. how can i apply realm or jaas in struts 2.0.11
please help me ,i am waiting for favorable reply
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188749.ezm (zipped)Here are my thoughts [based on my experience with Websphere but I hope they can be generalized):
1- Using session for users's authentication is not a very good idea esp if there is a chance that they may have multiple browser or tabs open at the sametime. there is a great chance of session mix-ups. However; if you are , for some reason or another, pressed to use http session, make sure that you use url rewriting instead of cookies for session tracking[ Websphere also allows a thrid way to use ssl ids for this purpose if you use ssl]. To do so you do not need to change your code, you need to change container settings.
2- Applying security using JASS or realm is a web-container setting not struts 2. You need to do two things:
a) Enable the security of your container (server) to use a registery for authentication (LDAP,OS,...). Note that some servers like websphere allow you to extend its capability
to use a custome registery (say database for this purpose)
b) Change your web.xml and application.xml (add security constraints and roles and ...).
Once it is done. It does not matter u use struts 2 or struts 1 or anyother framework. At logging (first access) users get chanllenged.
In my case, to avoid using session for authentication, I am using an interceptor to retrieve user role and other information on each request. Note that once a user is logged in (assuming you use single signon), users' credentials (login name) are cached by the server and at each request you can retrieve it using request.getRemoteUser(). So you can rid of session by paying a very slight overhead of retriving all necessary information at each request using an interceptor.
regards,
----- Original Message ----
From: hns <hardik_982@(protected)>
To: user@(protected)
Sent: Friday, July 11, 2008 8:17:54 AM
Subject: about security
hi
i have successfully converted and deployed struts 2.0.11 application to
client
but still have some security questions because i have less knowledge of jaas
,realm or role based security
i have done authentication using query fire in database for user name and
password when user authenticated
i have stored his user name and user id and user type
(admin,executive,branch head) in session
problems
1. users can login from diff node or diff explorer n with same user name
,how to solve it
2. how can i apply realm or jaas in struts 2.0.11
please help me ,i am waiting for favorable reply
--
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
__________________________________________________________________
Get the name you've always wanted @ymail.com or @rocketmail.com today! Go to http://ca.promos.yahoo.com/jacko/

Attachment:
user_188750.ezm (zipped)Hello:
I have a form on which there can, in theory, be an infinite number of
checkboxes (Users are selecting files from a tree and there is no
telling how many will be selected). The name of each checkbox is
determined at runtime (= to the path of the file). That being the case,
how can I set up an action to read these parameters? Or do it need to
go back to the servlet API?
Thanks.
Regards,
Eric Hamacher
******************************
THIS EMAIL IS INTENDED ONLY FOR THE REVIEW OF THE ADDRESSEE(S), AND MAY
CONTAIN CONFIDENTIAL AND LEGALLY PRIVILEGED INFORMATION. INTERCEPTION,
COPYING, DISSEMINATION, OR OTHER USE BY OTHER THAN THE ADDRESSEE(S) IS
PROHIBITED AND MAY BE PENALIZED UNDER APPLICABLE PRIVACY LAWS. IF YOU
RECEIVED THIS EMAIL IN ERROR, PLEASE DELETE IT AND NOTIFY ME BY RETURN
EMAIL TO eric.hamacher@(protected) *******************************

Attachment:
user_188751.ezm (zipped)Hi All, I've a problem with textarea encoding. I use struts 2.0.11. I
put things like áí or ü into a text area, then I pass that value to
others pages (through session) and the the characters appear as "?".
I looked forums and all problems had a Db involved, not mine.
Any idea?
Thanks.
Juan Pablo.

Attachment:
user_188761.ezm (zipped)Hi,
are the values still correct within your controller? And which Server
are you using?
I once had a similar problem, but I am not sure, if my solution can be
applied to your problem. In my case I tried to deliver strings with
umlauts as a GET-request-parameter to my controller, which failed. As
server I used Tomcat. I had to set the URIEncoding of Tomcat to UTF-8
what solved my problem. A comprehensive description of the problem (and
solution) can be found here:
http://tompson.wordpress.com/2007/01/29/encoding-filter-for-java-web-applications/
Hope that helps
Juan Pablo Pizarro schrieb:
> Hi All, I've a problem with textarea encoding. I use struts 2.0.11. I
> put things like áí or ü into a text area, then I pass that value to
> others pages (through session) and the the characters appear as "?".
>
> I looked forums and all problems had a Db involved, not mine.
>
> Any idea?
>
> Thanks.
>
> Juan Pablo.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_188752.ezm (zipped)I have no idea if the authors of the book Struts 2 in Action read this
list or if anyone that does
knows how to contact them but I have a question for them, or maybe
someone else knows the answer
Authors
On page 99, chapter 4 of your book you state.
"Every action in this package will
now have authentication with automatic routing back to the login page"
You then proceed to hard code the redirect.
How can the Login action be used for all actions in when you hard code the url
<action name="Login" class="manning.chapterFour.Login">
<result type="redirect">
/chapterFour/secure/AdminPortfolio.action
</result>
<result name="input">/chapterFour/Login.jsp</result>
</action>
How then for example would you use the Login action to secure the
AddImage action which is also a secure action
<action name="AddImage">
<result>/chapterFour/ImageUploadForm.jsp</result>
</action>
Thank You
lyallex

Attachment:
user_188753.ezm (zipped)There are decent forums at manning.com that might be a better place to put
this note -- I know the authors read the forums there.
jk
On Fri, Jul 11, 2008 at 11:59 AM, Lyallex <lyallex@(protected):
> I have no idea if the authors of the book Struts 2 in Action read this
> list or if anyone that does
> knows how to contact them but I have a question for them, or maybe
> someone else knows the answer
>
> Authors
>
> On page 99, chapter 4 of your book you state.
>
> "Every action in this package will
> now have authentication with automatic routing back to the login page"
>
> You then proceed to hard code the redirect.
>
> How can the Login action be used for all actions in when you hard code the
> url
>
> <action name="Login" class="manning.chapterFour.Login">
> <result type="redirect">
> /chapterFour/secure/AdminPortfolio.action
> </result>
> <result name="input">/chapterFour/Login.jsp</result>
> </action>
>
> How then for example would you use the Login action to secure the
> AddImage action which is also a secure action
>
> <action name="AddImage">
> <result>/chapterFour/ImageUploadForm.jsp</result>
> </action>
>
> Thank You
>
> lyallex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com

Attachment:
user_188754.ezm (zipped)Lyallex,
I'm not one of the authors, but I helped...
The example in the book doesn't work the way that typical container
managed authentication / authorization worked. A successful login
would be redirected to the AdminPortfolio (regardless of the original
request). If you are looking for more than this basic functionality,
take a look at Spring Security (formally, ACEGI). The configuration
appears daunting at first, but the boilerplate config example seems to
work for most apps.
-Wes
On Fri, Jul 11, 2008 at 11:59 AM, Lyallex <lyallex@(protected):
> I have no idea if the authors of the book Struts 2 in Action read this
> list or if anyone that does
> knows how to contact them but I have a question for them, or maybe
> someone else knows the answer
>
> Authors
>
> On page 99, chapter 4 of your book you state.
>
> "Every action in this package will
> now have authentication with automatic routing back to the login page"
>
> You then proceed to hard code the redirect.
>
> How can the Login action be used for all actions in when you hard code the url
>
> <action name="Login" class="manning.chapterFour.Login">
> <result type="redirect">
> /chapterFour/secure/AdminPortfolio.action
> </result>
> <result name="input">/chapterFour/Login.jsp</result>
> </action>
>
> How then for example would you use the Login action to secure the
> AddImage action which is also a secure action
>
> <action name="AddImage">
> <result>/chapterFour/ImageUploadForm.jsp</result>
> </action>
>
> Thank You
>
> lyallex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

Attachment:
user_188759.ezm (zipped)Or You can use an Interceptor with default input for that job.
Best greetings,
Paweł Wielgus.
2008/7/11 Wes Wannemacher <wesw@(protected)>:
> Lyallex,
>
> I'm not one of the authors, but I helped...
>
> The example in the book doesn't work the way that typical container
> managed authentication / authorization worked. A successful login
> would be redirected to the AdminPortfolio (regardless of the original
> request). If you are looking for more than this basic functionality,
> take a look at Spring Security (formally, ACEGI). The configuration
> appears daunting at first, but the boilerplate config example seems to
> work for most apps.
>
> -Wes
>
> On Fri, Jul 11, 2008 at 11:59 AM, Lyallex <lyallex@(protected):
>> I have no idea if the authors of the book Struts 2 in Action read this
>> list or if anyone that does
>> knows how to contact them but I have a question for them, or maybe
>> someone else knows the answer
>>
>> Authors
>>
>> On page 99, chapter 4 of your book you state.
>>
>> "Every action in this package will
>> now have authentication with automatic routing back to the login page"
>>
>> You then proceed to hard code the redirect.
>>
>> How can the Login action be used for all actions in when you hard code the url
>>
>> <action name="Login" class="manning.chapterFour.Login">
>> <result type="redirect">
>> /chapterFour/secure/AdminPortfolio.action
>> </result>
>> <result name="input">/chapterFour/Login.jsp</result>
>> </action>
>>
>> How then for example would you use the Login action to secure the
>> AddImage action which is also a secure action
>>
>> <action name="AddImage">
>> <result>/chapterFour/ImageUploadForm.jsp</result>
>> </action>
>>
>> Thank You
>>
>> lyallex
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> Wesley Wannemacher
> President, Head Engineer/Consultant
> WanTii, Inc.
> http://www.wantii.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_188755.ezm (zipped)Hi all,
I'm new to Struts2 and needed some help troubleshooting an error when I try
to use @CustomValidator.
Here's my setup:
I have the validators.xml file in /WEB-INF/:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator Config 1.0//EN"
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd">
<validators>
<validator name="numericField"
class="xxx.validators.NumberFieldValidator"/>
</validators>
And then I have a class called NumberFieldValidator:
package xxx.validators;
import
com.opensymphony.xwork2.validator.ValidationException;
import
com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;
public class NumberFieldValidator extends FieldValidatorSupport {
// code
}
Then I have the following annotation on a model class:
@CustomValidator(type = "numericField", message = "Price must be a number")
public void setLowPrice(Double lowPrice) {
this.lowPrice = lowPrice;
}
I am getting the following exception:
2008-07-11 11:22:44 INFO xwork2.validator.ActionValidatorManagerFactory -
Detected AnnotationActionValidatorManager, initializing it...
Jul 11, 2008 11:22:44 AM
org.apache.catalina.core.StandardWrapperValveinvoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.IllegalArgumentException: There is no validator class mapped to
the name numericField
at
com.opensymphony.xwork2.validator.ValidatorFactory.lookupRegisteredValidatorType (
ValidatorFactory.java:299)
Can anyone tell what I may be missing?
Thanks so much!
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188756.ezm (zipped)--- On Fri, 7/11/08, tangy <yi-ling.baldez@(protected):
> I have the validators.xml file in /WEB-INF/:
AFAIK this file needs to be on the classpath.
The validation documentation [1] points this out in the "Registering Validators" section, stating "The simplest way to do so is to add a file name validators.xml in the root of the classpath (/WEB-INF/classes) [...]"
Dave
[1] http://struts.apache.org/2.x/docs/validation.html

Attachment:
user_188757.ezm (zipped)
Yes, that was the problem. Now I have another problem:
My interceptor stack is as follows:
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="params"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="debugging"/>
<interceptor-ref name="profiling"/>
<interceptor-ref name="scopedModelDriven"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="params">
dojo\..*
</interceptor-ref>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="validation">
_edit, input, save
</interceptor-ref>
<interceptor-ref name="workflow">
_edit, save
</interceptor-ref>
The parameters interceptor is fired before validation as suggested by the
struts 2 defaultStack. So actually before the @CustomValidation on the model
is able to happen, params fires with error:
2008-07-11 13:51:55 ERROR xwork2.interceptor.ParametersInterceptor -
ParametersInterceptor - [setParameters]: Unexpected Exception caught setting
'modelMap[344344].lowPrice' on 'class xxx.action.ItemAction: Error setting
expression 'modelMap[344344].lowPrice' with value
'[Ljava.lang.String;@(protected)'
Is there any way around this?
newton.dave wrote:
>
> --- On Fri, 7/11/08, tangy <yi-ling.baldez@(protected):
>> I have the validators.xml file in /WEB-INF/:
>
> AFAIK this file needs to be on the classpath.
>
> The validation documentation [1] points this out in the "Registering
> Validators" section, stating "The simplest way to do so is to add a file
> name validators.xml in the root of the classpath (/WEB-INF/classes) [...]"
>
> Dave
>
> [1] http://struts.apache.org/2.x/docs/validation.html
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188760.ezm (zipped)Thanks for your Answer, Lukasz.
I already know the PrepareInterceptor and it can be used for what I
would like to do. But I consider a special interceptor more convinient,
since I intend to use it for more than one pair of view and action.
(Using PrepareInterceptor would imply the need to add the code to every
single action.)
In my original post, i was wondering if there already is some kind of
"recipe"/"best practice"/"standard way" since I don't think that my wish
to put the actions together is very exotic.
But as nobody intervened I take this as a sign that my design is not
flawed :-))
See You!
~Andreas
Lukasz Lenart schrieb:
> Check PrepareInterceptor [1] with prepare() method
>
> [1] http://struts.apache.org/2.1.2/docs/prepare-interceptor.html

Attachment:
user_188765.ezm (zipped)You can also opt for sharing the prepare() code through inheritance,
meaning that you create a superclass action holding the prepare()
code, instead of coding a custom interceptor.
2008/7/11 Andreas Mähler <andreas.maehler@(protected)>:
> Thanks for your Answer, Lukasz.
>
> I already know the PrepareInterceptor and it can be used for what I would
> like to do. But I consider a special interceptor more convinient, since I
> intend to use it for more than one pair of view and action. (Using
> PrepareInterceptor would imply the need to add the code to every single
> action.)
>
> In my original post, i was wondering if there already is some kind of
> "recipe"/"best practice"/"standard way" since I don't think that my wish to
> put the actions together is very exotic.
>
> But as nobody intervened I take this as a sign that my design is not flawed
> :-))
>
> See You!
> ~Andreas
>
>
> Lukasz Lenart schrieb:
>>
>> Check PrepareInterceptor [1] with prepare() method
>>
>> [1] http://struts.apache.org/2.1.2/docs/prepare-interceptor.html
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_188767.ezm (zipped)Hello Gabriel,
yes, I indeed took that into consideration, but if i am not wrong, there
are two drawbacks:
1: When I create my own base class, and would like to use the
prepare-method for something else, too, I need to overwrite the old
method and mustn't forget to call super.prepare() in my implementation.
IMO, this is a likely source of bugs.
2: I would have had to mess with the defaultStack anyway, since prepare
is located before some other important interceptors (e.g. i18n) so I
would have lost this functionality by taking an "early shortcut".
The Interceptor was done in 10mins and as far as i could test it, it
seems to work fine.
public class SubmitInterceptor implements Interceptor
{
public static final String INPUT = "input";
public void destroy() {}
public void init() {}
private String paramNames;
public void setParamNames( String paramNames )
{
this.paramNames = paramNames;
}
public String intercept( ActionInvocation ai ) throws Exception
{
Map params = ai.getInvocationContext().getParameters();
String[] paramNames = this.paramNames.split( "," );
for( String param : paramNames )
{
if( params.get( param.trim() ) != null )
return ai.invoke();
}
return INPUT;
}
}
I created a new interceptor stack for my webapp that is like
defaultStack, but with the SubmitInterceptor inserted right before
conversionError:
<interceptor-ref name="submit">
<param name="paramNames">submit</param>
</interceptor-ref>
As for the view, i am currently setting the "submit" parameter (as
configured to be looked for above) for the Button:
<s:submit name="submit" label="OK" value="true" type="button" />
Comments and suggestions are welcome :-)
~Andreas
Gabriel Belingueres schrieb:
> You can also opt for sharing the prepare() code through inheritance,
> meaning that you create a superclass action holding the prepare()
> code, instead of coding a custom interceptor.
>
> 2008/7/11 Andreas Mähler <andreas.maehler@(protected)>:
>> Thanks for your Answer, Lukasz.
>>
>> I already know the PrepareInterceptor and it can be used for what I would
>> like to do. But I consider a special interceptor more convinient, since I
>> intend to use it for more than one pair of view and action. (Using
>> PrepareInterceptor would imply the need to add the code to every single
>> action.)

Attachment:
user_188762.ezm (zipped)
I'm replying to myself to say that I've told my customers to use anything but
Firefox 3 until Mozilla provides us with a patch that clears this problem.
Regards.
Pierrot52 wrote:
>
> Hello,
> I have developed a Struts2 application that works well under Firefox 2, IE
> 6, IE 7, Safari, and Opera.
> Unfortunately it doesn't work under Firefox 3.
> Has anybody made this observation and found a solution to this problem?
> Regards.
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188763.ezm (zipped)You don't say what the problem is, so it's hard to know how to help.
There's a known issue with Dojo [1] which may or may not be the issue you're facing-kinda hard to say. It's helpful to provide enough information to know where to start looking.
Dave
[1] http://dojotoolkit.org/support/faq/why-does-dojo-fail-load-file-urls-firefox-3
(Although it's wrong, it's close, and it provides links to relevant FF pages.)
--- On Fri, 7/11/08, Pierrot52 <pierre.lasante@(protected):
> From: Pierrot52 <pierre.lasante@(protected)>
> Subject: Re: Struts2 application doesn't work with Firefox 3
> To: user@(protected)
> Date: Friday, July 11, 2008, 6:57 PM
> I'm replying to myself to say that I've told my
> customers to use anything but
> Firefox 3 until Mozilla provides us with a patch that
> clears this problem.
>
> Regards.
>
>
> Pierrot52 wrote:
> >
> > Hello,
> > I have developed a Struts2 application that works well
> under Firefox 2, IE
> > 6, IE 7, Safari, and Opera.
> > Unfortunately it doesn't work under Firefox 3.
> > Has anybody made this observation and found a solution
> to this problem?
> > Regards.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Struts2-application-doesn%27t-work-with-Firefox-3-tp18237909p18413950.html
> Sent from the Struts - User mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment:
user_188764.ezm (zipped)i got some things fixed but now it gives me an error when it goes to the Action (LookupDispathAction), it says that MessageResource(update.update) is not found...
has this happened to anyone else?
saludos
Lalchandra Rampersaud
------------
Carpe diem
----- Original Message -----
hi
i am using an iframe to update my page. i noticed that the url does not change and my buttons have problems accessing javascript functions that are supposed to be loaded along with the new data. the new data is shown and i used firebug to check that my scripts are loaded.
however if i put parent.document.location = parent.frames["hframe"].location everything works perfectly but the page blinks (something i am trying to avoid). could this be a problem with struts?
any help would be appreciated.
saludos
Lalchandra Rampersaud
------------
Carpe diem
------------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_188766.ezm (zipped)Hi to everyone
I have a problem with the following code:
<s:set name="aver" scope="page" value="one"></s:set
...
<s:if test="#page.aver=='one'">
<%-- Some code goes here --%>
</s:if>
I don't know what is happening but the code conditionated by the if is not
executed.
If i use request instead of page in the s:set tag, and obiosly in the s:if
tag, the code works fine.
can somebody tell me what i'm doing wrong?