Hi,

Note: The message that you have got from me below was before you mentioned
the formBean idea.  I haven�t tested that one yet.

Basically below you will see a config based on an example that I downloaded
from the net.  All that I have done for testing purposes so far is to get my
data from my session bean using the "LoginAction.java".  On successful login
the Welcome.jsp is displayed which is where I put the tags that you
suggested.

bye Michael


============= STRUTS CONFIG ============
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";>

<struts-config>
    <!-- ========== Form Bean Definitions  -->
    <form-beans>
    <!-- There can be many form-bean elements defined. One for each form in
the system -->
        <form-bean  name="loginForm"
type="com.morelogs.guestbook.forms.LoginForm"/>
    </form-beans>

    <!-- ========== Global Forward Definitions  -->
    <global-forwards>
        <forward name="login"   path="/jsp/Login.jsp"/>
        <forward name="error"   path="/jsp/Errorpage.jsp"/>
    </global-forwards>

    <!-- ========== Action Mapping Definitions  -->
    <action-mappings>


        <action path="/login"
                type="com.morelogs.guestbook.actions.LoginAction"
                name="loginForm"
                scope="request"
                input="/jsp/Login.jsp">
            <forward name="success" path="/jsp/Welcome.jsp"/>
            <forward name="failure" path="/jsp/Login.jsp"/>
        </action>


    </action-mappings>
</struts-config>
==============================================================

----- Original Message -----
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, May 14, 2002 12:30 AM
Subject: RE: Getting a list from a session bean and displaying the data in a
jsp


> Let's see your struts-config.
>
> -----Original Message-----
> From: Michael Delamere [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 5:43 PM
> To: Struts Users Mailing List
> Subject: Re: Getting a list from a session bean and displaying the data
> in a jsp
>
>
> Hi,
>
> thanks for the response.
>
> I�ve done exactly as you said and I get the following error message:
>
> =========== ERROR ========================
> javax.servlet.ServletException: Cannot find bean
> org.apache.struts.taglib.html.BEAN in scope null
>  at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:463)
>  at org.apache.jsp.Welcome$jsp._jspService(Welcome$jsp.java:186)
>  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:202)
>  at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
>  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
>
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
> java:683)
>  at
>
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
> er.java:431)
>  at
>
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
> .java:355)
>  at
>
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
> va:1759)
>  at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
>  at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> [...]
> =============================================================
>
> Here�s the call to my session bean:
>
> ========== CALL TO SESSION BEAN ==============================
>          // Get a naming context
>          InitialContext jndiContext = new InitialContext();
>
>          // Get a reference to a EntryBean
>          Object ref  = jndiContext.lookup("ejb/guestbook/gbEntries");
>
>          // Get a reference from this to the Bean's Home interface
>          gbEntriesHome home = (gbEntriesHome)
>             PortableRemoteObject.narrow (ref, gbEntriesHome.class);
>
>     ArrayList entryList = new ArrayList();
>
>     gbEntries entriesObj = home.create();
>     Object[] entries = entriesObj.getEntriesList();
>     for (int i = 0; i < entries.length; i++)
>     {
>      gbEntry entry = (gbEntry) entries[i];
>       entryList.add(entry);
>
>       // I get the results printed in my output screen so this works.
>       System.out.println (entry.getEntry_subject() + "\t" +
> entry.getEntry_text() + "\t" +
>          entry.getEntry_date() + "\t" + entry.getEntry_views());
>     }
>
>     request.setAttribute("entryList", entryList);
> ================================================================
>
> Here�s the change in my JSP file:
> ===============  JSP FILE ========================================
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/nested-tags.tld" prefix="nested" %>
>
> <logic:iterate name="entryList"
>            id="gbEntry"
>            scope="request"
>            type="com.morelogs.guestbook.interfaces.gbEntry">
>   <tr>
>     <td><html:text property="entry_subject" /></td>
>     <td><html:text property="entry_text" /></td>
>     <td><html:text property="entry_date" /></td>
>   </tr>
> </logic:iterate>
> ===============================================================
> Could you please have a look over this to see if I have missed something.
> I would really appreciate further help on this.
>
> Regards,
>
> Michael
>
>
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, May 13, 2002 10:12 PM
> Subject: Re: Getting a list from a session bean and displaying the data in
a
> jsp
>
>
> >
> > In a non-nested context, you would do the following for a collection of
> > objects associated with the request object
> >
> > <logic:iterate name="entryList"
> >            id="entry"
> >            scope="request"
> >            type="com.xxx.xxx.xxx.Entry">
> >   <tr>
> >     <td><html:text property="entry_subject" /></td>
> >     <td><html:text property="entry_text" /></td>
> >     <td><html:text property="entry_date" /></td>
> >   </tr>
> > </logic:iterate>
> >
> >
> >
> >
> >
> > "Michael Delamere" <[EMAIL PROTECTED]> on 05/13/2002 01:00:42 PM
> >
> > Please respond to "Struts Users Mailing List"
> >       <[EMAIL PROTECTED]>
> >
> > To:   "'Struts Users Mailing List' \(E-mail\)"
> >       <[EMAIL PROTECTED]>
> > cc:
> > Subject:  Getting a list from a session bean and displaying the data in
a
> >       jsp
> >
> >
> > Hi,
> >
> > I�ve got a session bean which returns an Object[] array of entity beans.
> > In
> > my action file I get the array via a jndiContext.lookup.  That�s all no
> > problem and I can retreive my data out of the entity beans.
> >
> > However, I�m slightly stuck getting them over to my jsp file.  I�ve
tried
> >
> > request.setAttribute("entryList", entryList);
> >
> > and then outputing the data with:
> >
> > <nested:iterate property="entryList">
> >   <tr>
> >     <td><nested:text property="entry_subject" /></td>
> >     <td><nested:text property="entry_text" /></td>
> >     <td><nested:text property="entry_date" /></td>
> >   </tr>
> > </nested:iterate>
> >
> > Could someone give me an insight of how this is done.
> > I would be most grateful.
> >
> > Thanks,
> >
> > Michael
> >
> >
> > --
> > To unsubscribe, e-mail:   <
> > mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <
> > mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> >
> > **********************************************************************
> > Please Note:
> > The information in this E-mail message, and any files transmitted
> > with it, is confidential and may be legally privileged.  It is
> > intended only for the use of the individual(s) named above.  If you
> > are the intended recipient, be aware that your use of any confidential
> > or personal information may be restricted by state and federal
> > privacy laws.  If you, the reader of this message, are not the
> > intended recipient, you are hereby notified that you should not
> > further disseminate, distribute, or forward this E-mail message.
> > If you have received this E-mail in error, please notify the sender
> > and delete the material from any computer.  Thank you.
> > **********************************************************************
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to