Re: Session variable setting

2010-05-20 Thread Kartik Kumar
I have found that when your interceptor implements SessionAware and puts
some key/value pairs in the map, the session attributes are not available to
the action even  if it implements SessionAware. To get the session
attribute, I did something like this:

@SuppressWarnings(unchecked)
MapObject, Object sessionMap =
invocation.getInvocationContext().getSession();

On Thu, May 20, 2010 at 5:22 AM, Pierre BRARD brard.pie...@gmail.comwrote:

 Hi all,

 I am implementing a login system with Struts 2.

 Basically, I have a custom interceptor which checks in session if a
 particular variable is set. If it is, the user is considered already logged
 in and if it is not the variable is set in session (
 session.setAttribute(connectedUser, user); ).

 Now, the problem is that this variable is null in my Action (through
 SessionAware or not) or in my page (#session.myvar) during the first
 request
 (when the variable is first set in session).
 It is only gets set with the second request.

 Am I missing an essential concept in the page process and session
 lifecycle or is this a plain algorithm mistake ?

 Thanks in advance for any help,
 PBR



Re: Where is the documentation for Struts tags ....

2010-04-30 Thread Kartik Kumar
http://struts.apache.org/2.0.14/docs/tag-reference.html

On Fri, Apr 30, 2010 at 8:29 AM, Dale Newfield d...@newfield.org wrote:

 On 4/30/10 10:43 AM, RogerV wrote:

 Where is the latest documentation for using Struts 2 tags?  I had a
 problem
 earlier in the week trying to use the optiontransferselect tag


 http://struts.apache.org/2.x/docs/optiontransferselect.html

 But there appears to be a bug with the snippets right now...
 ...so instead look at
 http://struts.apache.org/2.1.8/docs/optiontransferselect.html

 Usually the error message you listed means the OGNL expression you provided
 for some argument did not evaluate correctly, thus some required piece of
 information is not available.  Please post your tag usage again and I'll
 take a look.

 -Dale


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




Re: ConcurrentModificationException error.

2010-04-30 Thread Kartik Kumar
Are you using Iterator#remove() when iterating through a collection?

On Fri, Apr 30, 2010 at 10:23 AM, Lukasz Lenart 
lukasz.len...@googlemail.com wrote:

 Do you have devMode set to true?


 Regards
 --
 Łukasz
 http://www.lenart.org.pl/
 Kapituła Javarsovia 2010
 http://javarsovia.pl

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




Struts2 - Ajax submit not working: Please advise

2010-04-30 Thread Kartik Kumar
 Hi All,

I am experiencing some issues with ajax submit with Struts2. I am trying to
do an asynchronous post to an action class that will make a crud call and
return back the html page with the updated input value. I am able to get the
result when posting to form action without using ajax.

%@ taglib prefix=s uri=/struts-tags%
%@ taglib prefix=sx uri=/struts-dojo-tags %
html xmlns=http://www.w3.org/1999/xhtml;
head
s:head theme=ajax debug=true/
/head
body
s:div id=updateDiv theme=ajax
s:text name=Welcome :  /
s:property value=#session['auth'].fullName /
table
trtds:actionerror/s:fielderror //td/tr


   s:form name=updateStatus action=action_item_update
validate=true
tr
tds:select name=actionStatus headerKey=
 headerValue=Change Status list=statuses /
/td
tds:hidden name=id //td
   td s:submit  theme=ajax name=update value=Update
notifyTopics=/action_item_update targets=updateDiv/ /td
/tr
/s:form
/table
/s:div
/body
/html
When I remove all ajax related attributes from s:submit  / tag, then
the application is submitted without any issues, but not when using Ajax
submission. On my form, I  see the following:

Action Item List
DEBUG: widget ID collision on ID: action_item_update_update

On submission, I see the following error:

Action Item List
[object Error]
DEBUG: widget ID collision on ID: action_item_update_update
Action Item List
DEBUG: widget ID collision on ID: updateDiv


The form parameters are always null on ajax submit. Can anyone tell me what
I am doing wrong? Any help would be appreciated.


Re: Submit not passing the form input to the action

2010-04-29 Thread Kartik Kumar
@Nikhil No action form used as I am using Struts2. Each row has a submit
button.
2010/4/29 निखिल वाळवेकर walve...@gmail.com

 Can you please also provide ActionForm details ?

 Is your page like this? (I am not aware abt struts 2 tags)

 form action=someAction
 ...
 s:iterator value=actionItems
   tr
   tds:property value=creatorName //td
   tds:property value=assignedTo //td
   tds:property value=creationDate //td
   tds:property value=dueTo //td
   tds:property value=externalItemNumber //td
   tds:property value=description //td
   tds:property value=currentStatus //td
   td width=100s:property value=status//td
   td*s:select name=actionStatus headerKey=
headerValue=Change Status list=statuses /*
   /td
   td
 s:hidden name=id/
* s:submit value=Update name=update /*
   /td
   /tr
   /s:iterator
 ..
 /form

 *One form tag covering s:iterator.*
 *
 *
 In that case even if you have one submit button per row, whole form will be
 submitted and your actionForm will be populated.

 Regards,
 Nikhil

 On Thu, Apr 29, 2010 at 12:42 PM, Jyothi Rajesh jyoraj...@gmail.com
 wrote:

  Not sure about struts 2, but in struts 1.3, there will need to be a
  collection object in the action form and this will need to be
 instantiated
  while declaring. And there needed to be getters and setters for the
 entire
  collection as well as inidiviual members with index.
 



 --
 Nikhil



Re: Multiple forms in single action class

2010-04-28 Thread Kartik Kumar
Yes It is possible to assign the same action class but different action
methods to handle different tasks. The example below should work for you.

action name = abc class = ABCAction method = abc
/action

On Wed, Apr 28, 2010 at 7:08 AM, Manoj Singh manojsingh2...@gmail.comwrote:

 Hi,

 I am a newbie to struts. Please co-operate.

 I am using the dispatch action to create my action class. Here I am
 providing the facility the users to add, update and delete the blogs. I
 want
 to use two form beans for this single action. One for add and update and
 another for delete.

 Is it possible to assign multiple form beans for the same action for the
 different dispatch action parameters?

 Please suggest.

 Regards,
 Manoj



Submit not passing the form input to the action

2010-04-28 Thread Kartik Kumar
Hi,

I have a use case in which we iterate through the items in the list and
display them on the page. We do that with s:iterator tag.

s:iterator value=actionItems
tr
tds:property value=creatorName //td
tds:property value=assignedTo //td
tds:property value=creationDate //td
tds:property value=dueTo //td
tds:property value=externalItemNumber //td
tds:property value=description //td
tds:property value=currentStatus //td
td width=100s:property value=status//td
td*s:select name=actionStatus headerKey=
 headerValue=Change Status list=statuses /*
/td
td
  s:hidden name=id/
 * s:submit value=Update name=update /*
/td
/tr
/s:iterator

I have a s:submit tag that inovkes the appropriate action class and method.
For update to work, I have to to update the back end with a new pull down
menu value from db and is given below:

*s:select name=actionStatus headerKey=
 headerValue=Change Status list=statuses /*

I also have a hidden field id that I used to identify the identity of the
bean to be updated and is given below:
s:hidden name=id/

and I have a submit button for every entry in the list being iterated

My issues is that my action class is not getting any value from id and
actionStatus field even though they are defined in my action class. I
don't know what is going wrong. The action is being invoked but these fields
have a null value.

Any help would be appreciated.

Thanks,

Kartik


Re: Submit not passing the form input to the action

2010-04-28 Thread Kartik Kumar
Hi Martin,

Thanks for replying. I loked at I am iterating through the collection to
display some the items as follows:

s:iterator value=actionItems
tr
   tds:property value = status //td
tds:select name=action headerKey=
 headerValue=Change Status list=statuses /
/td
td
s:hidden name=id /
s:submit name=update value = Change/
/td
/tr
/s:iterator

There is a submit button for every row. I want to update the value of a bean
attribute status with the value from the drop down. I have tried to change
the invocation from submit to get using s:actions:param  name =idValue
value = id //s:action. But I am not able to get status attribute to be
populated in my action class.


On Wed, Apr 28, 2010 at 5:27 PM, Martin Gainty mgai...@hotmail.com wrote:


 the list attribute defined is the variable bound from the action as seen
 here with a bound Collection variable called availableItems

s:select list=#skillAction.availableItems listKey=name label=Main
 Skill
   name=currentEmployee.mainSkill.name/
 public abstract class AbstractCRUDAction extends ActionSupport {
private Collection availableItems;

 the hidden field needs a value attribute and a id attribute as seen here:
 s:hidden id=project-name name=project-name value=Struts 2 /

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

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
 de ceci est interdite. Ce message sert à l'information seulement et n'aura
 pas n'importe quel effet légalement obligatoire. Étant donné que les email
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
 aucune responsabilité pour le contenu fourni.




  Date: Wed, 28 Apr 2010 13:31:05 -0700
  Subject: Submit not passing the form input to the action
  From: krishnan.1...@gmail.com
  To: user@struts.apache.org
 
  Hi,
 
  I have a use case in which we iterate through the items in the list and
  display them on the page. We do that with s:iterator tag.
 
  s:iterator value=actionItems
  tr
  tds:property value=creatorName //td
  tds:property value=assignedTo //td
  tds:property value=creationDate //td
  tds:property value=dueTo //td
  tds:property value=externalItemNumber //td
  tds:property value=description //td
  tds:property value=currentStatus //td
  td width=100s:property value=status//td
  td*s:select name=actionStatus headerKey=
   headerValue=Change Status list=statuses /*
  /td
  td
s:hidden name=id/
   * s:submit value=Update name=update /*
  /td
  /tr
  /s:iterator
 
  I have a s:submit tag that inovkes the appropriate action class and
 method.
  For update to work, I have to to update the back end with a new pull down
  menu value from db and is given below:
 
  *s:select name=actionStatus headerKey=
   headerValue=Change Status list=statuses /*
 
  I also have a hidden field id that I used to identify the identity of
 the
  bean to be updated and is given below:
  s:hidden name=id/
 
  and I have a submit button for every entry in the list being iterated
 
  My issues is that my action class is not getting any value from id and
  actionStatus field even though they are defined in my action class. I
  don't know what is going wrong. The action is being invoked but these
 fields
  have a null value.
 
  Any help would be appreciated.
 
  Thanks,
 
  Kartik

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

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



Re: Setting selected with s:select tags

2010-04-26 Thread Kartik Kumar
Hi Martin,

Thanks for the reply. I apologize if I was not clear earlier. Let me try to
rephrase my question again. The 'selected' value of the auto-select comes
from another bean property. The iterator is used to iterate over an action
specific bean property.

The s:select is used inside s:iterator loop. The value of the bean#attribute
(ActionItemTracking#status) provides the value to the s:select / tag. The
'list' value provided to the tag is a map and it is an action scope. I am
looking to iterate the list variable and if the value of
ActionItemTracking#status matches the list map key, then i want to have it
as selected.

This is not working for me.

Thanks,

Kartik




2010/4/24 Martin Gainty mgai...@hotmail.com


 s:select
  key=search.criterion
  name=searchCriterion
  list=#{'': 'Select One',
 'bean.attributeValue':'bean.attributeValue','abc':'abc'}
  required=true
  onchange=showSearchCriterionField()
 headerKey=abc
headerValue=abc

 /

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

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
 de ceci est interdite. Ce message sert à l'information seulement et n'aura
 pas n'importe quel effet légalement obligatoire. Étant donné que les email
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
 aucune responsabilité pour le contenu fourni.




  Date: Fri, 23 Apr 2010 17:11:24 -0700
  Subject: Setting selected with s:select tags
  From: krishnan.1...@gmail.com
  To: user@struts.apache.org
 
  Hi Struts gurus,
 
  I am have an object level attribute that is selected from the s:select
 tag.
 
s:select key=search.criterion name=searchCriterion
list=#{'': 'Select One',
 'bean.attributeValue':'bean.attributeValue',
  'abc':'abc'}
required=true onchange=showSearchCriterionField() /
 
  If I want to set 'abc' to selected, then how do do that ? Any advice
 would
  be welcome.
 
  Thanks,
 
  Kartik

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

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



Setting selected with s:select tags

2010-04-23 Thread Kartik Kumar
Hi Struts gurus,

I am have an object level attribute that is selected from the s:select tag.

  s:select key=search.criterion name=searchCriterion
  list=#{'': 'Select One', 'bean.attributeValue':'bean.attributeValue',
'abc':'abc'}
  required=true onchange=showSearchCriterionField() /

If I want to set 'abc' to selected, then how do do that ? Any advice would
be welcome.

Thanks,

Kartik


Re: Setting selected with s:select tags

2010-04-23 Thread Kartik Kumar
I have some thing like this

s:iterator value=actionItems
tr
tds:property value=creatorName //td
tds:property value=assignedTo //td
tds:property value=creationDate //td
tds:property value=dueTo //td
tds:property value=externalItemNumber //td
tds:property value=description //td
tds:property value=currentStatus //td
td width=100s:property value=status/
   * s:select name=actionStatus value = status'
list=#{'OPEN':'OPEN', 'CLOSED':'CLOSED'} headerKey= headerValue=Change
Status/*
a href = s:url action = 'updateActionStatus.action'
   s:param name = 'id' value =
'id'//s:urlChange/a/td

/tr
/s:iterator

But I don't see the preselected value,

Thanks,

Kartik

On Fri, Apr 23, 2010 at 5:11 PM, Kartik Kumar krishnan.1...@gmail.comwrote:

 Hi Struts gurus,

 I am have an object level attribute that is selected from the s:select tag.

   s:select key=search.criterion name=searchCriterion
   list=#{'': 'Select One',
 'bean.attributeValue':'bean.attributeValue', 'abc':'abc'}
   required=true onchange=showSearchCriterionField() /

 If I want to set 'abc' to selected, then how do do that ? Any advice would
 be welcome.

 Thanks,

 Kartik



Issue with localization: Messages not picked up from properties file

2010-04-21 Thread Kartik Kumar
Hi All,

In my package structure, I have package.properties file with the following
key value pair:

username=User Name
password=Password

In my simple login page: the form elements are defined with  a key look up..

s:form action=login.action method=POST validate=true
s:textfield name=username key=username /
s:password name=password key=password/s:password
s:submit value=Login name=login /
  /s:form

My action xml mappings are given below. The first action is a forward action
to the login page.

action name = login_input
  result/login.jsp/result
 /action
action name = login class=LoginAction method=authenticate
  result name=input/login.jsp/result
  result name=success/login_success.jsp/result
  result name=error/login.jsp/result
/action

When I try to load the login page like this:
http://localhost:8080/myApp/login_input.action, I don't see the messages
picked up from the package.properties. I see the localized messages if I
submit the application and when the validation fails.

What can I do to resolve the issue?

Thanks,

Kartik

http