Re: Dynamic Value for logic equal

2002-11-09 Thread Vikram Goyal
Thanks David/Edgar,

I have actually done it in a scriptlet, but it is departing from the idea of
keeping JSP's scriptlet free. I am surprised that there is no generic way of
handling this in Struts. I always assumed that it would be till I actually
had to do it !!

The EL approach seems better but how was this tackled before Struts-EL came
into picture? I am guessing the scriptlet way?

Regards,
Vikram

- Original Message -
From: "David M. Karr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 10, 2002 10:23 AM
Subject: Re: Dynamic Value for logic equal


> > "Vikram" == Vikram Goyal <[EMAIL PROTECTED]> writes:
>
> Vikram> When displaying information about a User, I need to display
the Label for a
> Vikram> Country Code. This should be simple enough. However, the User
bean contains
> Vikram> only the country code. To get the Country label, I need to
iterate over the
> Vikram> Country Data static collection, which stores information about
each country
> Vikram> as a LabelValueBean. This collection is stored in session
scope.
>
> Vikram> However, the problem is that while inside the logic:iterate
tag, the
> Vikram> logic:equal tag does not accept dynamic value for the 'value'
attribute. The
> Vikram> processing should be like this:
>
> Vikram>  Vikram> type="org.apache.struts.util.LabelValueBean">
> Vikram>  Vikram> value="USER.GETCOUNTRYCODE">
> Vikram> 
> Vikram> 
> Vikram> 
>
> Vikram> The USER.GETCOUNTRYCODE is the problem part. I have tried
value=' Vikram> name="user" property="country"/>'. This does not work, as it
seems that it
> Vikram> is parsed as is by the compiler. I also tried using
bean:define for the
> Vikram> country code and then passing that in but that fails as well.
>
> Vikram> I ended up writing a scriptlet around it to solve the problem,
but am not
> Vikram> convinced that it is the best way to go about it.
>
> Your alternatives are to use a scriptlet or to use the Struts-EL library
in the
> nightly build (as described in another response to this).  With Struts-EL,
a
> direct translation of your code would look something like the following
(with
> some renaming):
>
>  
>   
>
>   
>  
>
> --
> ===
> David M. Karr  ; Java/J2EE/XML/Unix/C++
> [EMAIL PROTECTED]   ; SCJP
>
>
>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:

>
>
>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Where should we change dispatch

2002-11-09 Thread Mr Alireza Fattahi
hi, 

we have a form that has more than one action. The
actions of the form 
could are changed depending on previous action.
Actually there is a state diagram
between actions. For example if A,B,C are actions
then:
A--> B --> C

Now where we can change the action ( dispatch
parameter)? 
There are two solutions:

1) change dispath in action form

  DynaActionForm dynaForm = (DynaActionForm) form; 
  dynaForm.set("dispatch","A");

2) put logic.equlas tags in jsp and change the dispath
hidden form 

 
   
 

Which one is better

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




[Struts Tip] #13 Use Display* helpers to convert or transform properties

2002-11-09 Thread Ted Husted
There are many properties in an application that need to rendered 
in a particular way. The database may store a telephone number as 
a simple String of numerals, but your business requirements might 
say that telephone numbers must formatted with spaces or hyphens 
to make them easier to read.

[more ... ]



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Dynamic Value for logic equal

2002-11-09 Thread David M. Karr
> "David" == David M Karr <[EMAIL PROTECTED]> writes:

> "Vikram" == Vikram Goyal <[EMAIL PROTECTED]> writes:

David> Your alternatives are to use a scriptlet or to use the Struts-EL library in 
the
David> nightly build (as described in another response to this).  With Struts-EL, a
David> direct translation of your code would look something like the following 
(with
David> some renaming):

David>  
David>   
David>
David>   
David>  

Slight correction:

  
   

   
  

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Dynamic Value for logic equal

