Wendy, (and Struts Dev list) Thanks again for your help. I've started playing with the JSTL tags and they seem quite useful.
This is my first Web development project, which could explain some of my confusion. I'm directly jumping into struts, so I'm not sure when some of my questions are about the Struts framework or about J2EE in general. In any case, I have a few follow up questions based on your last two emails: > Lucky you! You have some options. I believe that 'out of > the box' TC5 acts > like a JSP 1.2 container. You have to "do something" to > enable the use of > expressions througout the page. You'll have to figure out > what that is, I'm > stuck on 4.1 due to work. Once you do that, you can write > ${expr} > anywhere in the page, and it will be evaluated prior to dealing with > whatever surrounds it. I haven't found any information on configuring Tomcat 5 to work with JSP 2.0. As far as I can tell, it doesn't need any extra configuration. In any case, I've written code that should work for JSP 1.2, and then for JSP 2.0, but neither seems to work. As it stands, my application is pretty simple (I'm keeping it this way until I learn all of the ins and outs of struts). There is a login page, which contains a struts form. In the LoginAction class I load my ProjectsBean into the request object: request.setAttribute("projectsBean", new ProjecsBean()); which automatically populates the bean with the data I'd like to display. I then forward to the projects page. The following jsp page (using scriptlets, I know, *bleeeech*), works, and does basically what I would like it to do: <BODY> <% ProjectsBean projectsBean = (ProjectsBean) request.getAttribute("projectsBean"); Set projects = projectsBean.getProjects(); Iterator projectsIterator = projects.iterator(); Project project; %> <TABLE> <TR> <TH>Project ID</TH> <TH>Project</TH> <TH>Customer</TH> <TH>Software Version</TH> </TR> <% while (projectsIterator.hasNext()) { project = (Project) projectsIterator.next(); %> <TR> <TD><%= project.getProjectId() %></TD> <TD><%= project.getProjectName() %></TD> <TD><%= project.getCustomerName() %></TD> <TD><%= project.getSoftwareVersionName() %></TD> </TR> <% } %> </TABLE> </BODY> I tried coding it using the JSTL tags that you recommended, which of course, is a lot cleaner: <BODY> <TABLE> <TR> <TH>Project ID</TH> <TH>Project</TH> <TH>Customer</TH> <TH>Software Version</TH> </TR> <c:forEach items="${projectsBean.projects}" var="project"> <TR> <TD><c:out value="${project.projectId}" /></TD> <TD><c:out value="${project.projectName}" /></TD> <TD><c:out value="${project.customerName}" /></TD> <TD><c:out value="${project.softwareVersionName}" /></TD> </TR> </c:forEach> </TABLE> </BODY> Instead of doing what I would expect, it prints out the the text of "$(project.projectId}" instead of its value. Note that I also tried using your JSP 2.0 recommendation, replacing the <c:out> tag with just "${project.projectId}". Same result. Thanks again for your help, Wendy, and to everyone who responded to my earlier post. I've forwarded this response to the list as well in case Wendy is not available again to respond. Regards, Anthony Frasso > -----Original Message----- > From: Wendy Smoak [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 05, 2005 7:53 PM > To: Frasso, Anthony > Subject: Re: [offlist] Re: Newbie Help > > > From: "Frasso, Anthony" <[EMAIL PROTECTED]> > > > Thanks for the quick feedback Wendy! I will indeed check out JSTL. > > (You also have a couple of replies on the list, if you didn't > see them.) > > > Actually... I am using Tomcat 5.5, which I believe uses JSP > 2.0. How > would your advice change? > > Lucky you! You have some options. I believe that 'out of > the box' TC5 acts > like a JSP 1.2 container. You have to "do something" to > enable the use of > expressions througout the page. You'll have to figure out > what that is, I'm > stuck on 4.1 due to work. Once you do that, you can write > ${expr} > anywhere in the page, and it will be evaluated prior to dealing with > whatever surrounds it. > > What that means is that you should NOT use Struts-EL. And > you won't need > the <c:out> tags in my example, you can write > ${project.projectName} > directly. > > You can continue using the 'Struts Classic' tags, and can use > expressions > whereever you please. Do try to avoid the Struts tags that have JSTL > equivalents-- the README file for Struts-EL might be useful > there, even > though you're not using those tags. > > It also means that when you acquire JSTL, you'll want the 1.1 version. > http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html > > Have fun! Just ask if you get stuck-- it's best to post to > the list first, > as you did. And because we can't keep track of who's using > what, list your > Struts, Servlet and JSP versions with each question. That > will help make > sure you get the right answer for your setup. > > -- > Wendy Smoak > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]