Re: Session Expired Interceptor

2013-01-12 Thread Chris Pratt
Well, the action handler for step 6 hasn't been defined in struts.xml, so
it will use the struts default action handler, which simply returns
SUCCESS.  That will trigger the JSP processor to process the
/expiredSession.jsp and return it to the AJAX client, is that what the
javascript handler is expecting?
  (*Chris*)



On Sat, Jan 12, 2013 at 6:05 PM, BetBasoo, Peter <
pbetba...@mesirowfinancial.com> wrote:

> Chris:
>
> Thanks for your help. You touched on two key points.
>
> The login procedure is ajax driven and processing a successful login
> (i.e., moving to the next page) is handled on the client side.
>
> Regarding point 6, this is in fact an ajax request. The action handler
> returns NONE. There are no results defined for the ajax action
> (getClientAccounts). The client side (javascript) handler for this request
> does not process loginRequired because I thought that it would never get to
> that point because of the interceptor. Is this a valid assumption?
>
> -Original Message-
> From: Chris Pratt [mailto:thechrispr...@gmail.com]
> Sent: Saturday, January 12, 2013 4:19 PM
> To: Struts Users Mailing List
> Subject: Re: Session Expired Interceptor
>
> That looks right to me (except for the fact that if the user logs in there
> are no results for getClientAccounts).
>
>
>1. What should be happening is that Struts runs the interceptor stack,
>finding your expiredSessionInterceptor first
>2. When it runs it, it finds that the user is not logged in and returns
>"loginRequired"
>3. Struts looks in the action definition in struts.xml for a name="loginRequired"> and doesn't find one
>4. Struts then looks at the global results for name="loginRequired"> and finds a match
>5. It should then send a redirect to the browser specifying the URL for
>the "loginRequired" action
>6. At that point, since there is no action class assigned, the
>"/expiredSession.jsp" file would be processed and returned to the
> browser
>(of course if this is an AJAX request, the JavaScript better be
> expecting
>whatever this .jsp file contains).
>
> but from your messages I'm assuming this is not what you're seeing.  You
> can either step through the process in the debugger and make sure things
> are happening in that order, or (what I would probably do) put log
> statements at each of those places (at the very least) and make sure I'm
> seeing those events logged in the proper order.  Sorry, I can't be more
> helpful than that.
>
>   (*Chris*)
>
>
> On Sat, Jan 12, 2013 at 2:04 PM, BetBasoo, Peter <
> pbetba...@mesirowfinancial.com> wrote:
>
> > Yes, here's struts.xml with one ajax action (getClientAccounts). This
> > action is executed when called even though the interceptor returns
> > "loginRequired"
> >
> >   > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> > "http://struts.apache.org/dtds/struts-2.0.dtd";>
> >
> > 
> >
> > 
> >
> > 
> >
> > 
> >  > class="mesirow.struts.ExpiredSessionInterceptor" />
> > 
> >  > name="expiredSessionInterceptor">
> >  >
> name="excludeActions">login,logout,index,certLogin.jsp,condo,condoLogin.jsp,sendPassword,registerCondoUser,loginRequired
> > 
> > 
> > 
> > 
> >
> >  > />
> >
> > 
> >  > name="loginRequired">loginRequired
> > 
> >
> > 
> > /expiredSession.jsp
> > 
> >
> >  > class="mesirow.action.AccountActions"
> method="getClientAccounts">
> > 
> >
> > 
> >
> > -Original Message-
> > From: Chris Pratt [mailto:thechrispr...@gmail.com]
> > Sent: Saturday, January 12, 2013 3:11 PM
> > To: Struts Users Mailing List
> > Subject: Re: Session Expired Interceptor
> >
> > So you now have this in your struts.xml?
> >
> > 
> >  > type="redirectAction">loginRequired
> > 
> >
> >   (*Chris*)
> >
> >
> >
> > On Sat, Jan 12, 2013 at 12:06 PM, BetBasoo, Peter <
> > pbetba...@mesirowfinancial.com> wrote:
> >
> > > I did put redirectAction action in, it's still not working. The web
> > > page expiredSession.jsp  is not being shown and there is no
> > > indication of an error having occurred.
> > >
> > > When I try this, I observe that the action that initiated the call
> > > is still being called, even though the interceptor returns the
> > > loginRequired result.
> > >
> > > Any ideas?
> > >
> > > -Original Message-
> > > From: Mahendru, Ajay [mailto:ajay.mahen...@dish.com]
> > > Sent: Friday, January 11, 2013 9:27 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: Session Expired Interceptor
> > >
> > > You are missing the redirectAction. Use something like this:
> > >
> > >  > > type="red

RE: Session Expired Interceptor

2013-01-12 Thread BetBasoo, Peter
Chris:

Thanks for your help. You touched on two key points.

The login procedure is ajax driven and processing a successful login (i.e., 
moving to the next page) is handled on the client side.

Regarding point 6, this is in fact an ajax request. The action handler returns 
NONE. There are no results defined for the ajax action (getClientAccounts). The 
client side (javascript) handler for this request does not process 
loginRequired because I thought that it would never get to that point because 
of the interceptor. Is this a valid assumption?

-Original Message-
From: Chris Pratt [mailto:thechrispr...@gmail.com]
Sent: Saturday, January 12, 2013 4:19 PM
To: Struts Users Mailing List
Subject: Re: Session Expired Interceptor

That looks right to me (except for the fact that if the user logs in there are 
no results for getClientAccounts).


   1. What should be happening is that Struts runs the interceptor stack,
   finding your expiredSessionInterceptor first
   2. When it runs it, it finds that the user is not logged in and returns
   "loginRequired"
   3. Struts looks in the action definition in struts.xml for a  and doesn't find one
   4. Struts then looks at the global results for  and finds a match
   5. It should then send a redirect to the browser specifying the URL for
   the "loginRequired" action
   6. At that point, since there is no action class assigned, the
   "/expiredSession.jsp" file would be processed and returned to the browser
   (of course if this is an AJAX request, the JavaScript better be expecting
   whatever this .jsp file contains).

but from your messages I'm assuming this is not what you're seeing.  You can 
either step through the process in the debugger and make sure things are 
happening in that order, or (what I would probably do) put log statements at 
each of those places (at the very least) and make sure I'm seeing those events 
logged in the proper order.  Sorry, I can't be more helpful than that.

  (*Chris*)


On Sat, Jan 12, 2013 at 2:04 PM, BetBasoo, Peter < 
pbetba...@mesirowfinancial.com> wrote:

> Yes, here's struts.xml with one ajax action (getClientAccounts). This
> action is executed when called even though the interceptor returns
> "loginRequired"
>
>   "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
>
> 
>
> 
>
> 
>
> 
>  class="mesirow.struts.ExpiredSessionInterceptor" />
> 
>  name="expiredSessionInterceptor">
>  name="excludeActions">login,logout,index,certLogin.jsp,condo,condoLogin.jsp,sendPassword,registerCondoUser,loginRequired
> 
> 
> 
> 
>
>  />
>
> 
>  name="loginRequired">loginRequired
> 
>
> 
> /expiredSession.jsp
> 
>
>  class="mesirow.action.AccountActions" method="getClientAccounts">
> 
>
> 
>
> -Original Message-
> From: Chris Pratt [mailto:thechrispr...@gmail.com]
> Sent: Saturday, January 12, 2013 3:11 PM
> To: Struts Users Mailing List
> Subject: Re: Session Expired Interceptor
>
> So you now have this in your struts.xml?
>
> 
>  type="redirectAction">loginRequired
> 
>
>   (*Chris*)
>
>
>
> On Sat, Jan 12, 2013 at 12:06 PM, BetBasoo, Peter <
> pbetba...@mesirowfinancial.com> wrote:
>
> > I did put redirectAction action in, it's still not working. The web
> > page expiredSession.jsp  is not being shown and there is no
> > indication of an error having occurred.
> >
> > When I try this, I observe that the action that initiated the call
> > is still being called, even though the interceptor returns the
> > loginRequired result.
> >
> > Any ideas?
> >
> > -Original Message-
> > From: Mahendru, Ajay [mailto:ajay.mahen...@dish.com]
> > Sent: Friday, January 11, 2013 9:27 PM
> > To: Struts Users Mailing List
> > Subject: RE: Session Expired Interceptor
> >
> > You are missing the redirectAction. Use something like this:
> >
> >  > type="redirectAction">programming
> >
> > In your case it would be:
> >
> >> type="redirectAction">loginRequired
> >
> > Regards,
> > Ajay Mahendru
> >
> >
> >
> > -Original Message-
> > From: Dave Newton [mailto:davelnew...@gmail.com]
> > Sent: Friday, January 11, 2013 8:23 PM
> > To: Struts Users Mailing List
> > Subject: Re: Session Expired Interceptor
> >
> > I'm actually surprised it's not erroring out since the global result
> > should be a redirectAction since you're not forwarding to a JSP.
> >
> > Dave
> >
> > (On mobile device, please forgive typos, bizarre autocompletes, and
> > top-
> > quoting.)
> >  On Jan 11, 2013 10:17 PM, "BetBasoo, Peter" <
> > pbetba...@mesirowfinancial.com>
> > wrote:

Re: Session Expired Interceptor

2013-01-12 Thread Chris Pratt
That looks right to me (except for the fact that if the user logs in there
are no results for getClientAccounts).


   1. What should be happening is that Struts runs the interceptor stack,
   finding your expiredSessionInterceptor first
   2. When it runs it, it finds that the user is not logged in and returns
   "loginRequired"
   3. Struts looks in the action definition in struts.xml for a  and doesn't find one
   4. Struts then looks at the global results for  and finds a match
   5. It should then send a redirect to the browser specifying the URL for
   the "loginRequired" action
   6. At that point, since there is no action class assigned, the
   "/expiredSession.jsp" file would be processed and returned to the browser
   (of course if this is an AJAX request, the JavaScript better be expecting
   whatever this .jsp file contains).

but from your messages I'm assuming this is not what you're seeing.  You
can either step through the process in the debugger and make sure things
are happening in that order, or (what I would probably do) put log
statements at each of those places (at the very least) and make sure I'm
seeing those events logged in the proper order.  Sorry, I can't be more
helpful than that.

  (*Chris*)


On Sat, Jan 12, 2013 at 2:04 PM, BetBasoo, Peter <
pbetba...@mesirowfinancial.com> wrote:

> Yes, here's struts.xml with one ajax action (getClientAccounts). This
> action is executed when called even though the interceptor returns
> "loginRequired"
>
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
>
> 
>
> 
>
> 
>
> 
>  class="mesirow.struts.ExpiredSessionInterceptor" />
> 
>  name="expiredSessionInterceptor">
>  name="excludeActions">login,logout,index,certLogin.jsp,condo,condoLogin.jsp,sendPassword,registerCondoUser,loginRequired
> 
> 
> 
> 
>
> 
>
> 
>  name="loginRequired">loginRequired
> 
>
> 
> /expiredSession.jsp
> 
>
>  class="mesirow.action.AccountActions" method="getClientAccounts">
> 
>
> 
>
> -Original Message-
> From: Chris Pratt [mailto:thechrispr...@gmail.com]
> Sent: Saturday, January 12, 2013 3:11 PM
> To: Struts Users Mailing List
> Subject: Re: Session Expired Interceptor
>
> So you now have this in your struts.xml?
>
> 
>  type="redirectAction">loginRequired
> 
>
>   (*Chris*)
>
>
>
> On Sat, Jan 12, 2013 at 12:06 PM, BetBasoo, Peter <
> pbetba...@mesirowfinancial.com> wrote:
>
> > I did put redirectAction action in, it's still not working. The web
> > page expiredSession.jsp  is not being shown and there is no indication
> > of an error having occurred.
> >
> > When I try this, I observe that the action that initiated the call is
> > still being called, even though the interceptor returns the
> > loginRequired result.
> >
> > Any ideas?
> >
> > -Original Message-
> > From: Mahendru, Ajay [mailto:ajay.mahen...@dish.com]
> > Sent: Friday, January 11, 2013 9:27 PM
> > To: Struts Users Mailing List
> > Subject: RE: Session Expired Interceptor
> >
> > You are missing the redirectAction. Use something like this:
> >
> > programming
> >
> > In your case it would be:
> >
> >> type="redirectAction">loginRequired
> >
> > Regards,
> > Ajay Mahendru
> >
> >
> >
> > -Original Message-
> > From: Dave Newton [mailto:davelnew...@gmail.com]
> > Sent: Friday, January 11, 2013 8:23 PM
> > To: Struts Users Mailing List
> > Subject: Re: Session Expired Interceptor
> >
> > I'm actually surprised it's not erroring out since the global result
> > should be a redirectAction since you're not forwarding to a JSP.
> >
> > Dave
> >
> > (On mobile device, please forgive typos, bizarre autocompletes, and
> > top-
> > quoting.)
> >  On Jan 11, 2013 10:17 PM, "BetBasoo, Peter" <
> > pbetba...@mesirowfinancial.com>
> > wrote:
> >
> > > I have written a simple interceptor to check for an expired session.
> > > Here's the code:
> > >
> > > public class ExpiredSessionInterceptor extends AbstractInterceptor
> > > implements Constants {
> > >   private static final long serialVersionUID = 1L;
> > >   private String excludeActions = "";
> > >
> > >   public synchronized String intercept(ActionInvocation
> > > invocation) throws Exception
> > >   {
> > > Map session =
> > > invocation.getInvocationContext().getSession();
> > > String actionName = invocation.getProxy().getActionName();
> > > if (excludeActions.indexOf(actionName) != -1) return
> > > invocation.invoke();
> > >
> > > UserInfo userInfo = (UserInfo) session.get(Attr_Us

RE: Session Expired Interceptor

2013-01-12 Thread BetBasoo, Peter
Yes, here's struts.xml with one ajax action (getClientAccounts). This action is 
executed when called even though the interceptor returns "loginRequired"


http://struts.apache.org/dtds/struts-2.0.dtd";>











login,logout,index,certLogin.jsp,condo,condoLogin.jsp,sendPassword,registerCondoUser,loginRequired








loginRequired



/expiredSession.jsp







-Original Message-
From: Chris Pratt [mailto:thechrispr...@gmail.com]
Sent: Saturday, January 12, 2013 3:11 PM
To: Struts Users Mailing List
Subject: Re: Session Expired Interceptor

So you now have this in your struts.xml?


loginRequired


  (*Chris*)



On Sat, Jan 12, 2013 at 12:06 PM, BetBasoo, Peter < 
pbetba...@mesirowfinancial.com> wrote:

> I did put redirectAction action in, it's still not working. The web
> page expiredSession.jsp  is not being shown and there is no indication
> of an error having occurred.
>
> When I try this, I observe that the action that initiated the call is
> still being called, even though the interceptor returns the
> loginRequired result.
>
> Any ideas?
>
> -Original Message-
> From: Mahendru, Ajay [mailto:ajay.mahen...@dish.com]
> Sent: Friday, January 11, 2013 9:27 PM
> To: Struts Users Mailing List
> Subject: RE: Session Expired Interceptor
>
> You are missing the redirectAction. Use something like this:
>
> programming
>
> In your case it would be:
>
>type="redirectAction">loginRequired
>
> Regards,
> Ajay Mahendru
>
>
>
> -Original Message-
> From: Dave Newton [mailto:davelnew...@gmail.com]
> Sent: Friday, January 11, 2013 8:23 PM
> To: Struts Users Mailing List
> Subject: Re: Session Expired Interceptor
>
> I'm actually surprised it's not erroring out since the global result
> should be a redirectAction since you're not forwarding to a JSP.
>
> Dave
>
> (On mobile device, please forgive typos, bizarre autocompletes, and
> top-
> quoting.)
>  On Jan 11, 2013 10:17 PM, "BetBasoo, Peter" <
> pbetba...@mesirowfinancial.com>
> wrote:
>
> > I have written a simple interceptor to check for an expired session.
> > Here's the code:
> >
> > public class ExpiredSessionInterceptor extends AbstractInterceptor
> > implements Constants {
> >   private static final long serialVersionUID = 1L;
> >   private String excludeActions = "";
> >
> >   public synchronized String intercept(ActionInvocation
> > invocation) throws Exception
> >   {
> > Map session =
> > invocation.getInvocationContext().getSession();
> > String actionName = invocation.getProxy().getActionName();
> > if (excludeActions.indexOf(actionName) != -1) return
> > invocation.invoke();
> >
> > UserInfo userInfo = (UserInfo) session.get(Attr_UserInfo);
> > if (userInfo == null)
> > {
> >   return "loginRequired";
> > }
> >
> > return invocation.invoke();
> >   }
> >
> >   public void setExcludeActions(String values)
> >   {
> > excludeActions = values;
> >   }
> > }
> >
> > And here's struts.xml
> >
> >   > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> > "http://struts.apache.org/dtds/struts-2.0.dtd";>
> >
> > 
> >
> >   
> >
> >   
> >
> > 
> >> class="mesirow.struts.ExpiredSessionInterceptor" />
> >   
> >  name="expiredSessionInterceptor">
> >>
> name="excludeActions">login,logout,index,certLogin.jsp,condo,condoLogi
> n.jsp,sendPassword,registerCondoUser,loginRequired
> > 
> > 
> >   
> > 
> >
> >  > />
> >
> >   
> >   loginRequired
> > 
> >
> > 
> >   /expiredSession.jsp
> > 
> >
> >   
> >
> > 
> >
> > I have traced into this code and it is correctly returning
> "loginRequired"
> > when the user is not logged in. The problem is, the
> > expiredSession.jsp is not being shown.
> >
> > This app is entirely driven by ajax calls that return NONE from
> > their struts action handlers.
> >
> > What I observe is that instead of showing the expiredSession.jsp,
> > the ajax call goes through to its action handler (and fails). Why is
> > the action handler for an ajax call being called when I am returning
> "loginRequired"?
> >
> >
> > Visit us on the Web at mesirowfinancial.com
> >
> > This communication may contain privileged and/or confidential
> information.
> > It is intended

Re: iterable tag

2013-01-12 Thread Chris Pratt
Looking through the code and the exception.  This appears to be a bug.  It
appears that OGNL is mistaking the TreeMap.Values Collection as a
java.util.Set, when it attempts to coerce it in ognl.SetPropertyAccessor,
you get the noted exception.  This should probably be reported as a bug,
but one workaround would be to change your PersonService code like this:

static public Collection getPeople(){
logger.debug(people.values());
logger.debug(people.values().getClass().toString());
return new ArrayList<>(people.values());
}

  (*Chris*)


On Sat, Jan 12, 2013 at 1:22 PM, Chris Pratt wrote:

> You're right Dave, somehow I replied to the wrong email.  Looking over the
> code now.
>   (*Chris*)
>
>
> On Sat, Jan 12, 2013 at 1:08 PM, Dave Newton wrote:
>
>> (Isn't it around where the iterator tag is in that source? I thought
>> that *was* the OP's code this second barf of source.)
>>
>> Dave
>>
>>
>> On Sat, Jan 12, 2013 at 4:04 PM, Chris Pratt 
>> wrote:
>> > You said in your original post that you used the  tag,
>> > correct?  Can I see how you used it?
>> >   (*Chris*)
>> >
>> >
>> > On Sat, Jan 12, 2013 at 3:06 AM, fusillator 
>> wrote:
>> >
>> >> Sorry for my misunderstanding, I changed the code of the wiki tutorial
>> >> about wildcard
>> >>
>> >> These is the view:
>> >>
>> >> <%@ page language="java" contentType="text/html; charset=UTF-8"
>> >> pageEncoding="UTF-8"%>
>> >> <%@ taglib prefix="s" uri="/struts-tags" %>
>> >> > >> http://www.w3.org/TR/xhtml1/**DTD/xhtml1-transitional.dtd<
>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
>> >> ">
>> >> http://www.w3.org/1999/**xhtml <
>> http://www.w3.org/1999/xhtml>
>> >> ">
>> >> 
>> >> 
>> >> List of people
>> >> 
>> >> 
>> >> List of persons:
>> >> 
>> >> 
>> >> 
>> >> 
>> >>  
>> >> > >> value="id" />
>> >> > value="id"
>> >> />
>> >> Edit
>> >> Remove
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> No person inserted
>> >> 
>> >> 
>> >> Insert a new person
>> >> 
>> >> 
>> >>
>> >> and this is the action class:
>> >>
>> >> package org.apache.struts.tutorial.**wildcard.action;
>> >>
>> >> import java.util.Collection;
>> >> //import java.util.List;
>> >> import org.apache.struts.tutorial.**wildcard.service.**PersonService;
>> >> import org.apache.struts.tutorial.**wildcard.model.Person;
>> >> import org.apache.log4j.Logger;
>> >> import com.opensymphony.xwork2.**ActionSupport;
>> >>
>> >> public class PersonAction extends ActionSupport {
>> >>
>> >> private static final long serialVersionUID = 1L;
>> >>
>> >> private static final Logger logger =
>> Logger.getLogger(PersonAction.**
>> >> class.getName());
>> >>
>> >> private Collection people=PersonService.**getPeople();
>> >> private int code=-1; //parametro passato da view
>> >> private Person personBean;
>> >> private PersonService personService=new PersonService();
>> >>
>> >> @Override
>> >> public String execute(){
>> >> return SUCCESS;
>> >> }
>> >>
>> >> public String edit(){
>> >> setPersonBean(personService.**getPerson(code));
>> >> return INPUT;
>> >> }
>> >>
>> >> public String save(){
>> >> personService.savePerson(**getPersonBean());
>> >> return SUCCESS;
>> >> }
>> >>
>> >> public String remove(){
>> >> personService.removePerson(**code);
>> >> return SUCCESS;
>> >> }
>> >>
>> >> public Collection getPeople() {
>> >> return people;
>> >> }
>> >>
>> >> public void setPeople(Collection people) {
>> >> this.people = people;
>> >> }
>> >>
>> >> public int getCode() {
>> >> return code;
>> >> }
>> >>
>> >> public void setCode(int code) {
>> >> this.code = code;
>> >> }
>> >>
>> >> public Person getPersonBean() {
>> >> return personBean;
>> >> }
>> >>
>> >> public void setPersonBean(Person personBean) {
>> >> this.personBean = personBean;
>> >> }
>> >>
>> >> }
>> >>
>> >> and my modified PersonService class:
>> >>
>> >> package org.apache.struts.tutorial.**wildcard.service;
>> >>
>> >> //import java.util.ArrayList;
>> >> import java.util.Collection;
>> >> //import java.util.List;
>> >> import java.util.SortedMap;
>> >> import java.util.TreeMap;
>> >>
>> >> import org.apache.log4j.Logger;
>> >> import org.apache.struts.tutorial.**wildcard.model.Person;
>> >>
>> >> public class PersonService {
>> >>
>> >> private static final Logger logger = Logger.getLogger(**
>> >> PersonService.class.getName())**;
>> >>
>> >> //static private List peopleList=new ArrayList();
>> >> static private SortedMap people=new
>> >> TreeMap();
>> >> static {
>> >> people.put(new Integer(1), new
>> Person(1,"Paolino","Paperino")**);
>> >> people.put(new Integer(2), new Person(2,"Paperon","De
>> Paperoni"));
>> >> people.put(new Integer(3), new Person(3,"Archimede","**
>> >> Pitagorica"));
>> >> //generateList();
>> >> }
>> >>  

Re: iterable tag

2013-01-12 Thread Chris Pratt
You're right Dave, somehow I replied to the wrong email.  Looking over the
code now.
  (*Chris*)


On Sat, Jan 12, 2013 at 1:08 PM, Dave Newton  wrote:

> (Isn't it around where the iterator tag is in that source? I thought
> that *was* the OP's code this second barf of source.)
>
> Dave
>
>
> On Sat, Jan 12, 2013 at 4:04 PM, Chris Pratt 
> wrote:
> > You said in your original post that you used the  tag,
> > correct?  Can I see how you used it?
> >   (*Chris*)
> >
> >
> > On Sat, Jan 12, 2013 at 3:06 AM, fusillator 
> wrote:
> >
> >> Sorry for my misunderstanding, I changed the code of the wiki tutorial
> >> about wildcard
> >>
> >> These is the view:
> >>
> >> <%@ page language="java" contentType="text/html; charset=UTF-8"
> >> pageEncoding="UTF-8"%>
> >> <%@ taglib prefix="s" uri="/struts-tags" %>
> >>  >> http://www.w3.org/TR/xhtml1/**DTD/xhtml1-transitional.dtd<
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
> >> ">
> >> http://www.w3.org/1999/**xhtml <
> http://www.w3.org/1999/xhtml>
> >> ">
> >> 
> >> 
> >> List of people
> >> 
> >> 
> >> List of persons:
> >> 
> >> 
> >> 
> >> 
> >>  
> >>  >> value="id" />
> >>  >> />
> >> Edit
> >> Remove
> >> 
> >> 
> >> 
> >> 
> >> 
> >> No person inserted
> >> 
> >> 
> >> Insert a new person
> >> 
> >> 
> >>
> >> and this is the action class:
> >>
> >> package org.apache.struts.tutorial.**wildcard.action;
> >>
> >> import java.util.Collection;
> >> //import java.util.List;
> >> import org.apache.struts.tutorial.**wildcard.service.**PersonService;
> >> import org.apache.struts.tutorial.**wildcard.model.Person;
> >> import org.apache.log4j.Logger;
> >> import com.opensymphony.xwork2.**ActionSupport;
> >>
> >> public class PersonAction extends ActionSupport {
> >>
> >> private static final long serialVersionUID = 1L;
> >>
> >> private static final Logger logger =
> Logger.getLogger(PersonAction.**
> >> class.getName());
> >>
> >> private Collection people=PersonService.**getPeople();
> >> private int code=-1; //parametro passato da view
> >> private Person personBean;
> >> private PersonService personService=new PersonService();
> >>
> >> @Override
> >> public String execute(){
> >> return SUCCESS;
> >> }
> >>
> >> public String edit(){
> >> setPersonBean(personService.**getPerson(code));
> >> return INPUT;
> >> }
> >>
> >> public String save(){
> >> personService.savePerson(**getPersonBean());
> >> return SUCCESS;
> >> }
> >>
> >> public String remove(){
> >> personService.removePerson(**code);
> >> return SUCCESS;
> >> }
> >>
> >> public Collection getPeople() {
> >> return people;
> >> }
> >>
> >> public void setPeople(Collection people) {
> >> this.people = people;
> >> }
> >>
> >> public int getCode() {
> >> return code;
> >> }
> >>
> >> public void setCode(int code) {
> >> this.code = code;
> >> }
> >>
> >> public Person getPersonBean() {
> >> return personBean;
> >> }
> >>
> >> public void setPersonBean(Person personBean) {
> >> this.personBean = personBean;
> >> }
> >>
> >> }
> >>
> >> and my modified PersonService class:
> >>
> >> package org.apache.struts.tutorial.**wildcard.service;
> >>
> >> //import java.util.ArrayList;
> >> import java.util.Collection;
> >> //import java.util.List;
> >> import java.util.SortedMap;
> >> import java.util.TreeMap;
> >>
> >> import org.apache.log4j.Logger;
> >> import org.apache.struts.tutorial.**wildcard.model.Person;
> >>
> >> public class PersonService {
> >>
> >> private static final Logger logger = Logger.getLogger(**
> >> PersonService.class.getName())**;
> >>
> >> //static private List peopleList=new ArrayList();
> >> static private SortedMap people=new
> >> TreeMap();
> >> static {
> >> people.put(new Integer(1), new
> Person(1,"Paolino","Paperino")**);
> >> people.put(new Integer(2), new Person(2,"Paperon","De
> Paperoni"));
> >> people.put(new Integer(3), new Person(3,"Archimede","**
> >> Pitagorica"));
> >> //generateList();
> >> }
> >> /*
> >> static void generateList(){
> >> peopleList.clear();
> >> for (Integer i : people.keySet()){
> >> peopleList.add(people.get(i));
> >> }
> >> }
> >> */
> >> static public Collection getPeople(){
> >> logger.debug(people.values());
> >> logger.debug(people.values().**getClass().toString());
> >> return people.values();
> >> }
> >>
> >> public Person getPerson(int code){
> >> if (code<0)
> >> return new Person(-1,"","");
> >> else
> >> return people.get(new Integer(code));
> >> }
> >>
> >> public void savePerson(Person person){
> >> logger.debug(person);
> >> if (person.getId()>=0){
> >> people.put(new Integer(person.getId()),**person);

Re: Session Expired Interceptor

2013-01-12 Thread Chris Pratt
So you now have this in your struts.xml?


loginRequired


  (*Chris*)



On Sat, Jan 12, 2013 at 12:06 PM, BetBasoo, Peter <
pbetba...@mesirowfinancial.com> wrote:

> I did put redirectAction action in, it's still not working. The web page
> expiredSession.jsp  is not being shown and there is no indication of an
> error having occurred.
>
> When I try this, I observe that the action that initiated the call is
> still being called, even though the interceptor returns the loginRequired
> result.
>
> Any ideas?
>
> -Original Message-
> From: Mahendru, Ajay [mailto:ajay.mahen...@dish.com]
> Sent: Friday, January 11, 2013 9:27 PM
> To: Struts Users Mailing List
> Subject: RE: Session Expired Interceptor
>
> You are missing the redirectAction. Use something like this:
>
> programming
>
> In your case it would be:
>
>   loginRequired
>
> Regards,
> Ajay Mahendru
>
>
>
> -Original Message-
> From: Dave Newton [mailto:davelnew...@gmail.com]
> Sent: Friday, January 11, 2013 8:23 PM
> To: Struts Users Mailing List
> Subject: Re: Session Expired Interceptor
>
> I'm actually surprised it's not erroring out since the global result
> should be a redirectAction since you're not forwarding to a JSP.
>
> Dave
>
> (On mobile device, please forgive typos, bizarre autocompletes, and top-
> quoting.)
>  On Jan 11, 2013 10:17 PM, "BetBasoo, Peter" <
> pbetba...@mesirowfinancial.com>
> wrote:
>
> > I have written a simple interceptor to check for an expired session.
> > Here's the code:
> >
> > public class ExpiredSessionInterceptor extends AbstractInterceptor
> > implements Constants {
> >   private static final long serialVersionUID = 1L;
> >   private String excludeActions = "";
> >
> >   public synchronized String intercept(ActionInvocation
> > invocation) throws Exception
> >   {
> > Map session =
> > invocation.getInvocationContext().getSession();
> > String actionName = invocation.getProxy().getActionName();
> > if (excludeActions.indexOf(actionName) != -1) return
> > invocation.invoke();
> >
> > UserInfo userInfo = (UserInfo) session.get(Attr_UserInfo);
> > if (userInfo == null)
> > {
> >   return "loginRequired";
> > }
> >
> > return invocation.invoke();
> >   }
> >
> >   public void setExcludeActions(String values)
> >   {
> > excludeActions = values;
> >   }
> > }
> >
> > And here's struts.xml
> >
> >   > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> > "http://struts.apache.org/dtds/struts-2.0.dtd";>
> >
> > 
> >
> >   
> >
> >   
> >
> > 
> >> class="mesirow.struts.ExpiredSessionInterceptor" />
> >   
> >  name="expiredSessionInterceptor">
> >>
> name="excludeActions">login,logout,index,certLogin.jsp,condo,condoLogin.jsp,sendPassword,registerCondoUser,loginRequired
> > 
> > 
> >   
> > 
> >
> > 
> >
> >   
> >   loginRequired
> > 
> >
> > 
> >   /expiredSession.jsp
> > 
> >
> >   
> >
> > 
> >
> > I have traced into this code and it is correctly returning
> "loginRequired"
> > when the user is not logged in. The problem is, the expiredSession.jsp
> > is not being shown.
> >
> > This app is entirely driven by ajax calls that return NONE from their
> > struts action handlers.
> >
> > What I observe is that instead of showing the expiredSession.jsp, the
> > ajax call goes through to its action handler (and fails). Why is the
> > action handler for an ajax call being called when I am returning
> "loginRequired"?
> >
> >
> > Visit us on the Web at mesirowfinancial.com
> >
> > This communication may contain privileged and/or confidential
> information.
> > It is intended solely for the use of the addressee. If you are not the
> > intended recipient, you are strictly prohibited from disclosing,
> > copying, distributing or using any of this information. If you
> > received this communication in error, please contact the sender
> > immediately and destroy the material in its entirety, whether electronic
> or hard copy.
> > Confidential, proprietary or time-sensitive communications should not
> > be transmitted via the Internet, as there can be no assurance of
> > actual or timely delivery, receipt and/or confidentiality. This is not
> > an offer, or solicitation of any offer to buy or sell any security,
> > investment or other product.
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
> Visit us on the Web at mesirowfinancial.com
>
> This communication may contain privileged and/or confidential info

Struts 1.3 Tiles not working

2013-01-12 Thread sameer ali
Hi,
I am Unable to get tiles to work in my application . I am using Struts 1.3
, stuts-tiles-1.3.10.jar is in the lib folder I am building this
application on top of struts-blank.war


The struts-config.xml





http://struts.apache.org/dtds/struts-config_1_3.dtd";>


















































 














  

  

  




  
  
  








tiles-defs.xml




http://struts.apache.org/dtds/tiles-config_1_3.dtd";>





























I am not sure if tiles is being intialized properly this is all i get in
tomcat console regarding tiles

Jan 8, 2013 10:24:11 PM org.apache.struts.tiles.TilesPlugin
initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.

I guess something more should appear right ?

 on accessing the application a forward action throws the following
exception

WARNING: Unhandled exception
java.lang.IllegalArgumentException: Path search.page does not start with a
"/" character
at
org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:431)


Have I missed something please help


Re: iterable tag

2013-01-12 Thread Dave Newton
(Isn't it around where the iterator tag is in that source? I thought
that *was* the OP's code this second barf of source.)

Dave


On Sat, Jan 12, 2013 at 4:04 PM, Chris Pratt  wrote:
> You said in your original post that you used the  tag,
> correct?  Can I see how you used it?
>   (*Chris*)
>
>
> On Sat, Jan 12, 2013 at 3:06 AM, fusillator  wrote:
>
>> Sorry for my misunderstanding, I changed the code of the wiki tutorial
>> about wildcard
>>
>> These is the view:
>>
>> <%@ page language="java" contentType="text/html; charset=UTF-8"
>> pageEncoding="UTF-8"%>
>> <%@ taglib prefix="s" uri="/struts-tags" %>
>> > http://www.w3.org/TR/xhtml1/**DTD/xhtml1-transitional.dtd
>> ">
>> http://www.w3.org/1999/**xhtml 
>> ">
>> 
>> 
>> List of people
>> 
>> 
>> List of persons:
>> 
>> 
>> 
>> 
>>  
>> > value="id" />
>> > />
>> Edit
>> Remove
>> 
>> 
>> 
>> 
>> 
>> No person inserted
>> 
>> 
>> Insert a new person
>> 
>> 
>>
>> and this is the action class:
>>
>> package org.apache.struts.tutorial.**wildcard.action;
>>
>> import java.util.Collection;
>> //import java.util.List;
>> import org.apache.struts.tutorial.**wildcard.service.**PersonService;
>> import org.apache.struts.tutorial.**wildcard.model.Person;
>> import org.apache.log4j.Logger;
>> import com.opensymphony.xwork2.**ActionSupport;
>>
>> public class PersonAction extends ActionSupport {
>>
>> private static final long serialVersionUID = 1L;
>>
>> private static final Logger logger = Logger.getLogger(PersonAction.**
>> class.getName());
>>
>> private Collection people=PersonService.**getPeople();
>> private int code=-1; //parametro passato da view
>> private Person personBean;
>> private PersonService personService=new PersonService();
>>
>> @Override
>> public String execute(){
>> return SUCCESS;
>> }
>>
>> public String edit(){
>> setPersonBean(personService.**getPerson(code));
>> return INPUT;
>> }
>>
>> public String save(){
>> personService.savePerson(**getPersonBean());
>> return SUCCESS;
>> }
>>
>> public String remove(){
>> personService.removePerson(**code);
>> return SUCCESS;
>> }
>>
>> public Collection getPeople() {
>> return people;
>> }
>>
>> public void setPeople(Collection people) {
>> this.people = people;
>> }
>>
>> public int getCode() {
>> return code;
>> }
>>
>> public void setCode(int code) {
>> this.code = code;
>> }
>>
>> public Person getPersonBean() {
>> return personBean;
>> }
>>
>> public void setPersonBean(Person personBean) {
>> this.personBean = personBean;
>> }
>>
>> }
>>
>> and my modified PersonService class:
>>
>> package org.apache.struts.tutorial.**wildcard.service;
>>
>> //import java.util.ArrayList;
>> import java.util.Collection;
>> //import java.util.List;
>> import java.util.SortedMap;
>> import java.util.TreeMap;
>>
>> import org.apache.log4j.Logger;
>> import org.apache.struts.tutorial.**wildcard.model.Person;
>>
>> public class PersonService {
>>
>> private static final Logger logger = Logger.getLogger(**
>> PersonService.class.getName())**;
>>
>> //static private List peopleList=new ArrayList();
>> static private SortedMap people=new
>> TreeMap();
>> static {
>> people.put(new Integer(1), new Person(1,"Paolino","Paperino")**);
>> people.put(new Integer(2), new Person(2,"Paperon","De Paperoni"));
>> people.put(new Integer(3), new Person(3,"Archimede","**
>> Pitagorica"));
>> //generateList();
>> }
>> /*
>> static void generateList(){
>> peopleList.clear();
>> for (Integer i : people.keySet()){
>> peopleList.add(people.get(i));
>> }
>> }
>> */
>> static public Collection getPeople(){
>> logger.debug(people.values());
>> logger.debug(people.values().**getClass().toString());
>> return people.values();
>> }
>>
>> public Person getPerson(int code){
>> if (code<0)
>> return new Person(-1,"","");
>> else
>> return people.get(new Integer(code));
>> }
>>
>> public void savePerson(Person person){
>> logger.debug(person);
>> if (person.getId()>=0){
>> people.put(new Integer(person.getId()),**person);
>> } else {
>> int id = people.isEmpty() ? 1 : people.lastKey().intValue()+1;
>> person.setId(id);
>> people.put(new Integer(id),person);
>> }
>> //generateList();
>> }
>>
>> public void removePerson(int code){
>> people.remove(new Integer(code));
>> //generateList();
>> }
>>
>> }
>>
>>
>> The mapping definitions are:
>>
>> 
>> /view.jsp
>> /input.jsp
>> 
>>
>> The model Person is a pojo with 3 attributes:

RE: Session Expired Interceptor

2013-01-12 Thread BetBasoo, Peter
I did put redirectAction action in, it's still not working. The web page 
expiredSession.jsp  is not being shown and there is no indication of an error 
having occurred.

When I try this, I observe that the action that initiated the call is still 
being called, even though the interceptor returns the loginRequired result.

Any ideas?

-Original Message-
From: Mahendru, Ajay [mailto:ajay.mahen...@dish.com]
Sent: Friday, January 11, 2013 9:27 PM
To: Struts Users Mailing List
Subject: RE: Session Expired Interceptor

You are missing the redirectAction. Use something like this:

programming

In your case it would be:

  loginRequired

Regards,
Ajay Mahendru



-Original Message-
From: Dave Newton [mailto:davelnew...@gmail.com]
Sent: Friday, January 11, 2013 8:23 PM
To: Struts Users Mailing List
Subject: Re: Session Expired Interceptor

I'm actually surprised it's not erroring out since the global result should be 
a redirectAction since you're not forwarding to a JSP.

Dave

(On mobile device, please forgive typos, bizarre autocompletes, and top-
quoting.)
 On Jan 11, 2013 10:17 PM, "BetBasoo, Peter" 
wrote:

> I have written a simple interceptor to check for an expired session.
> Here's the code:
>
> public class ExpiredSessionInterceptor extends AbstractInterceptor
> implements Constants {
>   private static final long serialVersionUID = 1L;
>   private String excludeActions = "";
>
>   public synchronized String intercept(ActionInvocation
> invocation) throws Exception
>   {
> Map session =
> invocation.getInvocationContext().getSession();
> String actionName = invocation.getProxy().getActionName();
> if (excludeActions.indexOf(actionName) != -1) return
> invocation.invoke();
>
> UserInfo userInfo = (UserInfo) session.get(Attr_UserInfo);
> if (userInfo == null)
> {
>   return "loginRequired";
> }
>
> return invocation.invoke();
>   }
>
>   public void setExcludeActions(String values)
>   {
> excludeActions = values;
>   }
> }
>
> And here's struts.xml
>
>   "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
>
> 
>
>   
>
>   
>
> 
>class="mesirow.struts.ExpiredSessionInterceptor" />
>   
> 
>name="excludeActions">login,logout,index,certLogin.jsp,condo,condoLogin.jsp,sendPassword,registerCondoUser,loginRequired
> 
> 
>   
> 
>
> 
>
>   
>   loginRequired
> 
>
> 
>   /expiredSession.jsp
> 
>
>   
>
> 
>
> I have traced into this code and it is correctly returning "loginRequired"
> when the user is not logged in. The problem is, the expiredSession.jsp
> is not being shown.
>
> This app is entirely driven by ajax calls that return NONE from their
> struts action handlers.
>
> What I observe is that instead of showing the expiredSession.jsp, the
> ajax call goes through to its action handler (and fails). Why is the
> action handler for an ajax call being called when I am returning 
> "loginRequired"?
>
>
> Visit us on the Web at mesirowfinancial.com
>
> This communication may contain privileged and/or confidential information.
> It is intended solely for the use of the addressee. If you are not the
> intended recipient, you are strictly prohibited from disclosing,
> copying, distributing or using any of this information. If you
> received this communication in error, please contact the sender
> immediately and destroy the material in its entirety, whether electronic or 
> hard copy.
> Confidential, proprietary or time-sensitive communications should not
> be transmitted via the Internet, as there can be no assurance of
> actual or timely delivery, receipt and/or confidentiality. This is not
> an offer, or solicitation of any offer to buy or sell any security,
> investment or other product.
>

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


Visit us on the Web at mesirowfinancial.com

This communication may contain privileged and/or confidential information. It 
is intended solely for the use of the addressee. If you are not the intended 
recipient, you are strictly prohibited from disclosing, copying, distributing 
or using any of this information. If you received this communication in error, 
please contact the sender immediately and destroy the material in its entirety, 
whether electronic or hard copy. Confidential, proprietary or time-sensitive 
communications should not be transmitted via the Internet, as there can be no 
assurance of actual or timely de

Re: iterable tag

2013-01-12 Thread fusillator
Sorry for my misunderstanding, I changed the code of the wiki tutorial 
about wildcard


These is the view:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>


List of people


List of persons:




 
value="id" />
/>

Edit
Remove





No person inserted


Insert a new person



and this is the action class:

package org.apache.struts.tutorial.wildcard.action;

import java.util.Collection;
//import java.util.List;
import org.apache.struts.tutorial.wildcard.service.PersonService;
import org.apache.struts.tutorial.wildcard.model.Person;
import org.apache.log4j.Logger;
import com.opensymphony.xwork2.ActionSupport;

public class PersonAction extends ActionSupport {

private static final long serialVersionUID = 1L;

private static final Logger logger = 
Logger.getLogger(PersonAction.class.getName());


private Collection people=PersonService.getPeople();
private int code=-1; //parametro passato da view
private Person personBean;
private PersonService personService=new PersonService();

@Override
public String execute(){
return SUCCESS;
}

public String edit(){
setPersonBean(personService.getPerson(code));
return INPUT;
}

public String save(){
personService.savePerson(getPersonBean());
return SUCCESS;
}

public String remove(){
personService.removePerson(code);
return SUCCESS;
}

public Collection getPeople() {
return people;
}

public void setPeople(Collection people) {
this.people = people;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public Person getPersonBean() {
return personBean;
}

public void setPersonBean(Person personBean) {
this.personBean = personBean;
}

}

and my modified PersonService class:

package org.apache.struts.tutorial.wildcard.service;

//import java.util.ArrayList;
import java.util.Collection;
//import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;

import org.apache.log4j.Logger;
import org.apache.struts.tutorial.wildcard.model.Person;

public class PersonService {

private static final Logger logger = 
Logger.getLogger(PersonService.class.getName());


//static private List peopleList=new ArrayList();
static private SortedMap people=new 
TreeMap();

static {
people.put(new Integer(1), new Person(1,"Paolino","Paperino"));
people.put(new Integer(2), new Person(2,"Paperon","De Paperoni"));
people.put(new Integer(3), new Person(3,"Archimede","Pitagorica"));
//generateList();
}
/*
static void generateList(){
peopleList.clear();
for (Integer i : people.keySet()){
peopleList.add(people.get(i));
}
}
*/
static public Collection getPeople(){
logger.debug(people.values());
logger.debug(people.values().getClass().toString());
return people.values();
}

public Person getPerson(int code){
if (code<0)
return new Person(-1,"","");
else
return people.get(new Integer(code));
}

public void savePerson(Person person){
logger.debug(person);
if (person.getId()>=0){
people.put(new Integer(person.getId()),person);
} else {
int id = people.isEmpty() ? 1 : people.lastKey().intValue()+1;
person.setId(id);
people.put(new Integer(id),person);
}
//generateList();
}

public void removePerson(int code){
people.remove(new Integer(code));
//generateList();
}

}


The mapping definitions are:

class="org.apache.struts.tutorial.wildcard.action.PersonAction" 
method="{1}">

/view.jsp
/input.jsp


The model Person is a pojo with 3 attributes: firstName, lastName, id

thanks for the support

Il 12/01/2013 11:50, Umesh Awasthi ha scritto:

I believe what *Chris* has asked is to copy the code from your JSP page

i believe you must be using  tag in your JSP page to iterate
some list
so please copy that code from your JSP and provide here



On Sat, Jan 12, 2013 at 4:16 PM, fusillator  wrote:


Hi Chris, not really sure how to find that code... Anyway this has been my
steps:
$ for lib in /opt/struts-2.3.7/lib/* ; do jar tvf $lib | grep tld && echo
$lib; done
   3349 Wed Aug 10 12:51:32 CEST 2005 META-INF/sitemesh-decorator.**tld
   3013 Sat May 15 11:55:14 CEST 2004 META-INF/sitemesh-page.tld
/opt/struts-2.3.7/lib/**sitemesh-2.4.2.jar
346038 Tue Nov 06 08:13:06 CET 2012 META-INF/struts-tags.tld
/opt/struts-2.3.7/lib/struts2-**core-2.3.7.jar
136496 Tue Nov 06 08:24:22 CET 2012 META-INF/struts-dojo-tags.tld
/opt/struts-2.3.7/lib/struts2-**dojo-plugin-2

Re: iterable tag

2013-01-12 Thread Umesh Awasthi
I believe what *Chris* has asked is to copy the code from your JSP page

i believe you must be using  tag in your JSP page to iterate
some list
so please copy that code from your JSP and provide here



On Sat, Jan 12, 2013 at 4:16 PM, fusillator  wrote:

> Hi Chris, not really sure how to find that code... Anyway this has been my
> steps:
> $ for lib in /opt/struts-2.3.7/lib/* ; do jar tvf $lib | grep tld && echo
> $lib; done
>   3349 Wed Aug 10 12:51:32 CEST 2005 META-INF/sitemesh-decorator.**tld
>   3013 Sat May 15 11:55:14 CEST 2004 META-INF/sitemesh-page.tld
> /opt/struts-2.3.7/lib/**sitemesh-2.4.2.jar
> 346038 Tue Nov 06 08:13:06 CET 2012 META-INF/struts-tags.tld
> /opt/struts-2.3.7/lib/struts2-**core-2.3.7.jar
> 136496 Tue Nov 06 08:24:22 CET 2012 META-INF/struts-dojo-tags.tld
> /opt/struts-2.3.7/lib/struts2-**dojo-plugin-2.3.7.jar
>752 Tue Nov 06 08:27:06 CET 2012 META-INF/tags/JsonPlugin.tld
> /opt/struts-2.3.7/lib/struts2-**json-plugin-2.3.7.jar
>  0 Tue May 13 21:39:54 CEST 2008 META-INF/tld/
>  27808 Tue May 13 21:39:54 CEST 2008 META-INF/tld/tiles-jsp.tld
> /opt/struts-2.3.7/lib/tiles-**jsp-2.0.6.jar
>
> $ jar xvf /opt/struts-2.3.7/lib/struts2-**core-2.3.7.jar
> META-INF/struts-tags.tld
>  \decompresso: META-INF/struts-tags.tld
>
> $ grep -n "iterator" META-INF/struts-tags.tld
> 4881:iterator
>
> and the tag definition in the tld file is:
>
> 
> 
> iterator
> org.apache.struts2.**views.jsp.IteratorTag
> JSP
> 
> 
>
> $ find src -name IteratorTag.java
> src/core/src/main/java/org/**apache/struts2/views/jsp/**IteratorTag.java
>
> $ cat src/core/src/main/java/org/**apache/struts2/views/jsp/**
> IteratorTag.java
> /*
>  * $Id: IteratorTag.java 741179 2009-02-05 16:55:14Z musachy $
>  *
>  * Licensed to the Apache Software Foundation (ASF) under one
>  * or more contributor license agreements.  See the NOTICE file
>  * distributed with this work for additional information
>  * regarding copyright ownership.  The ASF licenses this file
>  * to you under the Apache License, Version 2.0 (the
>  * "License"); you may not use this file except in compliance
>  * with the License.  You may obtain a copy of the License at
>  *
>  *  
> http://www.apache.org/**licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing,
>  * software distributed under the License is distributed on an
>  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>  * KIND, either express or implied.  See the License for the
>  * specific language governing permissions and limitations
>  * under the License.
>  */
>
> package org.apache.struts2.views.jsp;
>
> import javax.servlet.http.**HttpServletRequest;
> import javax.servlet.http.**HttpServletResponse;
> import javax.servlet.jsp.**JspException;
>
> import org.apache.struts2.components.**Component;
> import org.apache.struts2.components.**IteratorComponent;
>
> import com.opensymphony.xwork2.util.**ValueStack;
>
> /**
>  * @see IteratorComponent
>  */
> public class IteratorTag extends ContextBeanTag {
>
> private static final long serialVersionUID = -1827978135193581901L;
>
> protected String statusAttr;
> protected String value;
> protected String begin;
> protected String end;
> protected String step;
>
> public Component getBean(ValueStack stack, HttpServletRequest req,
> HttpServletResponse res) {
> return new IteratorComponent(stack);
> }
>
> protected void populateParams() {
> super.populateParams();
>
> IteratorComponent tag = (IteratorComponent) getComponent();
> tag.setStatus(statusAttr);
> tag.setValue(value);
> tag.setBegin(begin);
> tag.setEnd(end);
> tag.setStep(step);
> }
>
> public void setStatus(String status) {
> this.statusAttr = status;
> }
>
> public void setValue(String value) {
> this.value = value;
> }
>
> public void setBegin(String begin) {
> this.begin = begin;
> }
>
> public void setEnd(String end) {
> this.end = end;
> }
>
> public void setStep(String step) {
> this.step = step;
> }
>
> public int doEndTag() throws JspException {
> component = null;
> return EVAL_PAGE;
> }
>
> public int doAfterBody() throws JspException {
> boolean again = component.end(pageContext.**getOut(), getBody());
>
> if (again) {
> return EVAL_BODY_AGAIN;
> } else {
> if (bodyContent != null) {
> try {
> bodyContent.writeOut(**bodyContent.**getEnclosingWriter());
> } catch (Exception e) {
> throw new JspException(e.getMessage());
> }
> }
> return SKIP_BODY;
> }
> }
>
> }
>
> Thanks a lot for your help.
>
>
>
>
>
> Il 11/01/2013 20:21, Chris Pratt ha scritto:
>
>> Can you cut and paste your  code into the email so 

Re: iterable tag

2013-01-12 Thread fusillator
Hi Chris, not really sure how to find that code... Anyway this has been 
my steps:
$ for lib in /opt/struts-2.3.7/lib/* ; do jar tvf $lib | grep tld && 
echo $lib; done

  3349 Wed Aug 10 12:51:32 CEST 2005 META-INF/sitemesh-decorator.tld
  3013 Sat May 15 11:55:14 CEST 2004 META-INF/sitemesh-page.tld
/opt/struts-2.3.7/lib/sitemesh-2.4.2.jar
346038 Tue Nov 06 08:13:06 CET 2012 META-INF/struts-tags.tld
/opt/struts-2.3.7/lib/struts2-core-2.3.7.jar
136496 Tue Nov 06 08:24:22 CET 2012 META-INF/struts-dojo-tags.tld
/opt/struts-2.3.7/lib/struts2-dojo-plugin-2.3.7.jar
   752 Tue Nov 06 08:27:06 CET 2012 META-INF/tags/JsonPlugin.tld
/opt/struts-2.3.7/lib/struts2-json-plugin-2.3.7.jar
 0 Tue May 13 21:39:54 CEST 2008 META-INF/tld/
 27808 Tue May 13 21:39:54 CEST 2008 META-INF/tld/tiles-jsp.tld
/opt/struts-2.3.7/lib/tiles-jsp-2.0.6.jar

$ jar xvf /opt/struts-2.3.7/lib/struts2-core-2.3.7.jar 
META-INF/struts-tags.tld

 \decompresso: META-INF/struts-tags.tld

$ grep -n "iterator" META-INF/struts-tags.tld
4881:iterator

and the tag definition in the tld file is:



iterator
org.apache.struts2.views.jsp.IteratorTag
JSP



$ find src -name IteratorTag.java
src/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java

$ cat src/core/src/main/java/org/apache/struts2/views/jsp/IteratorTag.java
/*
 * $Id: IteratorTag.java 741179 2009-02-05 16:55:14Z musachy $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.struts2.views.jsp;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;

import org.apache.struts2.components.Component;
import org.apache.struts2.components.IteratorComponent;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * @see IteratorComponent
 */
public class IteratorTag extends ContextBeanTag {

private static final long serialVersionUID = -1827978135193581901L;

protected String statusAttr;
protected String value;
protected String begin;
protected String end;
protected String step;

public Component getBean(ValueStack stack, HttpServletRequest req, 
HttpServletResponse res) {

return new IteratorComponent(stack);
}

protected void populateParams() {
super.populateParams();

IteratorComponent tag = (IteratorComponent) getComponent();
tag.setStatus(statusAttr);
tag.setValue(value);
tag.setBegin(begin);
tag.setEnd(end);
tag.setStep(step);
}

public void setStatus(String status) {
this.statusAttr = status;
}

public void setValue(String value) {
this.value = value;
}

public void setBegin(String begin) {
this.begin = begin;
}

public void setEnd(String end) {
this.end = end;
}

public void setStep(String step) {
this.step = step;
}

public int doEndTag() throws JspException {
component = null;
return EVAL_PAGE;
}

public int doAfterBody() throws JspException {
boolean again = component.end(pageContext.getOut(), getBody());

if (again) {
return EVAL_BODY_AGAIN;
} else {
if (bodyContent != null) {
try {
bodyContent.writeOut(bodyContent.getEnclosingWriter());
} catch (Exception e) {
throw new JspException(e.getMessage());
}
}
return SKIP_BODY;
}
}

}

Thanks a lot for your help.





Il 11/01/2013 20:21, Chris Pratt ha scritto:

Can you cut and paste your  code into the email so we can see?
   (*Chris*)


On Fri, Jan 11, 2013 at 11:12 AM, fusillator  wrote:


Hi all, I'm new to struts2/java matters, so be sympathetic please.

I've a question about  tag

I recently used it to loop on a Iterable collection of type
java.util.TreeMap$Values retrieved by the method java.util.TreeMap.values()

getting the following cast exception:

2013-01-11 18:45:00,520 DEBUG org.apache.struts.tutorial.**
wildcard.service.**PersonService.getPeople:33 [Person [1: Paolino
Paperino], Person [2: Paperon De Paperoni], Person [3: Archimede
Pitagorica]]
2013-01-11 18:45:00,523 DEBUG org.apache.struts.tutorial.*

RE: Session Expired Interceptor

2013-01-12 Thread Mahendru, Ajay
You are missing the redirectAction. Use something like this:

programming

In your case it would be:

  loginRequired

Regards,
Ajay Mahendru



-Original Message-
From: Dave Newton [mailto:davelnew...@gmail.com] 
Sent: Friday, January 11, 2013 8:23 PM
To: Struts Users Mailing List
Subject: Re: Session Expired Interceptor

I'm actually surprised it's not erroring out since the global result should
be a redirectAction since you're not forwarding to a JSP.

Dave

(On mobile device, please forgive typos, bizarre autocompletes, and top-
quoting.)
 On Jan 11, 2013 10:17 PM, "BetBasoo, Peter" 
wrote:

> I have written a simple interceptor to check for an expired session.
> Here's the code:
>
> public class ExpiredSessionInterceptor extends AbstractInterceptor
> implements Constants
> {
>   private static final long serialVersionUID = 1L;
>   private String excludeActions = "";
>
>   public synchronized String intercept(ActionInvocation invocation)
> throws Exception
>   {
> Map session =
> invocation.getInvocationContext().getSession();
> String actionName = invocation.getProxy().getActionName();
> if (excludeActions.indexOf(actionName) != -1) return
> invocation.invoke();
>
> UserInfo userInfo = (UserInfo) session.get(Attr_UserInfo);
> if (userInfo == null)
> {
>   return "loginRequired";
> }
>
> return invocation.invoke();
>   }
>
>   public void setExcludeActions(String values)
>   {
> excludeActions = values;
>   }
> }
>
> And here's struts.xml
>
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd";>
>
> 
>
>   
>
>   
>
> 
>class="mesirow.struts.ExpiredSessionInterceptor" />
>   
> 
>name="excludeActions">login,logout,index,certLogin.jsp,condo,condoLogin.jsp,sendPassword,registerCondoUser,loginRequired
> 
> 
>   
> 
>
> 
>
>   
>   loginRequired
> 
>
> 
>   /expiredSession.jsp
> 
>
>   
>
> 
>
> I have traced into this code and it is correctly returning "loginRequired"
> when the user is not logged in. The problem is, the expiredSession.jsp is
> not being shown.
>
> This app is entirely driven by ajax calls that return NONE from their
> struts action handlers.
>
> What I observe is that instead of showing the expiredSession.jsp, the ajax
> call goes through to its action handler (and fails). Why is the action
> handler for an ajax call being called when I am returning "loginRequired"?
>
>
> Visit us on the Web at mesirowfinancial.com
>
> This communication may contain privileged and/or confidential information.
> It is intended solely for the use of the addressee. If you are not the
> intended recipient, you are strictly prohibited from disclosing, copying,
> distributing or using any of this information. If you received this
> communication in error, please contact the sender immediately and destroy
> the material in its entirety, whether electronic or hard copy.
> Confidential, proprietary or time-sensitive communications should not be
> transmitted via the Internet, as there can be no assurance of actual or
> timely delivery, receipt and/or confidentiality. This is not an offer, or
> solicitation of any offer to buy or sell any security, investment or other
> product.
>

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