2002-11-09 Thread David M. Karr
> "Vikram" == Vikram Goyal <[EMAIL PROTECTED]> writes:

Vikram> When displaying information about a User, I need to display the Label for a
Vikram> Country Code. This should be simple enough. However, the User bean contains
Vikram> only the country code. To get the Country label, I need to iterate over the
Vikram> Country Data static collection, which stores information about each country
Vikram> as a LabelValueBean. This collection is stored in session scope.

Vikram> However, the problem is that while inside the logic:iterate tag, the
Vikram> logic:equal tag does not accept dynamic value for the 'value' attribute. 
The
Vikram> processing should be like this:

Vikram>  type="org.apache.struts.util.LabelValueBean">
Vikram>  value="USER.GETCOUNTRYCODE">
Vikram> 
Vikram> 
Vikram> 

Vikram> The USER.GETCOUNTRYCODE is the problem part. I have tried 
value=' name="user" property="country"/>'. This does not work, as it seems that it
Vikram> is parsed as is by the compiler. I also tried using bean:define for the
Vikram> country code and then passing that in but that fails as well.

Vikram> I ended up writing a scriptlet around it to solve the problem, but am not
Vikram> convinced that it is the best way to go about it.

Your alternatives are to use a scriptlet or to use the Struts-EL library in the
nightly build (as described in another response to this).  With Struts-EL, a
direct translation of your code would look something like the following (with
some renaming):

 
  
   
  
 

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Problem with multiple html(jsp) pages sharing one form (actionform)

2002-11-09 Thread Derek Lin
Didn't get this to work the way I want.  The problem is that I don't know
how to set the page property of the DynaValidatorForm without using my own
Action.

The best thing I can think of so far is to use my own ActionMapping to set
the page.  And in my Action class, I set the page property of my
DynaValidatorForm from my ActionMapping property.

This sort of work, but I don't like it:

1) in my validation.xml:

  
   
...
2) in my struts-config.xml:

  
  


3) I have a custom ActionMapping which sets the page property

4) In my Action class:
 public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) throws Exception {
MyActionMapping fcMapping = (MyActionMapping)mapping;
DynaValidatorForm myForm = (DynaValidatorForm)form;
myForm.setPage(fcMapping.getPage());
...

Problems I've noticed:

1) Too much work
2) Javascript validation doesn't work on second page (works only on first
page)

I don't know struts inside and out.  I wish those of you who do can provide
an example application (just an multi-page form)  for this.

Anyway, just wanted to share what I have found out.

-- Derek
- Original Message -
From: "Derek Lin" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, November 08, 2002 6:48 PM
Subject: Re: Problem with multiple html(jsp) pages sharing one form
(actionform)


