RE: Quick Iterate Question - DefaultTableModel

2001-05-11 Thread Richard Murray

I've just tried using a DefaultTableModel and succeeded nesting the iterate
tag.  

JSP is as follows:

<%-- Generate table data by nesting the iterate tag --%>









The property 'model' is a DefaultTableModel in my ActionForm
'jobMonitorForm' with getter as follows

public DefaultTableModel getModel()
{
return model;
}

Richard.

-Original Message-
From: Assenza, Chris [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 5:56 PM
To: '[EMAIL PROTECTED]'
Subject: Quick Iterate Question - DefaultTableModel


Here's a quick one - anyone use or modify iterate to support iterations
through a DefaultTableModel. Since it's just a vector of vectors we tried
nesting iterate tags, but to no avail. Anyone already done this or do I need
to code it myself if I want it (hehe)? :)

Chris


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



RE: How do you use indexed properties with html:input?

2001-05-10 Thread Richard Murray

Turgay,

I've just tried that but get the following exception:

javax.servlet.jsp.JspException: Cannot find bean contributorEditForm in
scope session 

I've removed all useBean tags from my jsp and have added the following in my
action class:

ContributorEditForm contributorEditForm =
(ContributorEditForm)session.getAttribute( "contributorEditForm" );

if ( contributorEditForm == null )
{
contributorEditForm = new ContributorEditForm();
  session.setAttribute("contributorEditForm", contributorEditForm );
}

My JSP contains code like: 

Have I done something wrong?

As for debugging, I haven't really been able to so far, I've just been
putting System.out's in my Action class.  I'm about to install JBuilder
Enterprise (I normally use the Foundation version ) as this supports JSP
debugging, so I'll let you know if it's any good. 

Richard.

-Original Message-
From: Turgay Zengin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 2:05 PM
To: [EMAIL PROTECTED]
Subject: RE: How do you use indexed properties with html:input?


Richard,
I put my bean in session scope when I create it in an action class:

OracleConnBean dbconn=null;
dbconn = (OracleConnBean)session.getAttribute("dbconnection");
if(dbconn == null) {
dbconn = new OracleConnBean();
session.setAttribute("dbconnection", dbconn);
}

Then, I can access the object from my jsp pages without using jsp:useBean.

I am not exactly sure because I am not very much experienced with 
jsp/servlets, but this may be the reason for those 3 beans created. By the 
way, how did you find that out? How do you debug? (This may be a more 
general question as what is the best way to debug jsp/servlets? I don't 
debug yet, but I want to. I am using Forte CE. I heard about debugging in 
Tomcat using IBM VAJ, do I need to get that?)

When you don't use jsp:useBean, you better use the "type" attribute in your 
iterate tag, to get the correct object type:



HTH,
Turgay
---

From: Richard Murray
Subject: RE: How do you use indexed properties with html:input?
Date: Thu, 10 May 2001 02:44:02 -0700




Hi,

I made the following changes in my Action class and got my save to work.

HttpSession session = request.getSession();
TestGridForm testGridForm = (TestGridForm)session.getAttribute(
"testGridForm" );

However, while trying to debug my problem I found I get 3 ActionForm Beans
created when I only expected 1.

In my jsp I have the following:



I have added scope="session to the logic:iterate tag e.g.


On the page where I display the results I also have:


I expected all the above to refer to the session scoped bean "testGridForm",
so why are 3 beans created?

Richard.


_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



RE: How do you use indexed properties with html:input?

2001-05-10 Thread Richard Murray

Hi,

I made the following changes in my Action class and got my save to work.

HttpSession session = request.getSession();
TestGridForm testGridForm = (TestGridForm)session.getAttribute(
"testGridForm" );

However, while trying to debug my problem I found I get 3 ActionForm Beans
created when I only expected 1.

In my jsp I have the following:



I have added scope="session to the logic:iterate tag e.g. 


On the page where I display the results I also have:


I expected all the above to refer to the session scoped bean "testGridForm",
so why are 3 beans created?

Richard.

-Original Message-
From: Richard Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 10, 2001 9:45 AM
To: '[EMAIL PROTECTED]'
Subject: RE: How do you use indexed properties with html:input?


Turgay,

Thanks for your help, I've tried something similar to your example, but I'm
still having some trouble.  I've probably missed something obvious as I'm
new to struts & JSP.

In my jsp I've got the following:
<%@ page import="com.qspgroup.utc.TestGridForm" errorPage="fcerror.jsp" %>
<%@ taglib uri="/WEB-INF/utctags/fcutc.tld" prefix="fcutc" %>
<%@ taglib uri="/WEB-INF/lib/struts/struts-bean.tld" prefix="struts_bean" %>
<%@ taglib uri="/WEB-INF/lib/struts/struts-html.tld" prefix="struts_html" %>
<%@ taglib uri="/WEB-INF/lib/struts/struts-logic.tld" prefix="struts_logic"
%>




  <% int i=0; %>
  

" size="10"
value="">

<% i++; %>
  


My action class is as follows:

public ActionForward perform( ActionMapping mapping, ActionForm form,
HttpServletRequest request,
  HttpServletResponse response ) throws
IOException, ServletException
{
if ( form == null )
  {
form = new TestGridForm();
  }

  TestGridForm testGridForm = ( TestGridForm )form;
   
  for ( int i = 0; i < testGridForm.getData().length; i++ )
  {
if ( request.getParameter( "data" + i ) != null )
{
testGridForm.setData( i, request.getParameter( "data" + i )
);
}
  }
  return ( mapping.findForward( "success" ));
}

As you can see It doesn't do a lot.  My ActionForm class creates dummy data
and contains and contains get/set methods as shown below:

public class TestGridForm extends ActionForm
{
String[] data = { "Rail", "Fridges", "Hay", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "10", "11", "12", "13" };

public String[] getData()
{
return data;
}

public String getData( int i )
{
return data[i];
}

public void setData( String[] data )
{
this.data = data;
}

  public void setData( int i, String d )
  {
data[i] = d;
  }


My data gets displayed OK.  On success I go to testgrid.jsp but this keeps
displaying the original data.  I've checked the tomcat log files and the new
data is being sent as request parameter so I don't understand why the new
data isn't saved in my bean.
e.g. 2001-05-10 09:21:20 -Request Params: 
2001-05-10 09:21:20 -data2 = 30
2001-05-10 09:21:20 -data1 = 20

TestGrid.jsp is as follows:

<%@ page import="com.qspgroup.utc.DataCaptureDemo" errorPage="fcerror.jsp"
%>





Test JSP



Test JSP Page

<%  
out.println( "data in 1st cell is "+ testGridForm.getData( 0 )
);
out.println( "data in 2st cell is "+ testGridForm.getData( 1 )
);
out.println( "data in 3rd cell is "+ testGridForm.getData( 2 )
);
%>




Sorry to swamp you with info, I can't seem to figure this out, although I'm
sure I've missed something obvious here.
Thanks.

Richard.

-Original Message-
From: Turgay Zengin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 09, 2001 1:13 PM
To: [EMAIL PROTECTED]
Subject: Re: How do you use indexed properties with html:input?


Hi,
I *guess* that the html: tags require a form bean (please correct me if 
this is wrong) so they won't work with dynamically created page elements 
like input text fields.

I did the following and it works, got the idea from Scott Walter (thanks) - 
see http://www.mail-archive.com/struts-user@jakarta.apache.org/msg06972.html

There may be a better solution to this, if there is, I would like to know.
Background: "dbconnection" is a bean I use to keep the session's database 

RE: How do you use indexed properties with html:input?

2001-05-10 Thread Richard Murray

Turgay,

Thanks for your help, I've tried something similar to your example, but I'm
still having some trouble.  I've probably missed something obvious as I'm
new to struts & JSP.

In my jsp I've got the following:
<%@ page import="com.qspgroup.utc.TestGridForm" errorPage="fcerror.jsp" %>
<%@ taglib uri="/WEB-INF/utctags/fcutc.tld" prefix="fcutc" %>
<%@ taglib uri="/WEB-INF/lib/struts/struts-bean.tld" prefix="struts_bean" %>
<%@ taglib uri="/WEB-INF/lib/struts/struts-html.tld" prefix="struts_html" %>
<%@ taglib uri="/WEB-INF/lib/struts/struts-logic.tld" prefix="struts_logic"
%>




  <% int i=0; %>
  

" size="10"
value="">

<% i++; %>
  


My action class is as follows:

public ActionForward perform( ActionMapping mapping, ActionForm form,
HttpServletRequest request,
  HttpServletResponse response ) throws
IOException, ServletException
{
if ( form == null )
  {
form = new TestGridForm();
  }

  TestGridForm testGridForm = ( TestGridForm )form;
   
  for ( int i = 0; i < testGridForm.getData().length; i++ )
  {
if ( request.getParameter( "data" + i ) != null )
{
testGridForm.setData( i, request.getParameter( "data" + i )
);
}
  }
  return ( mapping.findForward( "success" ));
}

As you can see It doesn't do a lot.  My ActionForm class creates dummy data
and contains and contains get/set methods as shown below:

public class TestGridForm extends ActionForm
{
String[] data = { "Rail", "Fridges", "Hay", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "10", "11", "12", "13" };

public String[] getData()
{
return data;
}

public String getData( int i )
{
return data[i];
}

public void setData( String[] data )
{
this.data = data;
}

  public void setData( int i, String d )
  {
data[i] = d;
  }


My data gets displayed OK.  On success I go to testgrid.jsp but this keeps
displaying the original data.  I've checked the tomcat log files and the new
data is being sent as request parameter so I don't understand why the new
data isn't saved in my bean.
e.g. 2001-05-10 09:21:20 -Request Params: 
2001-05-10 09:21:20 -data2 = 30
2001-05-10 09:21:20 -data1 = 20

TestGrid.jsp is as follows:

<%@ page import="com.qspgroup.utc.DataCaptureDemo" errorPage="fcerror.jsp"
%>





Test JSP



Test JSP Page

<%  
out.println( "data in 1st cell is "+ testGridForm.getData( 0 )
);
out.println( "data in 2st cell is "+ testGridForm.getData( 1 )
);
out.println( "data in 3rd cell is "+ testGridForm.getData( 2 )
);
%>




Sorry to swamp you with info, I can't seem to figure this out, although I'm
sure I've missed something obvious here.
Thanks.

Richard.

-Original Message-
From: Turgay Zengin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 09, 2001 1:13 PM
To: [EMAIL PROTECTED]
Subject: Re: How do you use indexed properties with html:input?


Hi,
I *guess* that the html: tags require a form bean (please correct me if 
this is wrong) so they won't work with dynamically created page elements 
like input text fields.

I did the following and it works, got the idea from Scott Walter (thanks) - 
see http://www.mail-archive.com/struts-user@jakarta.apache.org/msg06972.html

There may be a better solution to this, if there is, I would like to know.
Background: "dbconnection" is a bean I use to keep the session's database 
connection, and other objects. wpLaborEntries is a vector holding objects of

type WpLabor.

In my jsp page I create input text fields like this:


<% int i=0; %>




  " size="5"
  value="">
  " size="5"
  value="">
  " size="5"
      value="">
  " size="5"
  value="">

<% i++; %>




So, the key point is, giving a "consistent" name for each input text field.

And, in my action class, I get the values like this:
public ActionForward perform(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpSe

How do you use indexed properties with html:input?

2001-05-08 Thread Richard Murray

Hi, 

I've got the following property:
 
String[] data.

I want to iterate the array and display each String in a text input field in
a table. I can get the data to display using iterate and a bean:write tag as
follows:





I can't get it working with a text input field ( html:text ).  I've tried
the following and get javax.servlet.jsp.JspException: No getter method for
property element of bean org.apache.struts.taglib.html.BEAN 

I want to use property="data", but how can I can specify which element of
the array to output and save on an update? 





Hope someone can help.

Richard.




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



RE: nesting logic:equals tags

2001-05-04 Thread Richard Murray

Hi, 

I've used a scriptlet as follows to achieve what I want, but I'd rather user
the struts tags if possible

 
<%  
if ( element.equals( "true" ) ) 
{
out.println( "" ); 
}
else if (  element.equals( "false" ) )
{
out.println( "" );
}
else
{
out.println( "" + element + "" );

}
%>


If anyone knows how to do this using the struts logic tags then let me know.

Richard.

-Original Message-
From: Richard Murray [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 04, 2001 10:30 AM
To: [EMAIL PROTECTED]
Subject: nesting logic:equals tags


Hi, 

I'm iterating over an array of Strings containing the following dummy data {
"1", "2", "3", "4", "true", "6", "7"}.  I want to apply the following logic:
if the String is "true" or "false" display a checkbox, else display the
String.

I attempted to nest the tags as follows, but this does not work:








I can only get this working as shown below:  

 













   

   


However, this does not work properly as I have nested the notEquals logic
tags.  

Is there a way to nest these tags or supply conditional operators ( e.g. &&,
|| ).  Is there anyway to supply an else statement.  I'm not sure I can
achieve what I want with these tags and may be better of with a scriptlet.

Hope someone can help.
Richard.




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



RE: URL for struts archive?

2001-05-04 Thread Richard Murray

The struts user archive is at:

http://www.mail-archive.com/struts-user%40jakarta.apache.org/

Richard.

-Original Message-
From: Dudley Butt@i-Commerce [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 04, 2001 10:32 AM
To: [EMAIL PROTECTED]
Subject: URL for struts archive?


Can someone please give me the URL to go search thru all the struts
archives?
thanx


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



nesting logic:equals tags

2001-05-04 Thread Richard Murray

Hi, 

I'm iterating over an array of Strings containing the following dummy data {
"1", "2", "3", "4", "true", "6", "7"}.  I want to apply the following logic:
if the String is "true" or "false" display a checkbox, else display the
String.

I attempted to nest the tags as follows, but this does not work:








I can only get this working as shown below:  

 













   

   


However, this does not work properly as I have nested the notEquals logic
tags.  

Is there a way to nest these tags or supply conditional operators ( e.g. &&,
|| ).  Is there anyway to supply an else statement.  I'm not sure I can
achieve what I want with these tags and may be better of with a scriptlet.

Hope someone can help.
Richard.




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



RE: nested logic:iterate tags

2001-05-04 Thread Richard Murray

I'm just using the following dummy data in my bean:

private String[] headings = {"User", "Job Group", "Job", "Spreadsheet",
"DataUpdated", "Status", "Submitted" };
private String[][] data = { { "1", "2", "3", "4", "true", "6", "7"},
{"8", "9", "10", "11", "false", "13",
"14"} };

I've got get and set methods for both properties and generate a table with
the following:

 
<%-- Generate table headings --%>






<%-- Generate table data by nesting iterate tag --%>




   





Richard.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 4:52 PM
To: [EMAIL PROTECTED]
Subject: RE: nested logic:iterate tags


Richard,

What does the array look like? Can you post the logic for that array?

On Thu, 03 May 2001, Richard Murray wrote:

> 
> Hi, 
> 
> For anyone interested I managed fix my problem with the following:
> 
>  scope="page">
> 
> 
> 
> 
> 
> 
> 
> 
> Regards
> 
> Richard
> 
> -Original Message-
> From: Richard Murray [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 03, 2001 2:44 PM
> To: '[EMAIL PROTECTED]'
> Subject: nested logic:iterate tags
> 
> 
> Hi, 
> 
> I'm trying to generate a table of data from a 2 dimensional array of
Strings
> called ( String[][] data ).  I am trying to use the struts tag
>  to loop through the data and generate the table.  As it is
a
> 2 dimensional array I have nested the iterate statements as follows:
> 
>  scope="page">
> 
> 
> 
> 
> 
> 
> I get the following exception trying to run this:
> 
> org.apache.jasper.compiler.CompileException:
> F:\projects\fcutc\deploy\fcutc\list.jsp(40,1) Unable to convert a String
to
> java.lang.Object for attribute collection 
> 
> I'm trying to use the id ("rows") from the first iterate statement as a
> variable in the second, however it seems it looks as though it is being
> treated as a string rather than a variable.  I thought the id held the
> current object in the iteration, which in my case is an array.
> 
> Hope someone can help.  I'm pretty new to struts ( and JSP ) so I may have
> done something obviously wrong.
> 
> Thanks.
>  
> Richard Murray 
> Software Engineer - Net Products Development 
> QSP
> OLAS House, Team Valley Trading Estate,
> 5th Avenue Business Park,
> Gateshead, Tyne & Wear NE11 0XA  
> Switchboard+44 (0) 191 402  
> Direct line   +44 (0) 191 402 3329 
> email  [EMAIL PROTECTED] 
> website   www.qspgroup.com 
> QSP - Enabling e-Finance 
> 
> 
> 
> 
> **
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager at [EMAIL PROTECTED]
> 
> This footnote also confirms that this email message has been swept by
> for the presence of computer viruses.
> 
> http://www.qspgroup.com
> **

Thomas Peters

Senior Software Engineer
Aidera Solutions

Cell: 603-566-5406
Voice Mail: 603-888-7700



RE: nested logic:iterate tags

2001-05-03 Thread Richard Murray

Hi, 

For anyone interested I managed fix my problem with the following:










Regards

Richard

-Original Message-
From: Richard Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 2:44 PM
To: '[EMAIL PROTECTED]'
Subject: nested logic:iterate tags


Hi, 

I'm trying to generate a table of data from a 2 dimensional array of Strings
called ( String[][] data ).  I am trying to use the struts tag
 to loop through the data and generate the table.  As it is a
2 dimensional array I have nested the iterate statements as follows:








I get the following exception trying to run this:

org.apache.jasper.compiler.CompileException:
F:\projects\fcutc\deploy\fcutc\list.jsp(40,1) Unable to convert a String to
java.lang.Object for attribute collection 

I'm trying to use the id ("rows") from the first iterate statement as a
variable in the second, however it seems it looks as though it is being
treated as a string rather than a variable.  I thought the id held the
current object in the iteration, which in my case is an array.

Hope someone can help.  I'm pretty new to struts ( and JSP ) so I may have
done something obviously wrong.

Thanks.
 
Richard Murray 
Software Engineer - Net Products Development 
QSP
OLAS House, Team Valley Trading Estate,
5th Avenue Business Park,
Gateshead, Tyne & Wear NE11 0XA  
Switchboard+44 (0) 191 402  
Direct line   +44 (0) 191 402 3329 
email  [EMAIL PROTECTED] 
website   www.qspgroup.com 
QSP - Enabling e-Finance 




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**



nested logic:iterate tags

2001-05-03 Thread Richard Murray

Hi, 

I'm trying to generate a table of data from a 2 dimensional array of Strings
called ( String[][] data ).  I am trying to use the struts tag
 to loop through the data and generate the table.  As it is a
2 dimensional array I have nested the iterate statements as follows:








I get the following exception trying to run this:

org.apache.jasper.compiler.CompileException:
F:\projects\fcutc\deploy\fcutc\list.jsp(40,1) Unable to convert a String to
java.lang.Object for attribute collection 

I'm trying to use the id ("rows") from the first iterate statement as a
variable in the second, however it seems it looks as though it is being
treated as a string rather than a variable.  I thought the id held the
current object in the iteration, which in my case is an array.

Hope someone can help.  I'm pretty new to struts ( and JSP ) so I may have
done something obviously wrong.

Thanks.
 
Richard Murray 
Software Engineer - Net Products Development 
QSP
OLAS House, Team Valley Trading Estate,
5th Avenue Business Park,
Gateshead, Tyne & Wear NE11 0XA  
Switchboard+44 (0) 191 402  
Direct line   +44 (0) 191 402 3329 
email  [EMAIL PROTECTED] 
website   www.qspgroup.com 
QSP - Enabling e-Finance 




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager at [EMAIL PROTECTED]

This footnote also confirms that this email message has been swept by
for the presence of computer viruses.

http://www.qspgroup.com
**