RE: HTML / Struts Help

2002-02-13 Thread geert

you can set the property on the submit button and then use request.getParameter 
to get the value of the propery in your action.

example : 


  
  
  


In the perform method of your action you can then write : 
  String s = request.getParameter("toDo");
  if ( s.equals("process"))
  process();
  else if ( s.equals("view by org"))
  viewByOrg();
  else if ( s.equals("view by product"))
      viewByProduct();

Greetings,
Geert.

-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Why no "indexed" attribute defined in struts-html.tld?

2002-02-14 Thread geert

I'm having the same problem ...

No one to help ???


On Wed, 13 Feb 2002 16:13:31 -0800 "Liu, Xin" <[EMAIL PROTECTED]> wrote:
>Hi,
>I downloaded Struts 1.01 binary file last month. From Struts on-line doc, I 
saw the new attribute
"indexed" is added to some html tags. So I tried to use it with the following 
code:
>
> 
>
>
>But the JSP engine told me attribute "indexed" is invalid. After checking in 
struts-html.tld,
I could not find this attribute: indexed in any element of struts-html.tld.
>
>I checked binary download of Struts v 1.02, I still could not find it.
>
>Where am I wrong? Or the binary download file is wrong?
>
>Thanks!
>
>
>Tony
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Mapping in Struts-config.xml for a servlet

2002-02-14 Thread geert

To be able to call a com.somecompany.servlet.MySimpleServlet through the name 
SimpleServlet add the following to your web.xml


SimpleServlet
com.somecompany.servlet.MySimpleServlet



On Thu, 14 Feb 2002 08:54:38 +0530 [EMAIL PROTECTED] wrote:
>
>
>Hello,
> I want to call a simple servlet from an action class.
>What is the mapping I have to do  in struts-config.xml file.
>Please look into this
>
>Regards
>Arun
>
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Mapping in Struts-config.xml for a servlet

2002-02-14 Thread geert

Why would you want to avoid the web.xml ?

On Thu, 14 Feb 2002 14:57:32 +0530 [EMAIL PROTECTED] wrote:
>
>
>Hello,
>I have to make use of struts-config.xml.
>I should avoid using web.xml.
>
>Regards
>Arun
>
>
>
>
>
>
>
>[EMAIL PROTECTED] on 2002.02.14 14:53:29
>
>Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>
>  
>  
>  
>  To:  [EMAIL PROTECTED] 
>  
>  cc:  (bcc: Arun Kumar N/Satyam) 
>  
>  
>  
>  Subject  Re: Mapping in Struts-config.xml for a servlet 
>  :   
>  
>
>
>
>
>
>
>
>To be able to call a com.somecompany.servlet.MySimpleServlet through the name
>SimpleServlet add the following to your web.xml
>
>
>SimpleServlet
>com.somecompany.servlet.MySimpleServlet
>
>
>
>On Thu, 14 Feb 2002 08:54:38 +0530 [EMAIL PROTECTED] wrote:
>>
>>
>>Hello,
>> I want to call a simple servlet from an action class.
>>What is the mapping I have to do  in struts-config.xml file.
>>Please look into this
>>
>>Regards
>>Arun
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   
>>For additional commands, e-mail: 
>>
>>
>
>
>--
>Get your firstname@lastname email at http://Nameplanet.com/?su
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>
>
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Form bean -> null

2002-02-14 Thread geert

you declare an action 'editStream' which you tell to use a form called 'MyForm'
but afterwards you call an action called 'details'.
Is the 'name="MyForm" ' line in the declaration of 'details'action ??



On Thu, 14 Feb 2002 11:36:14 +0200 "Konstantina Stamopoulou" <[EMAIL PROTECTED]> 
wrote:
>Hello,
>I need to use a  form bean  in struts and this is the first time I'm doing 
that .So as newbie
I feel I'm missing something basic. Can U help me? This is my case.
>I have my struts-config :
>
> 
>   
>
>
>
> type="provider.test.MyFormAction"
>name="MyForm"
>scope="request"
>validate="false">
>  
>
>
>
>I have MyForm Bean with set and get methods and I have MyForm Action   which 
just initializes
my form:
>
>
>.
>
>if (form == null) {
>  
>  System.out.println("Form is null");
>
> form = new MyForm();
>if ("request".equals(mapping.getScope()))
>request.setAttribute(mapping.getAttribute(), form);
>else
>session.setAttribute(mapping.getAttribute(), form);
> }
> MyForm strmform = (MyForm) form;
>
>and finally my .jsp is the following:
>
>
> Destination IP Address :  
>  . 
>  . 
>  . 
>  . 
>
>  
>  
>  
   
>
>   
>  
>
>
>When I callthis page I get a :
>
>javax.servlet.ServletException: Cannot retrieve definition for form bean null
>
>error, and I cannot fingure out what I 'm doing wrong.
>
>I would appriciated if U could provide me with any info regarding this problem.
>
>Thank U in advance,
>Konstantina
>
>
>
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: logic:iterate question

2002-02-14 Thread geert

This should work ... ( use bean:write to set the value of the parameter ... )


">
View Headline 



On 14 Feb 2002 11:58:39 +0100 Oliver Kiessler <[EMAIL PROTECTED]> wrote:
>hello,
>i have a problem on one of my "views" with a logic:iterate tag. i have
>an "action" that fetches news headlines from a database
>(headline,headlineID) and stores them in a bean
>(headlines->Arraylist,headlinedID->Vector) which is appended to
>request/session. On the "view" i want to iterate through the Arraylist
>with the headlines which basically works fine. but i need to create
>links like this: XYZ
>
>how would i use the iterate tag? do i have to use the nested tag? (i am
>currently using struts 1.0.2) i dont want to use any "java code" in my
>view, only tags...
>
>thanks, oli
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




RE: logic:iterate question

2002-02-14 Thread geert

can't you create a form around each button ??

On Thu, 14 Feb 2002 12:29:34 +0100 Ronald Haring <[EMAIL PROTECTED]> wrote:
>I have a similiar question, but this time with a button
>Every row will have a show action. With a link there is no problem (using
>the method described) but with 
>a button I have a problem since I cant replace the onclick event with a
>parameter.
>
>value="id"/>)"/>
>
>this should become 
>
>Gr
>Ronald 
>
>> -Original Message-
>> From: Oliver Kiessler [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, February 14, 2002 12:21 PM
>> To: Struts Users Mailing List
>> Subject: Re: logic:iterate question
>> 
>> 
>> thanks! thats it. now it works... ;)
>> 
>> oli
>> 
>> Am Don, 2002-02-14 um 12.13 schrieb Ivan Siviero:
>> > > links like this: > href=ViewHeadlineAction.do?headlineID=X>XYZ
>> > supposing the logic:iterate id paramenter is set to "element"
>> > It should be something like this
>> > 
>> > > > paramId="headlineID" paramPropery="getterMethodWhoReturnsX">
>> > 
>> >  instead of the static 
>> > 
>> > checks this document 
>> http://jakarta.apache.org/struts/struts-html.html for
>> >  reference doc.
>> > 
>> > Hope this helps.
>> > 
>> > > --
>> > > To unsubscribe, e-mail:
>> > 
>> > > For additional commands, e-mail:
>> > 
>> > >
>> > >
>> > 
>> > 
>> > --
>> > To unsubscribe, e-mail:   
>> 
>> > For additional commands, e-mail: 
>> 
>> > 
>> > 
>> -- 
>> mailto: [EMAIL PROTECTED]
>> web: http://www.linustar.de
>> gnupg key: http://www.linustar.de/pgp/kiessler.gpg
>> icq: 136832122
>> ---
>> The more I question the origin and meaning of our existence, the
>> less I care. And the less I care, the more I question myself.
>> 
>> 
>> --
>> To unsubscribe, e-mail:   
>> 
>> For additional commands, e-mail: 
>> 
>> 
>
>
>Furore B.V.
>Rijswijkstraat 175-8
>Postbus 9204
>1006 AE Amsterdam
>tel. (020) 346 71 71
>fax. (020) 346 71 77
>
>
>---
>The information transmitted is intended only for the person
>or entity to which it is addressed and may contain confidential
>and/or privileged material. Any review, retransmission,
>dissemination or other use of, or taking of any action in
>reliance upon, this information by persons or entities other
>than the intended recipient is prohibited. If you received
>this in error, please contact the sender and delete the material
>from any computer
>
>---
>
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Why no "indexed" attribute defined in struts-html.tld?