> I was reading Struts in Action chapter 12:
> "If you are using the one-big-form wizard approach, the Struts Validator
> includes a page property on the field element and provides a corresponding
> page property on the ValidatorForm."
>
> But the book doesn't give any example.
>
> Dese it mean I should do something like this?:
> 
>
> And then pass a url param in my action?
>
> If anyone knows, please give some pointers.  I am going to try this out
> soon.
>
> Thanks,
>
> Derek
>
> - Original Message -
> From: "Brian Topping" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, November 08, 2002 12:17 PM
> Subject: RE: Problem with multiple html(jsp) pages sharing one form
> (actionform)
>
>
> Hi all,
>
> I'm running into this problem too.  My DynaActionForm is getting cleared
> between calls to my action.
>
> I'm using DispatchAction as my base class, so I have actions like
> 'FooAction?method=setupForm', 'FooAction?method=page1',
> 'FooAction?method=page2', etc.
>
> Is resetting the form a "feature" in this case as well, even though the
> class
> is the same?  Or do I literally have to use the same method in order to
> avoid
> a reset?  The latter seems to kill the very nice code layout I get from
> using
> DispatchActions for different form pages, although I could go in and
> re-implement the code such that the same method becomes a dispatcher, yada
> yada.
>
> I'm trying out this stuff as I write, but I guess I am sending this anyway
> because I believe this is a misfeature/bug if it actually works this way.
> IMHO, vectors in a DispatchAction should be a special semantic case WRT
> forms
> getting reset.
>
> Thanks for your consideration of this,
>
> -b
>
> > -Original Message-
> > From: James Mitchell [mailto:jmitchtx@;telocity.com]
> > Sent: Monday, October 28, 2002 1:21 AM
> > To: Struts Users Mailing List
> > Subject: RE: Problem with multiple html(jsp) pages sharing one form
> > (actionform)
> >
> >
> > Ok, sorry, I didn't see that, although I tend to use the same
> > action (and
> > jsp) for my wizards anyway.
> >
> > So you are saying that you are not sure where the data is lost?
> >
> > One way I might test this:
> >
> > (Assuming you have)
> > Step 1: jsp1 -> fowardaction1 -> jsp2
> > Step 2: jsp2 -> fowardaction2 -> jsp3
> > Step 3: jsp3 -> ejbaction -> jsp
> >
> >
> > Do this.
> > Step 1: jsp1 -> fowardaction1 -> jsp2
> > Step 2: jsp2 -> fowardaction2 -> jsp3
> > now hit your browser's back button one time
> > now hit your browser's refresh button
> >
> > you will be prompted to re-submit the form data, click ok (or
> > yes, depending
> > on your browser)
> >
> > At this point you are sitting at the end of Step 1 (or the
> > beginning of Step
> > 2, same thing).
> > Now if the data had been stored in the session correctly in
> > Step 1, then
> > your form should be sitting there already filled out for you.
> >
> > Try that.
> >
> > James Mitchell
> > Software Engineer/Struts Evangelist
> > http://www.open-tools.org
> >
> > "Only two things are infinite, the universe and human
> > stupidity, and I'm not
> > sure about the former."
> > - Albert Einstein (1879-1955)
> >
> >
> > > -Original Message-
> > > From: Derek Lin [mailto:dereklin@;hotmail.com]
> > > Sent: Monday, October 28, 2002 1:11 AM
> > > To: Struts Users Mailing List
> > > Subject: Re: Problem with multiple html(jsp) pages sharing one form
> > > (actionform)
> > >
> > >
>

Struts and ordinary JavaBean persistency

2002-11-09 Thread Juan
Hello,

Is there a simple sample?


Thanks in advance,


Juan José Velázquez Garcia
Information System Developer
www.htmlspider.com.br



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Java WebStart as a Strut front end

2002-11-09 Thread Toni Charlot
I thank you for the correction.  You're absolutely correct.  No I can ask my
questions in a more clever way and perform searches as Eddie suggested.

I looked at the link provided, it wasn't very clear but I can see that it's
doable.

Some one ask why the need to go through the web-app and not interface with
the database and server directly?
answer:  I would like to keep the validation, database access, and other
business logic excecution in one place.  the Swing app will be a module
because of the need to access local i/o devices such as the printer, camera,
signature pad, and the like.

May be I could do that through JMS.

Thank you guys and gals.


- Original Message -
From: <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, November 08, 2002 2:24 PM
Subject: Re: Java WebStart as a Strut front end


>
> To be picky:  Java WebStart isnt a view.. its just a Swing App Web
> Deployment tool.
> Swing would be your view and I believe Swing as the "V" in MVC has been
> discussed in the
> mailing list.
>
> mark
>
>
>
>
> "Toni Charlot" <[EMAIL PROTECTED]> on 11/08/2002 01:07:00 PM
>
> Please respond to "Struts Users Mailing List"
><[EMAIL PROTECTED]>
>
> To:"Struts Users Mailing List" <[EMAIL PROTECTED]>
> cc:
>
> Subject:Java WebStart as a Strut front end
>
>
> I'm writing an application where I need to access local resources like a
> camera and scanner devices.  I was looking into using a Java WebStart to
> write the program and interact with the struts controller on the server.
> Has anyone used Java WebStart as a view for struts?  Is that an entirely
> crazy concept?  Are there any alternatives out there?
>
> Thank you for all your input.
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:

>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




java.sql.Date formatting problem

2002-11-09 Thread kiuma
Hi all
I've the following problem:
if I try to use

nothing is displayed.

validityEnd is of type java.sql.Date (and not null) what shoud I do to 
format it ?
thx,
kiuma


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 



Re: Making peace between Struts logic iterate and Ed Hill's display tag...

2002-11-09 Thread Antoni Reus
I don't understant why you can't use logic:iterate tag. 

Anyway, why don't you use a "for" instead of all those "if", something like 
this ?


<%!
// Convert a int to a 2 digit String
private String int2DString(int i) {
   String number = new Integer(i).toString();
   if ( i < 10) {
  number = "0" + number;
   }
}

private String propName(int i) {
   i++; // i was zero-based
   return "stuff" + int2DString(++i);
}

private String propTitle(int i) {
   i++; // i was zero-based
   return "Stuff " + int2DString(++i);
}
%>

<%
FooBarBean FooBarBean =
  (FooBarBean)request.getAttribute(FooBarBean.LOOKUP_KEY);
%>



   
  
   Beautiful Looking Spreadsheet in the Broswer
  Brought to you by Hideously Ugly Looking Code
  
   

   

   

   <% for (int i = 0; i < 30 ; i++) { %>

  <% if (FooBarBean.isExistingColumn(i)) { %>

  

  <% } // end If %>

<% } // End For %>






