You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Per Lovdinger <pe...@yahoo.com> on 2003/05/28 16:30:24 UTC

iterate tag question

Hi there,
I'm Struts newie and have a question about the iterate
tag.
When I'm creating an ArrayList with 2 objects. For
some reason only one show up.
What am I doing wrong ?
I've attached the jsp page.
thanks in advance


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

Re: iterate tag question

Posted by guo yingshou <gu...@yahoo.com.cn>.
try to assign <logic:iterate> element's "id" attribute
to another name.Actually it is a local variable name
which  will be used by <logic:write> element's name
attribute.

 --- Per Lovdinger <pe...@yahoo.com> 的正文:> 
> Hi there,
> I'm Struts newie and have a question about the
> iterate
> tag.
> When I'm creating an ArrayList with 2 objects. For
> some reason only one show up.
> What am I doing wrong ?
> I've attached the jsp page.
> thanks in advance
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to
> Outlook(TM).
> http://calendar.yahoo.com> <%@ page
contentType="text/html;charset=UTF-8"
> language="java" import=diffent classes..." %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld"
> prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld"
> prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld"
> prefix="logic" %>
> <html:html locale="true">   
>    <% 
>    ArrayList users = new ArrayList();    
>    UserProfile user1 = new
> UserProfile("First1","Last1");
>    users.add(user1);
>    UserProfile user2 = new
> UserProfile("First2","Last2");
>    users.add(user2);   
>    request.setAttribute("usersAttrib",users);       
> 
>    %>                                     
>       <table border="1" width="100%">
>          <tr>                          
>             <td>First name</td><td>Last Name</td>
>          </tr>  
>             <logic:iterate id="usersAttrib"
> name="usersAttrib"  />
>                <tr>                      
>                   <td><bean:write name="usersAttrib"
> property="firstName"/></td>                     
>                   <td><bean:write name="usersAttrib"
> property="lastName"/></td>
>                </tr>
>             </logic:iterate>         
>       </table>      
> </html:html>
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
struts-user-help@jakarta.apache.org 

_________________________________________________________
Do You Yahoo!? 
流连网络世界的“你”是谁?
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.surveys.yahoo.com/cn_user_profile_study_may2003

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


Re: CMA and LoginAction

Posted by Max Cooper <ma...@maxcooper.com>.
In a word, no. There is no way to have CMA call your Action when a user logs
in. There are alternatives, however.

If all your requests go through Actions, you could add code to your app's
Action base class to ensure that the profile information is there. I think
there are more alternatives of where to put that kind of processing in the
1.1 version of Struts. Or you could create a filter that would look for
profile info, add it if the user is authenticated but there is no profile -- 
that would work no matter if your requests are all handled by Actions or
not. Or you could create a method that you would use to access the profile
info, and the method would create it just-in-time if it had not been
initialized yet.

I am not completely sure where you want to get the role information, but you
must setup the CMA to have access to your role info if you want other
software packages to be able to use that info. Those packages depend on
using the request.isUserInRole() method from the Servlet spec. That method
will work with a properly setup CMA system, or you can write a filter and
request wrapper to do a custom implementation. Your CMA system must have
access to the roles so that you can do url-pattern based declarative
security -- without being able to protect resources by url pattern, no users
will ever be authenticated.

I created an open-source filter and request wrapper implementation that
mimics container-managed security. You may find it useful as-is, or it could
be the base of a customized system if your app has needs that it or CMA does
not address:
http://securityfilter.sourceforge.net/

-Max

----- Original Message ----- 
From: "Mohan Radhakrishnan" <mr...@cellexchange.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Friday, June 06, 2003 7:15 AM
Subject: CMA and LoginAction


> Hi
>
>        I would like to use role based authentication. That is CMA. Now I
> also want to call my Action class. The idea is to use
>
>  <logic:present role="name"/>
>
>  My Action class sets up user profiles based on the login ID etc. Is this
> possible ?
>
> Mohan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



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


CMA and LoginAction

Posted by Mohan Radhakrishnan <mr...@cellexchange.com>.
Hi

       I would like to use role based authentication. That is CMA. Now I
also want to call my Action class. The idea is to use

 <logic:present role="name"/>

 My Action class sets up user profiles based on the login ID etc. Is this
possible ?

Mohan



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