2002-02-14 Thread geert

I think I need the "indexed" attribute but it is'nt there ...
So that's a problem ...


On Thu, 14 Feb 2002 07:07:22 -0500 "Galbreath, Mark" <[EMAIL PROTECTED]> 
wrote:
>How could it be a problem if it never worked?  Sounds like a documentation
>error.
>
>Cheers!
>Mark
>
>--
>Try before you cry:
>http://www.mail-archive.com/struts-user%40jakarta.apache.org/
>
>-Original Message-
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, February 14, 2002 4:14 AM
>
>I'm having the same problem ...
>
>No one to help ???
>
>On Wed, 13 Feb 2002 16:13:31 -0800 "Liu, Xin" <[EMAIL PROTECTED]>
>wrote:
>
>>Hi,
>
>>From Struts on-line doc, I saw the new attribute "indexed" is added to some
>html tags.
>>But the JSP engine told me attribute "indexed" is invalid. After checking
>in 
>struts-html.tld, I could not find this attribute: indexed in any element of
>struts-html.tld.
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Help forwarding from one site to another.

2002-02-14 Thread geert

This works : 

use 


Go.jsp contains nothing but a redirect.
<%response.sendRedirect("http://www.slashdot.org/";);%>




On Thu, 14 Feb 2002 13:32:31 - [EMAIL PROTECTED] wrote:
>Hello all,
>
>Upon a successful response from an action class I would like to forward to a
>different site. I have tried adding path="http://www.slashdot.org/"; /> to my struts-config.xml, but it fails. 
>
>Is there a nice way of achieving this?
>
>Thanks.
>
>Stephen.
>
>
>---

>
>Copyright material and/or confidential and/or privileged information may be 
contained in this
e-mail and any attached documents.  The material and information is intended 
for the use of
the intended addressee only.  If you are not the intended addressee, or the 
person responsible
for delivering it to the intended addressee, you may not copy, disclose, 
distribute, disseminate
or deliver it to anyone else or use it in any unauthorised manner or take or 
omit to take any
action in reliance on it. To do so is prohibited and may be unlawful.   The 
views expressed
in this e-mail may not be official policy but the personal views of the 
originator.  If you
receive this e-mail in error, please advise the sender immediately by using the 
reply facility
in your e-mail software, or contact [EMAIL PROTECTED]  Please also delete 
this e-mail and
all documents attached immediately.  
>Many thanks for your co-operation.
>
>BMW Financial Services (GB) Limited is registered in England and Wales under 
company number
01288537.
>Registered Offices : Europa House, Bartley Way, Hook, Hants, RG27 9UF
>---
---
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Quick question about iterators & beans on a page

2002-02-15 Thread geert

In the action that will be forwarded to your jsp you put a list(e.g. an 
ArrayList)  on the request.  This list contains bean of some kind.
Then in your jsp you can write : 


   