A Dissabte 09 Novembre 2002 15:59, David McLure va escriure:
> Last month a fellow by the name of Rick Ruemann [[EMAIL PROTECTED]]
> posted a reply to an email inquiry of mine, turning me on to Ed Hill's
> marvelous display tag library (Hi Rick!).  It turns out that Ed's web
> site URL is actually http://edhill.its.uiowa.edu/display-0.8/  (implying
> that Ed might have even a newer version of the tag library now, but I
> digress...)  :
>
> From: Rick Reumann [[EMAIL PROTECTED]]
>
> >Sent: Thursday, October 10, 2002 8:02 PM
> >To: Struts Users Mailing List
> >Subject: Re: Ideas for doing a spreadsheet-styled tables using Struts
>
> tags
>
> >On Thursday, October 10, 2002, 7:55:21 PM, David wrote:
> >
> >DM> I am currently looking for ideas on ways to display potentially
> >DM> large amounts of data in a spreadsheet format using Struts.
> >
> >Check out using this display tag:
> >http://edhill.its.uiowa.edu/display/
> >
> >I couldn't live without it:) (Even will provide a link that you
> >can click on to export the display to Excel).
> >
> >Excellent tag.
> >
> >--
> >
> >Rick
> >mailto:maillist@;reumann.net
>
> Since then, with Rick's help (and Rick deserves a lot of credit for
> figuring out how to use this display tag library by the way), I have
> managed to implement the display tag in my Struts based application and
> it seems to work just fine.  The problem?  My code is ugly as sin!  It's
> so bad, that after glancing over my shoulder the other day, one of my
> best friends at work (Hi Russ!) has already warned me that it will
> undoubtedly fail the upcoming code review.  He's got a point too - it is
> Coyote Ugly Code!
>
> The reason is that neither Rick nor I have figured out a way to make Ed
> Hill's display tag live peacefully with Struts logic iterate tags.  As a
> result, I have JSP code which looks something like the following :
>
> <%
> FooBarBean FooBarBean =
> (FooBarBean)request.getAttribute(FooBarBean.LOOKUP_KEY);
> %>
>  cellpadding="0" border="0" width="569" styleClass="DataTableBorder"
> scope="request">
> 
>    Beautiful Looking
> Spreadsheet in the Broswer Brought to you by Hideously Ugly Looking
> Code
>
>  styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="FooBar Code" />
> <% if (FooBarBean.isExistingColumn(0)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 01" />
> <% } if (FooBarBean.isExistingColumn(1)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 02" />
> <% } if (FooBarBean.isExistingColumn(2)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 03" />
>...etc., etc...
> <% } if (FooBarBean.isExistingColumn(29)) { %>
> styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="Stuff 30" />
> <% } %>
>  styleClass="FooBarStyle" headerStyleClass="FooBarDataHeader"
> title="FooBar Total" />
> 
>
> ... and Java code to support this which is simply to hideous looking to
> post in front of a family audience... (Russ happened to catch me
> desparately trying to prettify the most hideous looking class of the
> bunch!  There are some things which simply no combination of comments
> can help :-).
>
> So please, just shoot me already!  Either that, or help me with this
> agonizing problem which is causing me to lose sleep (normally I sleep
> late on Saturday mornings if I stay up late the night before).  Of
> course, it doesn't help that in this case, I have variable columns which
> may or may not appear (causing the need for the additional "if
> (FooBarBean.isExistingColumn(x))" scriptlet code.  Even without that
> problem though, it seems that I would still end up having to in line my
> display columns with silly looking class properties like stuff00,
> stuff01, stuff02, etc., all the way to stuff29 for each of my 30
> possible data columns when I would normally write a much sexier loop
> through an array (or even sexier - a collection) - all because Struts
> logic:iterate tags 

RE: Making peace between Struts logic iterate and Ed Hill's display tag...

2002-11-09 Thread edgar
Wouldn't this work.  Still ugly but if you use XML syntax might be
passable.

<%
FooBarBean fooBarBean =
(FooBarBean)request.getAttribute(FooBarBean.LOOKUP_KEY);
%>


   Beautiful Looking
Spreadsheet in the Broswer Brought to you by Hideously Ugly Looking
Code
   

<%
for (int j = 0 ; j < 30 ; j++ ) {
if (FooBarBean.isExistingColumn(j)) { 
String fillJ = (j < 10 ? "0" + j : j);
%>

<%
}
}
%>




-Original Message-
From: David McLure [mailto:david@;mclures.net] 
Sent: Saturday, November 09, 2002 9:59 AM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]';
'[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject: Making peace between Struts logic iterate and Ed Hill's display
tag...


Last month a fellow by the name of Rick Ruemann [[EMAIL PROTECTED]]
posted a reply to an email inquiry of mine, turning me on to Ed Hill's
marvelous display tag library (Hi Rick!).  It turns out that Ed's web
site URL is actually http://edhill.its.uiowa.edu/display-0.8/  (implying
that Ed might have even a newer version of the tag library now, but I
digress...)  :

>From: Rick Reumann [[EMAIL PROTECTED]]
>Sent: Thursday, October 10, 2002 8:02 PM
>To: Struts Users Mailing List
>Subject: Re: Ideas for doing a spreadsheet-styled tables using Struts
tags
>
>On Thursday, October 10, 2002, 7:55:21 PM, David wrote:
>
>DM> I am currently looking for ideas on ways to display potentially 
>DM> large amounts of data in a spreadsheet format using Struts.
>
>Check out using this display tag:
>http://edhill.its.uiowa.edu/display/
>
>I couldn't live without it:) (Even will provide a link that you
>can click on to export the display to Excel).
>
>Excellent tag.
>
>--
>
>Rick
>mailto:maillist@;reumann.net

Since then, with Rick's help (and Rick deserves a lot of credit for
figuring out how to use this display tag library by the way), I have
managed to implement the display tag in my Struts based application and
it seems to work just fine.  The problem?  My code is ugly as sin!  It's
so bad, that after glancing over my shoulder the other day, one of my
best friends at work (Hi Russ!) has already warned me that it will
undoubtedly fail the upcoming code review.  He's got a point too - it is
Coyote Ugly Code!

The reason is that neither Rick nor I have figured out a way to make Ed
Hill's display tag live peacefully with Struts logic iterate tags.  As a
result, I have JSP code which looks something like the following :

<%
FooBarBean FooBarBean =
(FooBarBean)request.getAttribute(FooBarBean.LOOKUP_KEY);
%>


   Beautiful Looking
Spreadsheet in the Broswer Brought to you by Hideously Ugly Looking
Code
   

<% if (FooBarBean.isExistingColumn(0)) { %>
   
<% } if (FooBarBean.isExistingColumn(1)) { %>
   
<% } if (FooBarBean.isExistingColumn(2)) { %>
   
   ...etc., etc...
<% } if (FooBarBean.isExistingColumn(29)) { %>
   
<% } %>



... and Java code to support this which is simply to hideous looking to
post in front of a family audience... (Russ happened to catch me
desparately trying to prettify the most hideous looking class of the
bunch!  There are some things which simply no combination of comments
can help :-).

So please, just shoot me already!  Either that, or help me with this
agonizing problem which is causing me to lose sleep (normally I sleep
late on Saturday mornings if I stay up late the night before).  Of
course, it doesn't help that in this case, I have variable columns which
may or may not appear (causing the need for the additional "if
(FooBarBean.isExistingColumn(x))" scriptlet code.  Even without that
problem though, it seems that I would still end up having to in line my
display columns with silly looking class properties like stuff00,
stuff01, stuff02, etc., all the way to stuff29 for each of my 30
possible data columns when I would normally write a much sexier loop
through an array (or even sexier - a collection) - all because Struts
logic:iterate tags don't seem to want to play with the display:column
tags!

We have tried asking Ed Hill about this problem, but Ed has been pretty
busy lately (either that, or it is entirely possible that our emails to
him at his email address posted on his web site are being lost in
mountains of junk mail - which is the problem I am faced with on one of
my more well known web site email accounts - making useful
correspondence with me almost impossible to that email address).  Ed,
are you still with us?

Anyway, as my code review approaches, I thought I'd try one last time to
spare this otherwise extremely powerful display tag library from the
hungry jaws of the code reviewers at work.  Of course, I could just rip
out the display tag altogether and be done with it, but by doing so, I
would also sacrifice the us

Making peace between Struts logic iterate and Ed Hill's display tag...

2002-11-09 Thread David McLure
Last month a fellow by the name of Rick Ruemann [[EMAIL PROTECTED]]
posted a reply to an email inquiry of mine, turning me on to Ed Hill's
marvelous display tag library (Hi Rick!).  It turns out that Ed's web
site URL is actually http://edhill.its.uiowa.edu/display-0.8/  (implying
that Ed might have even a newer version of the tag library now, but I
digress...)  :

>From: Rick Reumann [[EMAIL PROTECTED]]
>Sent: Thursday, October 10, 2002 8:02 PM
>To: Struts Users Mailing List
>Subject: Re: Ideas for doing a spreadsheet-styled tables using Struts
tags
>
>On Thursday, October 10, 2002, 7:55:21 PM, David wrote:
>
>DM> I am currently looking for ideas on ways to display potentially
>DM> large amounts of data in a spreadsheet format using Struts.
>
>Check out using this display tag:
>http://edhill.its.uiowa.edu/display/
>
>I couldn't live without it:) (Even will provide a link that you
>can click on to export the display to Excel).
>
>Excellent tag.
>
>--
>
>Rick
>mailto:maillist@;reumann.net

Since then, with Rick's help (and Rick deserves a lot of credit for
figuring out how to use this display tag library by the way), I have
managed to implement the display tag in my Struts based application and
it seems to work just fine.  The problem?  My code is ugly as sin!  It's
so bad, that after glancing over my shoulder the other day, one of my
best friends at work (Hi Russ!) has already warned me that it will
undoubtedly fail the upcoming code review.  He's got a point too - it is
Coyote Ugly Code!

