LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2004, 11:49 PM   #1
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Rep: Reputation: 31
about Jakarta Struts, Jsp's and Tomcat.... problem iterating in a jsp


Hello:

I am building a little web application under struts and tomcat. I have managed to understand the things on web.xml and struts-config.xml.

I also have a login screen so the user is authenticated.... the jsp would create a LoginAction populated by a LoginForm, go to the business delegate and check the database for authentication, in order to forward the user to the next page...

So bassically I can use the interaction between a form in html (jsp) to fill an ActionForm and trigger an Action in the serverside..... But I have trouble in doing the same thing without the form in html (jsp)

The thing is that once the user is logged int, there should be an screen with some info about him/her.... let's say, some news generated by the system.

I've googled for it but I believe it's quite too specific so I can't find the answer... I also believe it should be something quite simple, as a single line or something... I hope

I've reading the ORelly Programming with Jakarta Struts but I couldn't figure it out please anyone be so kind to help me


I think about those news as an array of objects wrapping just an String with the content of the new.

So I have in the login Action in struts-config.xml the following mapping:

Code:
 <action
    path="/login"
    type="crimson.ccss.common.login.LoginAction"
    scope="request"
    name="loginForm"
    validate="true"
    input="/login.jsp">
    <forward name="Success" path="/action/teacher/getWelcomeInformation" redirect="true"/>
     <forward name="Failure" path="/login.jsp" redirect="true"/>
  </action>
and as forward success:

Code:
 <action
    path="/teacher/getWelcomeInformation"
    type="crimson.ccss.teacher.action.GetWelcomeInformationAction"
    scope="request"
    name="getWelcomeInformationForm"
    validate="false">
    <forward name="Success" path="/teacher/welcome.jsp"/>
  </action>
the bean correspondant to it is a dynaform:

Code:
   <form-bean 
       	name="getWelcomeInformationForm"
        dynamic="true"
        type="org.apache.struts.action.DynaActionForm">
    <form-property name="news" type="java.util.ArrayList"/>
    <form-property name="subjects" type="java.util.ArrayList"/>
    </form-bean>
I've managed to get the GetWelcomeInformationAction check the database and retrieve the data of "news" and "subjects" and set it to the dynaform:

inside GetWelcomeInformationAction.execute():

Code:
		  ((DynaActionForm)form).set( "news", news );
		  ((DynaActionForm)form).set( "subjects", subjects );
but now, how can I show it to the user in the jsp resulting from the forward on GetWelcomeInformationAction ??? ->> /teacher/welcome.jsp"

so far. I have this welcome.jsp

Code:
<%@ page contentType="text/html; charset=utf-8" %>

<%@ 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">

<head>

<title><bean:message key="common.label.title"/></title>
</head>
<html:base/>
<body>

	<bean:message key="teacher.welcome.welcome"/>
	<html:errors/>	
<%-- Iterate through the accounts and print them out inside the table --%>
<logic:iterate name="getWelcomeInformationForm" property="news">


</logic:iterate>

</body>
</html:html>
but I dunno how to really "iterate" .................. please any help?

Thanks a lot for even reading this large post

Poeta
 
Old 09-06-2005, 02:08 PM   #2
perry
Member
 
Registered: Sep 2003
Location: USA & Canada
Distribution: Slackware 12.0
Posts: 978

Rep: Reputation: 30
along the same lines...

here's a couple of vendors that offer intergrated debugging for struts and jsps, anybody know of other providers?

Eclipse add-ons for struts and jsps

Nitrox struts and jsps editors/debuggers

would love to know a cheaper alternative (free is good) anybody know of anything "free" along these lines

thanks much

- perry
 
Old 09-06-2005, 02:36 PM   #3
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 51
You should have read more about jsp/jstl/struts:

you can use bean:write or jstl, see for example :http://technology.amis.nl/blog/index.php?p=133
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Jakarta Tomcat 5.0.27 is running slow mehesque Linux - Software 0 07-27-2004 01:35 PM
Tomcat Jakarta and HTML redhatgeek Programming 14 07-13-2004 06:21 AM
Problem: SuSE 9.0, J2SDK 1.4.2_4, Jakarta Tomcat 5.0.19 jsokko Linux - Distributions 3 03-29-2004 01:35 PM
Tomcat jakarta server is shutting down after particular time period(critical) fmohideen76 Linux - General 1 07-11-2002 06:10 AM
Help plz. about tomcat jakarta in linux machine Harish_f Linux - General 1 06-19-2002 01:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration