Re: How to implement OR functionality in STRUTS

2005-01-05 Thread dsarris
Hi, 
use JSTL. Do not spend time with the Struts tags. 

here is an example:




   Error 1 has occurred.


Error 2 has occurred.




Chipix

On Wed, 05 Jan 2005 01:05:30 -0500, Erik Weber <[EMAIL PROTECTED]> wrote:
> Look into the expression language's Logical OR ("||") operator and the
> JSTL core tags (such as c:if). Possibly the OR operator would work
> within an EL expression using the logic:equal tag as well, but I just
> can't think of an example.
> 
> Erik
> 
> 
> Krishna Mohan Radhakrishnan wrote:
> 
> >
> >Hi all,
> >A very simple question.
> >
> >
> >   
> >   ...
> >.
> >
> >
> >   
> >
> >
> >The above code is just like an AND function.
> >Only if both the conditions are equal it will go inside the loop.
> >
> >Similarly How will we do it for an OR  condition.
> >If any condition satisfies it should go inside the loop.
> >
> >May be this sounds a very silly question. I am a fresher to struts.
> >That's Y?
> >
> >Regards,
> >Krishna Mohan R
> >
> >

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



Re: Set request parameters in servlet through action

2005-01-05 Thread dsarris
OK, 

Thanks everyone for your help.

The correct approach is:

Java:
request.setAttribute("myThing", myThing);

JSP:


Thanks again

On Tue, 04 Jan 2005 18:22:32 -0800, Curtis Taylor <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> You *cannot* directly add parameters to an http request inside an Action
> class. You *can* add attributes  to the request context (that's what
> HttpServletRequest was designed for).
> 
> So, in your JSTL-aware page, access your request *attribute*:
> 
>  or
> 
> 
> 
> HTH,
> 
> Curtis
> 
> dsarris wrote:
> > 
> >
> > I do not thing that Hollaway solution is the correct one. I do not
> > pass it to the request parameter list. As brenmcguire stated, I can
> > only set an attribute in the Request (not the parameters).
> >
> > Thus, what is the equivalent for retrieving the attribute in my JSP page?
> >
> > 
> > OR
> > 
>

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



Re: Set request parameters in servlet through action

2005-01-04 Thread dsarris


I do not thing that Hollaway solution is the correct one. I do not
pass it to the request parameter list. As brenmcguire stated, I can
only set an attribute in the Request (not the parameters).

Thus, what is the equivalent for retrieving the attribute in my JSP page?


OR


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



Re: Set request parameters in servlet through action

2005-01-04 Thread dsarris
On Tue, 4 Jan 2005 14:37:54 +0100, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> >
> > Thus, if I set an attribute using the HttpServletRequest.setAttribute,
> > how can I retrieve it my JSP page?
> > I know that all these can be very easy using an ActionForm, but I do
> > not want to create an ActionForm for just a plain String attribute.
> >
> 
> Supposing in the Java code:
> 
> 
> String myThing;
> ..
> request.setAttribute("myThing", myThing);
> 
> 
> In the JSP code do this:
> 
> 
> 
> Obviously include the "struts-bean" tag library in your JSP page.
> Notice that 'scope="request"' is optional.

I am using the JSTL:core tag libs ar a replacement of the "struts-bean" tag.

Thus, is the following equivalent?

JSP:


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



Re: Set request parameters in servlet through action

2005-01-04 Thread dsarris
On Tue, 4 Jan 2005 13:31:35 +0100, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> 
> > how can I add a request parameter inside an action execute method? Do
> > I have to use an ActionForm or it is an easiest way to do it?
> >
> 
> You cannot set a new parameter once a http request has been submitted, but
> you can get parameters directly via the object "request", passed in the
> "execute" method. Simply use the "getParameter*" methods.
> Ciao
> Antonio Petrelli
> 

At last a European guy :-) !! I always wait for at least 6 hours until
I have a reply.

Thus, if I set an attribute using the HttpServletRequest.setAttribute,
how can I retrieve it my JSP page?
I know that all these can be very easy using an ActionForm, but I do
not want to create an ActionForm for just a plain String attribute.

chipix

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



Set request parameters in servlet through action

2005-01-04 Thread dsarris
Hi,

how can I add a request parameter inside an action execute method? Do
I have to use an ActionForm or it is an easiest way to do it?

chipix

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



Re: ActionForm automatic type conversion

2005-01-04 Thread dsarris
On Mon, 3 Jan 2005 17:46:46 +0100, Pavel Kolesnikov
<[EMAIL PROTECTED]> wrote:
> On Mon, 3 Jan 2005 11:16:16 +0200, dsarris <[EMAIL PROTECTED]> wrote:
> 
> > I am trying to fill an ActionForm with values that are neither Strings
> > or primitives.
> 
> I think you can do it by extending the RequestProcessor class
> and overloading "processPopulate" method or something like that.
> 
> But in general - I guess you should better avoid it. HTML forms are
> designed for sending String values typed by user and Struts layer
> (= ActionForms or Actions) should transform them into appropriate
> business objects.
> 
> If you tell us something about why you need it, it could be possible to
> find out better designed (IMHO) solution.
> 
> Pavel Kolesnikov

I am using Hibernate to retrieve information from DB (I have several
implemented DAO classes). The information retrieved is stored in Java
POJOs.

In order to integrate with Struts I have 2 choices:
1. Implement a model structure where I save all the information needed
from application.
2. Retrieve the information needed using DAO classes which will access the DB.

Do you have any other suggestions. I am going to use a mix of these 2
solutions.
That is, each application transaction will hold its temporary model
which will be discarded after the end of the transaction in order to
be used from all the action and JSP classes

Everything else is kept in DB.

chipix

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



ActionForm automatic type conversion

2005-01-03 Thread dsarris
Hi all and happy new year,

I am trying to fill an ActionForm with values that are neither Strings
or primitives. The specified values are selected using the
 tag. This a sample of my JSP code:

   




   

   
   

The "controlPanelValues" Bean contains a collection (list) named
"athletes" containing Beans of type "Pair". The "Pair" object contains
2 attributes: The "name" which is a String and the value which is an
"Athlete" object.

My ActionForm contains an attribute named "selectedAthlete" of the
type "Athlete".

However, whenever I submit this form the "selectedAthlete"  is filled
with the string representation of the "Athlete" type.

I used both simple and map-backed actionform with no success. 

Is Struts capable for doing assignment of non String or primitive fields?

Chipix

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



Re: Struts usage question

2005-01-03 Thread dsarris
On Fri, 31 Dec 2004 09:53:12 -0800, Dakota Jack <[EMAIL PROTECTED]> wrote:
> Yes.  Use JSTL instead.
> 
> Jack
> 
> On Fri, 31 Dec 2004 15:29:45 +0100, Axel Gross
> <[EMAIL PROTECTED]> wrote:
> > hi there!
> >
> > the el libs use the jsp 2.0 expression language (${} instead of <%= %> )
> > If you don't have a servlet container which supports that by itself, you can
> > use the el-tags to use it at least inside of the struts tags.
> >
> > hth,
> > axel
> >
> > On 2004-12-31 at 13:23:19 +0200, dsarris wrote:
> > > On Fri, 31 Dec 2004 11:26:47 +0200, dsarris <[EMAIL PROTECTED]> wrote:
> > > > On Thu, 30 Dec 2004 09:23:28 -0700, Wendy Smoak <[EMAIL PROTECTED]> 
> > > > wrote:
> > > > > From: "dsarris" <[EMAIL PROTECTED]>
> > > > > > I am trying to use the  tag with the
> > > > > >  tag.
> > > > > > Do I have to put the collection property inside the form bean of the
> > > > > > form that contains the ?
> > > > >
> > > > > The docs say if you leave off the 'name' attribute, the framework 
> > > > > will look
> > > > > to the enclosing form bean.  So use 'name' to tell it which bean to 
> > > > > use.
> > > > >
> > > > > Is there a reason to use  over  > > > > collection="..."> ?  Just curious, I use the second one:
> > > > >
> > > > > 
> > > > >  > > > > labelProperty="value"/>
> > > > > 
> > > > > (Where contactTypes is a Map sitting in Application scope.)
> > > > >
> > > > > --
> > > > > Wendy Smoak
> > > >
> > > > I managed to fixed it using the name attribute. Thank you.
> > > >
> > > > However, where is a distribution of the strus-el library? I am using
> > > > struts 1.2.4 and I have not found it!
> > > > Why is better to use the struts-el?
> > > >
> > > > --
> > > > Dimitris Sarris
> > > >
> > > I found them in the contrib directory ;-).
> > > However, I have not found documentation regarding the struts-el extention 
> > > yet.
> > >