The reason is that neither Rick nor I have figured out a way to make Ed
Hill's display tag live peacefully with Struts logic iterate tags.  As a
result, I have JSP code which looks something like the following :

<%
FooBarBean FooBarBean =
(FooBarBean)request.getAttribute(FooBarBean.LOOKUP_KEY);
%>


   Beautiful Looking
Spreadsheet in the Broswer Brought to you by Hideously Ugly Looking
Code
   

<% if (FooBarBean.isExistingColumn(0)) { %>
   
<% } if (FooBarBean.isExistingColumn(1)) { %>
   
<% } if (FooBarBean.isExistingColumn(2)) { %>
   
   ...etc., etc...
<% } if (FooBarBean.isExistingColumn(29)) { %>
   
<% } %>



... and Java code to support this which is simply to hideous looking to
post in front of a family audience... (Russ happened to catch me
desparately trying to prettify the most hideous looking class of the
bunch!  There are some things which simply no combination of comments
can help :-).

So please, just shoot me already!  Either that, or help me with this
agonizing problem which is causing me to lose sleep (normally I sleep
late on Saturday mornings if I stay up late the night before).  Of
course, it doesn't help that in this case, I have variable columns which
may or may not appear (causing the need for the additional "if
(FooBarBean.isExistingColumn(x))" scriptlet code.  Even without that
problem though, it seems that I would still end up having to in line my
display columns with silly looking class properties like stuff00,
stuff01, stuff02, etc., all the way to stuff29 for each of my 30
possible data columns when I would normally write a much sexier loop
through an array (or even sexier - a collection) - all because Struts
logic:iterate tags don't seem to want to play with the display:column
tags!

We have tried asking Ed Hill about this problem, but Ed has been pretty
busy lately (either that, or it is entirely possible that our emails to
him at his email address posted on his web site are being lost in
mountains of junk mail - which is the problem I am faced with on one of
my more well known web site email accounts - making useful
correspondence with me almost impossible to that email address).  Ed,
are you still with us?

Anyway, as my code review approaches, I thought I'd try one last time to
spare this otherwise extremely powerful display tag library from the
hungry jaws of the code reviewers at work.  Of course, I could just rip
out the display tag altogether and be done with it, but by doing so, I
would also sacrifice the use of the display taglib's spreadsheet (XML,
XLS, etc.) file export features (along with potentially many other nice
features).  The business group at work would not be happy with the loss
of these features.

Has anyone ever had any luck using Ed Hill's display tag library with
the Struts logic:iterate tag?  If so, then please reply to this post and
also contact me directly at my work address ([EMAIL PROTECTED]).

Thanks!

Dave McLure
Fidelity Investments
(aka [EMAIL PROTECTED])


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Is pre-validation transform of input possible?

2002-11-09 Thread Steve Peterson
Greetings.  I'm just getting up to speed on the validation framework within 
Struts and have a question that I haven't been able to answer from reading 
the list or the docs.

Is it possible to apply pre-validation transformations to form 
parameters?  Some examples might be:

.  trimming whitespace from strings
.  converting dates from shorthand forms to longhand forms ("today" -> 
20021109)

S


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



RE: Dynamic Value for logic equal

2002-11-09 Thread edgar
The reccomended solution is use struts-EL (You need to be using the
latest version for the EL).

Start by putting your form field in the proper scope (you might be able
to do this directly in the EL with something list
${session.FormBeanName.getFormCountryCode} buty I am not sure of that).



In your code below replace USER.GETCOUNTRYCODE with

${countryCode}

My particular solution extended the WriteTag and added parameters to do
the lookup so you don't have so much logic in the JSP for something that
you do so often.

Hope that helps

Edgar

-Original Message-
From: Vikram Goyal [mailto:tech@;craftbits.com] 
Sent: Saturday, November 09, 2002 8:58 AM
To: 'Struts Users Mailing List'
Subject: Dynamic Value for logic equal