On 15 Feb 2002 07:01:59 -0800 Adam Hardy <[EMAIL PROTECTED]> wrote:
>Being a bit slow off the mark with this iterator tag. I've found all sorts of 
examples and
some stuff in the archives here but it's confused me more than helped me. 
>
>If I want a list displayed, no form, just data, the best place to get it is in 
a page context
bean, right? 
>
>Second, how do I access the page context or the session from within that bean? 
>
>I take it I don't want to create my own bespoke iterator tag, right?
>
>Any help gratefully received. 
>Adam
>
>
>
>On Fri, 15 February 2002, Adam Hardy wrote:
>
>> 
>> Hi All,
>> 
>> I want to populate a table with data from a database, so presumably I create 
a bean on a
jsp which calls the database, and converts it and hands it to an iterator. 
>> 
>> First, how do I make the data thread-safe? Is it thread-safe because it is 
in a jsp which
is therefore compiled into a local variable in its corresponding servlet?
>> 
>> Second, how do I get the user's ID in the bean? Do I pass it in to the bean 
constructor as
a parameter via the usebean tag, or do I pass in the session, or can I get the 
session somehow
in the bean (from getPageContext or similar)?
>
>
>Find the best deals on the web at AltaVista Shopping!
>http://www.shopping.altavista.com
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Quick question about iterators & beans on a page

2002-02-15 Thread geert

You probably could do that but I'm pretty sure it will not be fast developping.
Also I think it is not the right way to do struts.

Just do what you have to do in a simple java action and throw your stuff on the 
request or the session ( if the data needs to live longer then one request  ) .
Then in your jsp simply use the struts tags to display the data that is on the 
request.

Keep it simple !  
Keep your knowledge and action in your java actions,
let struts manage the flow through struts-config.xml 
and use your jsp's to simply display the information that you have retrieved in 
your actions !

greet,
Geert.

On 15 Feb 2002 07:55:15 -0800 Adam Hardy <[EMAIL PROTECTED]> wrote:
>Yowsa! Someone is listening. I've just got a bit of P, which doesn't make it 
easier.
I did actually get that far in the thought process, but several Actions can 
forward to this
page, so can't I just do the stuff in a bean & a tag? 
>
>How about ditching the seperate bean & subclassing the iterator and calling up 
my data in the
doStart? That means I don't have to pass in the request to the constructor 
because I've got
the TagSupport methods. Or does this conflict with MVC in a big way? I mean 
I've got my data
access class which just returns a rowset, all nice & seperate.
>
>
>
>
>On Fri, 15 February 2002, [EMAIL PROTECTED] wrote:
>
>> 
>> In the action that will be forwarded to your jsp you put a list(e.g. an 
>> ArrayList)  on the request.  This list contains bean of some kind.
>> Then in your jsp you can write : 
>> 
>> 
>>> property="SomePropertyOfTheBeansThatAreInTheListOnTheRequest" />
>> 
>> 
>> On 15 Feb 2002 07:01:59 -0800 Adam Hardy <[EMAIL PROTECTED]> wrote:
>> >Being a bit slow off the mark with this iterator tag. I've found all sorts 
of 
>> examples and
>> some stuff in the archives here but it's confused me more than helped me. 
>> >
>> >If I want a list displayed, no form, just data, the best place to get it is 
in 
>> a page context
>> bean, right? 
>> >
>> >Second, how do I access the page context or the session from within that 
bean? 
>> >
>> >I take it I don't want to create my own bespoke iterator tag, right?
>> >
>> >Any help gratefully received. 
>> >Adam
>> >
>> >
>> >
>> >On Fri, 15 February 2002, Adam Hardy wrote:
>> >
>> >> 
>> >> Hi All,
>> >> 
>> >> I want to populate a table with data from a database, so presumably I 
create 
>> a bean on a
>> jsp which calls the database, and converts it and hands it to an iterator. 
>> >> 
>> >> First, how do I make the data thread-safe? Is it thread-safe because it 
is 
>> in a jsp which
>> is therefore compiled into a local variable in its corresponding servlet?
>> >> 
>> >> Second, how do I get the user's ID in the bean? Do I pass it in to the 
bean 
>> constructor as
>> a parameter via the usebean tag, or do I pass in the session, or can I get 
the 
>> session somehow
>> in the bean (from getPageContext or similar)?
>> >
>> >
>> >Find the best deals on the web at AltaVista Shopping!
>> >http://www.shopping.altavista.com
>> >
>> >--
>> >To unsubscribe, e-mail:   <mailto:struts-user-
[EMAIL PROTECTED]>
>> >For additional commands, e-mail: <mailto:struts-user-
[EMAIL PROTECTED]>
>> >
>> >
>> 
>> 
>> -- 
>> Get your firstname@lastname email at http://Nameplanet.com/?su
>> 
>> --
>> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>Find the best deals on the web at AltaVista Shopping!
>http://www.shopping.altavista.com
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Fill a list of textboxes ...

2002-02-18 Thread geert

Here is my problem : 

I have a from with an according form class :
public class OrderForm extends ActionFrom
{
private String name; // name of the person that is ordering
private ArrayList orderItems; // list of ordered items.

// getters and setters ...
}

Each order item is a bean like this :
public class ProductBean
{
private String productName; // the name of the product
private int number; // how many of this product do you want 

// getters and setters ..
}

I have a form on a jsp that diplayes a textbox for the name of the person that 
wants to order, and a textbox for each product so you can enter a number .
The problem is that these numbers are not stored  in the according ProductBeans.

Here is my form. ( processOrder uses an OrderFrom 












If I click the submit button, my action is called.  The name is on the 
OrderForm, but there is not 1 number filled out !!

How is this possible and how do I need to handle this problem .

Thanks !
Geert



-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: Fill a list of textboxes ...

2002-02-18 Thread geert

I thank you !

On Mon, 18 Feb 2002 22:55:20 +1100 Arron Bates <[EMAIL PROTECTED]> wrote:
>It's because you're trying to use the non-nesting tags in a nested 
>manner. Basically the text tags don't know that they're inside the 
>iterate tags.
>
>If you're running the nightly build, change the  to 
> and the  to . If you're not 
>on the nightly build, get the tags in separate jar form from here...
>http://www.keyboardmonkey.com/struts and do the same.
>
>Only other way is indexed tags, but you're already trying to logically 
>nest, so keep nestin'.
> 
>The nested tags are the exact fit to what you expected from the tags.
>
>Arron.
>
>[EMAIL PROTECTED] wrote:
>
>>Here is my problem : 
>>
>>I have a from with an according form class :
>>public class OrderForm extends ActionFrom
>>{
>>private String name; // name of the person that is ordering
>>private ArrayList orderItems; // list of ordered items.
>>
>>// getters and setters ...
>>}
>>
>>Each order item is a bean like this :
>>public class ProductBean
>>{
>>private String productName; // the name of the product
>>private int number; // how many of this product do you want 
>>
>>// getters and setters ..
>>}
>>
>>I have a form on a jsp that diplayes a textbox for the name of the person 
that 
>>wants to order, and a textbox for each product so you can enter a number .
>>The problem is that these numbers are not stored  in the according 
ProductBeans.
>>
>>Here is my form. ( processOrder uses an OrderFrom 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>If I click the submit button, my action is called.  The name is on the 
>>OrderForm, but there is not 1 number filled out !!
>>
>>How is this possible and how do I need to handle this problem .
>>
>>Thanks !
>>Geert
>>
>>
>>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Re: logic:iterate

2002-02-18 Thread geert

Is the questionset on the request ?
Then specify you logic:iterate like this 



(idem for session)

On 18 Feb 2002 04:51:33 -0800 Adam Hardy <[EMAIL PROTECTED]> wrote:
>A question about the logic:iterate tag. I'm having problems getting the JSP to 
compile, tomcat
tells me it can't find the bean that I named in the id of the iterator tag. 
>
>This is my tag:
>
>
>
>So tomcat can't find bean "idata" in scope null and throws an exception. 
>
>Going through the struts docs, I can't see what my problem is. I've created an 
array of objects,
put it in a bean and put the bean in the request with the attribute 
tag "questionset". 
>
>The bean has the getter method "list" which returns the array of objects. This 
works, I've
debugged it with a scriptlet in the JSP.
>
>Can anyone say what I'm doing wrong? Thanks
>Adam
>
>
>
>Find the best deals on the web at AltaVista Shopping!
>http://www.shopping.altavista.com
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>


-- 
Get your firstname@lastname email at http://Nameplanet.com/?su

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




Newbie question: how to reload the struts config file without rebooting tomcat?

2003-10-29 Thread Geert Van Landeghem
Hello all,

how do I reload changes to the struts config file without rebooting
tomcat?

kind regards,
Geert

-Original Message-
From: Frers Michael [mailto:[EMAIL PROTECTED]
Sent: woensdag 29 oktober 2003 9:49
To: Struts Users Mailing List
Subject: Re: a query regarding 


Hello
on my first look:
shouldnt u use 


i think there is a missing "s"


- Original Message - 
From: "Mahin Jeyachandran" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, October 29, 2003 4:57 AM
Subject: a query regarding 


good day all,

I'm new to struts frame work...

I'm using a property file names "languages.properties" instead of
"ApplicationResources.properties"
Also I have an entry in my "struts-config.xml" like the following...



I also placed the property file in "WEB-INF/classes/"
but it seems that the property file "languages.properties" is not detected.

shld I make any changes or any entry in the "web.xml" to make my new
property file visible 

I'm using web-logic6.1.

pls help..

Regards,
Mahin




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


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



RE: data-source connection keeps closing

2003-11-06 Thread Geert Van Landeghem
David,

hope this helps:

 
   
   
   
   
   
   
   
   
 

I'm using the latest stable mysql driver mysql-connector-java-3.0.9-stable-bin.jar.

This is not the best example since it accesses the db from within a jsp:
 Connection conn = null;
 DataSource dataSource = null;
 try {
dataSource = (DataSource)
  getServletContext().getAttribute(Action.DATA_SOURCE_KEY);
conn = dataSource.getConnection();
Statement s = conn.createStatement();
ResultSet rs = s.executeQuery( "select count(*) from 
collection.web_users");
if (rs.next()) {
%>
Number of users defined=<%=rs.getInt(1) %>
<%
}
 } catch (SQLException sqle) {
log("Connection.process", sqle);
 } finally {
//enclose this in a finally block to make
//sure the connection is closed
try {
if (conn != null)
   conn.close();
} catch (SQLException e) {
   log("Connection.close", e);
}
 }
%>

met vriendelijke groeten,
salutations sincères,
kind regards,

Geert Van Landeghem
Reynders Etiketten NV
tel: +32 3 460.32.81
gsm: +32 477.75.95.33
<mailto:[EMAIL PROTECTED]>

Give me 
the power to accept the things i cannot change,
the strength to change the things i can change,
and the insight to tell the difference




-Original Message-
From: David Parry [mailto:[EMAIL PROTECTED]
Sent: donderdag 6 november 2003 14:41
To: [EMAIL PROTECTED]
Subject: data-source connection keeps closing


After days of googling and trawling through the mail archives, I still  
can't find any explanation for this... I'm trying to get a DataSource  
that's been configured in struts-config.xml and use the connection in  
my Model.

Every time I try to use the connection it says that it has closed  
(before even getting the chance to create a statement!). The connection  
that is returned sure enough has the correct URL, user, password &  
driver, and independent tests have confirmed that mysql is running,  
that permissions are acceptable for that user, it's accessible from  
Java, blah blah...

I've looked through most of the examples listed on the struts resources  
pages, but I can't seem to find anything that has a simple  
direct-to-jdbc example. Currently I'm not in a position to be using  
anything like Hibernate, etc, so all those examples are kinda not  
helpful in my situation.


QUESTION: Does anyone have a simple canonical example of connecting to  
a JDBC database (preferably MySQL) via struts?


I'm using Tomcat 4.1, MySQL 4.1.0, MySQL Connector 3.0.9 and struts 1.2.

Error is as follows:

14:21:44,750 DEBUG QueryAction:55 - dataSource =  
[EMAIL PROTECTED]
14:21:45,561 DEBUG QueryAction:59 - myConnection =  
[EMAIL PROTECTED]
14:21:45,636 DEBUG QueryAction:61 - queryModel =  
[EMAIL PROTECTED]
14:21:45,677 DEBUG Model:109 - findNodes(null)
14:21:45,682 DEBUG Model:384 - readAll(node)
14:21:45,687 DEBUG Model:385 - connection =  
[EMAIL PROTECTED]
14:21:45,712 ERROR Model:392 - SQL Exception
java.sql.SQLException: Connection is closed.
 at  
org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnect 
ion.java:245)
 at  
org.apache.commons.dbcp.DelegatingConnection.createStatement(DelegatingC 
onnection.java:170)
 at com.imc.semantic.Model.readAll(Model.java:389)


struts-config.xml:

   












  
   


and the Java code in the Action:

public ActionForward execute(ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
throws Exception {

DataSource dataSource;
QueryModel queryModel = null;
Connection myConnection = null;

try {
dataSource = getDataSource(request);
//  dataSource = servlet.findDataSource(null);
logger.debug("dataSource = " + dataSource);

if (dataSource != null) {
myConnection = dataSource.getConnection();
logger.debug("myConnection = " + myConnection);
queryModel = new QueryModel(myConnection);
logger.debug("q

RE: Accessing application scope in Action.execute()

2003-11-12 Thread Geert Van Landeghem
The Action class contains the protected ActionServlet servlet variable
through which each subclass can access the servlet context.

A good approach to accessing session and application objects is by 
extending the Action class (I've got this from O'Reilly's Programming
Jakarta Struts)

By extending this class all your action classes inherit these common
methods (getSessionObject, getApplicationObject, ...)

abstract public class EnterpriseBaseAction extends Action {
  /**
   * Retrieve a session object based on the request and the attribute name.
   */
  protected Object getSessionObject(HttpServletRequest req,
String attrName) {
Object sessionObj = null;
HttpSession session = req.getSession(false);
if ( session != null ){
   sessionObj = session.getAttribute(attrName);
}
return sessionObj;
  }

  /**
   * Retrieve an object from the application scope by its name. This is
   * a convience method.
   */
  protected Object getApplicationObject(String attrName) {
return servlet.getServletContext().getAttribute(attrName);
  }

  public boolean isLoggedIn( HttpServletRequest request ){
UserContainer container = getUserContainer(request);
if ( container.getUserView() != null ){
   return true;
}else{
  return false;
}
  }

  /**
   * Return the instance of the ApplicationContainer object.
   */
  protected ApplicationContainer getApplicationContainer() {
return 
(ApplicationContainer)getApplicationObject(IConstants.APPLICATION_CONTAINER_KEY);
  }

  /**
   * Retrieve the UserContainer for the user tier to the request.
   */
  protected UserContainer getUserContainer(HttpServletRequest request) {

UserContainer userContainer = (UserContainer)getSessionObject(request, 
IConstants.USER_CONTAINER_KEY);

// Create a UserContainer for the user if it doesn't exist already
if(userContainer == null) {
  userContainer = new UserContainer();
  userContainer.setLocale(request.getLocale());
  HttpSession session = request.getSession(true);
  session.setAttribute(IConstants.USER_CONTAINER_KEY, userContainer);
}

return userContainer;
  }
}


-Original Message-
From: Looser [mailto:[EMAIL PROTECTED]
Sent: maandag 10 november 2003 16:03
To: struts Mailinglist
Subject: Accessing application scope in Action.execute()


Hi,

is there any chance to access objects in application scope in my action 
classes ?

I have to override the .execute(ActionMapping mapping,ActionForm 
form,HttpServletRequest request,HttpServletResponse response) method but 
none of these parameters give me access to application scope like 
'getServletContext().getAttribute("myAttribute")' would do.

Which is the best practise to store objects in application scope and 
retrieve them back in my ActionClasses ?

Thx for your answers...


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


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



Checkbox values

2003-11-14 Thread Geert Van Landeghem
Hello all,
 
I'm trying to show the selected rows in a html table by using check
boxes. I'm using the same jsp to show the selected row indexes of the table.

What am I'm doing wrong because I'm not able to see the selected indexes:



selected index = 



 
 

 
  
    



tia,

met vriendelijke groeten,
salutations sincères,
kind regards,

Geert Van Landeghem
Reynders Etiketten NV
tel: +32 3 460.32.81
gsm: +32 477.75.95.33
<mailto:[EMAIL PROTECTED]>

Give me 
the power to accept the things i cannot change,
the strength to change the things i can change,
and the insight to tell the difference


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



RE: Checkbox values: how to substitute the value attribute by the book id?

2003-11-14 Thread Geert Van Landeghem
Sumit, 

I found a solution to this problem as following:




index = 








 
AuthorL
AuthorF
Title

 
 

 
  
    



Process

-Original Message-
From: Sumit S. [mailto:[EMAIL PROTECTED]
Sent: vrijdag 14 november 2003 12:51
To: Struts Users Mailing List
Subject: RE: Checkbox values


Geert,
 this would create BookListKey[i].selectedBook = 1 for "Checked" Books

When you have to render this info try



 
selected index = 





hope this helps

Regards
Sumit


-Original Message-----
From: Geert Van Landeghem [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 4:56 PM
To: Struts Users Mailing List
Subject: Checkbox values


Hello all,
 
I'm trying to show the selected rows in a html table by using check
boxes. I'm using the same jsp to show the selected row indexes of the table.

What am I'm doing wrong because I'm not able to see the selected indexes:



selected index = 



 
 

 
  
    



tia,

met vriendelijke groeten,
salutations sincères,
kind regards,

Geert Van Landeghem
Reynders Etiketten NV
tel: +32 3 460.32.81
gsm: +32 477.75.95.33
<mailto:[EMAIL PROTECTED]>

Give me 
the power to accept the things i cannot change,
the strength to change the things i can change,
and the insight to tell the difference


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


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


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



RE: Checkbox values: how to substitute the value attribute by the book id?

2003-11-14 Thread Geert Van Landeghem
But how to substitute the value=?? by the book id?

Geert

-Original Message-
From: Geert Van Landeghem 
Sent: vrijdag 14 november 2003 14:48
To: Struts Users Mailing List
Subject: RE: Checkbox values: how to substitute the value attribute by
the book id?


Sumit, 

I found a solution to this problem as following:




index = 








 
AuthorL
AuthorF
Title

 
 

 
  
    



Process

-Original Message-
From: Sumit S. [mailto:[EMAIL PROTECTED]
Sent: vrijdag 14 november 2003 12:51
To: Struts Users Mailing List
Subject: RE: Checkbox values


Geert,
 this would create BookListKey[i].selectedBook = 1 for "Checked" Books

When you have to render this info try



 
selected index = 





hope this helps

Regards
Sumit


-Original Message-----
From: Geert Van Landeghem [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 4:56 PM
To: Struts Users Mailing List
Subject: Checkbox values


Hello all,
 
I'm trying to show the selected rows in a html table by using check
boxes. I'm using the same jsp to show the selected row indexes of the table.

What am I'm doing wrong because I'm not able to see the selected indexes:



selected index = 



 
 

 
  
    



tia,

met vriendelijke groeten,
salutations sincères,
kind regards,

Geert Van Landeghem
Reynders Etiketten NV
tel: +32 3 460.32.81
gsm: +32 477.75.95.33
<mailto:[EMAIL PROTECTED]>

Give me 
the power to accept the things i cannot change,
the strength to change the things i can change,
and the insight to tell the difference


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


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


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


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