Hi all and happy new year,

Regarding the Struts-EL extention I use the JSTL libraries so it would
be no problem to use it.

Thank again

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



Re: Struts usage question

2004-12-31 Thread dsarris
On Fri, 31 Dec 2004 11:26:47 +0200, dsarris <[EMAIL PROTECTED]> wrote:
> On Thu, 30 Dec 2004 09:23:28 -0700, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> > From: "dsarris" <[EMAIL PROTECTED]>
> > > I am trying to use the  tag with the
> > >  tag.
> > > Do I have to put the collection property inside the form bean of the
> > > form that contains the ?
> >
> > The docs say if you leave off the 'name' attribute, the framework will look
> > to the enclosing form bean.  So use 'name' to tell it which bean to use.
> >
> > Is there a reason to use  over  > collection="..."> ?  Just curious, I use the second one:
> >
> > 
> >  > labelProperty="value"/>
> > 
> > (Where contactTypes is a Map sitting in Application scope.)
> >
> > --
> > Wendy Smoak
> 
> I managed to fixed it using the name attribute. Thank you.
> 
> However, where is a distribution of the strus-el library? I am using
> struts 1.2.4 and I have not found it!
> Why is better to use the struts-el?
> 
> --
> Dimitris Sarris
> 
I found them in the contrib directory ;-). 
However, I have not found documentation regarding the struts-el extention yet.

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



Re: Struts usage question

2004-12-31 Thread dsarris
On Thu, 30 Dec 2004 09:23:28 -0700, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> From: "dsarris" <[EMAIL PROTECTED]>
> > I am trying to use the  tag with the
> >  tag.
> > Do I have to put the collection property inside the form bean of the
> > form that contains the ?
> 
> The docs say if you leave off the 'name' attribute, the framework will look
> to the enclosing form bean.  So use 'name' to tell it which bean to use.
> 
> Is there a reason to use  over  collection="..."> ?  Just curious, I use the second one:
> 
> 
>  labelProperty="value"/>
> 
> (Where contactTypes is a Map sitting in Application scope.)
> 
> --
> Wendy Smoak

I managed to fixed it using the name attribute. Thank you. 

However, where is a distribution of the strus-el library? I am using
struts 1.2.4 and I have not found it!
Why is better to use the struts-el?

-- 
Dimitris Sarris

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



Struts usage question

2004-12-30 Thread dsarris
Hi,

I am trying to use the  tag with the
 tag. The documentation states that the
optionscollection tag retrieves ithe collection from the bean that is
specified using the name property.
My question is the following:

Do I have to put the collection property inside the form bean of the
form that contains the ?

For example:

myAction.do has the form bean myActionFormBean.

Code:



   Name
   


Surname



Marital Status

 
  
  





Is it going to work if the "myCustomBeanNotTheSameAsTheForm" is saved
in the session?

Thenak you

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