Hello All,

I have searched the list for some time now and could not find a
conclusive answer for my problem. I am hoping someone else has come
across this and can help me.

When displaying information about a User, I need to display the Label
for a Country Code. This should be simple enough. However, the User bean
contains only the country code. To get the Country label, I need to
iterate over the Country Data static collection, which stores
information about each country as a LabelValueBean. This collection is
stored in session scope.

However, the problem is that while inside the logic:iterate tag, the
logic:equal tag does not accept dynamic value for the 'value' attribute.
The processing should be like this:







The USER.GETCOUNTRYCODE is the problem part. I have tried
value=''. This does not
work, as it seems that it is parsed as is by the compiler. I also tried
using bean:define for the country code and then passing that in but that
fails as well.

I ended up writing a scriptlet around it to solve the problem, but am
not convinced that it is the best way to go about it.

Any help would be greatly appreciated.

Regards,
Vikram


--
To unsubscribe, e-mail:

For additional commands, e-mail:



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Dynamic Value for logic equal

2002-11-09 Thread Vikram Goyal
Hello All,

I have searched the list for some time now and could not find a conclusive
answer for my problem. I am hoping someone else has come across this and can
help me.

When displaying information about a User, I need to display the Label for a
Country Code. This should be simple enough. However, the User bean contains
only the country code. To get the Country label, I need to iterate over the
Country Data static collection, which stores information about each country
as a LabelValueBean. This collection is stored in session scope.

However, the problem is that while inside the logic:iterate tag, the
logic:equal tag does not accept dynamic value for the 'value' attribute. The
processing should be like this:







The USER.GETCOUNTRYCODE is the problem part. I have tried value=''. This does not work, as it seems that it
is parsed as is by the compiler. I also tried using bean:define for the
country code and then passing that in but that fails as well.

I ended up writing a scriptlet around it to solve the problem, but am not
convinced that it is the best way to go about it.

Any help would be greatly appreciated.

Regards,
Vikram


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Upload corrupts file

2002-11-09 Thread Roland Polzer


Hi,

I have a case in which an uploaded file is corrupted by struts.

The file is only 20KB. You can get it from here:
http://home.arcor.de/polzer/testXP.doc

Byte 4097 (originally 0x00) turned into a 0x0A.
I suspect a buffer size of 4 KB and/or a 0x0A 0x0D problem ???

Supposedly this bug is fixed in 1.0.1, but I have tried 1.0.2 and 1.1b and 
it is still there.
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=struts-user@;jakarta.apache.org&msgId=163235

Thanks,
Roland



_
Messenger  -  Wer in Echtzeit kommunizieren will, lädt den MSN Messenger. 
Cool, kostenlos und mit 3D Emoticons: http://messenger.msn.de


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 



I18n and Oracle Database fails

2002-11-09 Thread Mr Alireza Fattahi
Hi,

I did a lot about i18n but I still have problem. I do
every thing that was said in :
http://www.anassina.com/struts/i18n/i18n.html

Every thing works fine. Now in my action form I read
the form inputs and want to insert the data into
Oracle
tables. The data will be inserted in wrong encoding. 

I did the below test:
I entered a Farsi string with 2 charcters in my form.
After submit, In the action form, 
when I print the length of this charcter I get 2. But
shouldn't I get 4 as character length, because it is
all unicode.

Should I say oracle that I am inserting unicode? How?


__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Set selected value

2002-11-09 Thread Mohan Radhakrishnan
Hi,
 The selected value of a drop-down can be set by filling the String[] in
the form with the required values. But the values eventually come from the
database. So inside the form you have to have access to one of the scopes
where you could store the retrieved values. Is this how this is done ?
Accessing values like this just to set the selected value seems to be a
roundabout method. I am using collections in the tags.
Thanks,
Mohan

--
To unsubscribe, e-mail:   
For additional commands, e-mail: