URL encoded request parameters

2001-05-30 Thread Jan Fredrik Øveraasen

hi
How can I read request parameters with URL encoding from a FormBean?

Jan Fredrik

___ Jan Fredrik Øveraasen | Senior Systems Developer 
___ Cell Network ASA | Pb. 5313, Sørkedalsv. 10A, N-0304 Oslo,
Norway
___ Tel: +47 23196600/35 | Fax: +47 23196601 | Mob: +47 93 49 99 88
   ___ http://www.cellnetwork.com/ |
mailto:[EMAIL PROTECTED]

 




RE: Solution: bean attributes not displaying (please comment)

2001-05-30 Thread Lacerda, Wellington (AFIS)

If there is an ActionForm bean stored either on the request or on the
session, remove it. The getAttribute method will return the name of the
attribute in the session or in the request where the bean is stored under.
The getScope says either session or request.

This fragmnent is to be executed to remove an obsolete ActionFormBean from
the session, either because new information took place or because that one
was successfully processed.

Wellington Silva
UN/FAO

-Original Message-
From: Martin Zaidel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 6:13 AM
To: [EMAIL PROTECTED]
Subject: Solution: bean attributes not displaying (please comment)


Got it:  My problem resided in these lines of code in perform() (which I
copied from an Action class in the struts-example):

   if (mapping.getAttribute() != null) {
   if (request.equals(mapping.getScope()))
   request.removeAttribute(mapping.getAttribute());
   else
   session.removeAttribute(mapping.getAttribute());
   }

So my question to the list is: what exactly are these lines doing?

Thanks,
Martin

Thomas Peters wrote:
 
 Thanks for your reply...
 
 I guessed that was the problem. I don't see the new instance being created
 in my log file. I also have a fully working struts demo, which does not
 display this behavior. What's up with that?
 
 Tom
 
 - Original Message -
 From: Martin Zaidel [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, May 29, 2001 6:49 PM
 Subject: Re: bean attributes not displaying - please help
 
  I also have this problem, but alas, no solution (as yet).  I've even
  tried
  in struts-config.xml to set the scope of the actions to session, and
  have explicitly
  added the form to the session within the Action's perform().  I, too,
  can see the form properly populated.  However, when the form's jsp is
  called, a new Form instance is instantiatedthus, the displayed form
  is blank.
 
  Any ideas?
 
   Thomas Peters wrote:
  
   I have a jsp page called 'customer.jsp' with a class call
   'CustomerForm' which extendes ActionForm.
  
   I have cut and paste my mappings and listed them below.
  
   The application flow is such, that I have a link with a URI of
   /searchCustomers.do?action=Search. This action calls
   'CustomerSearchAction' which initializes a 'CustomerForm' with null
   values for all the attributes except action, that's defaulted to
   'Search'. That works fine.
  
   When the end user completes and submits the 'CustomerForm' form, I
   construct a query that returns a list of customers matching the
   submitted criteria. 'Customers' is a class which contains a Hashtable
   of 'Customer' objects. This is accomplished with 'CustomerListAction'
   and forwards to 'customers.jsp' which presents the results in a list.
   I have a 'LinkCustomerTag' class which builds links within the
   iteration of 'customers' on the 'customers.jsp' page. The link looks
   like this: '/editCustomer.do?action=EditcustNum=10' where
   'custNum=10' dynamically changes throughout the iteration based on the
   current 'customer'. This works fine too.
  
   I select one of the links in the list which maps to '/editCustomer'
   (see below) and calls the 'CustomerEditAction' class where I copy the
   properties to the instance of 'CustomerForm' and 'forward' to the
   'customer.jsp'. This is where my problem is.
  
** The form is blank. **
  
   I have lotts of comments in my code and can see that
   'PropertyUtils.copyProrerties(customerForm, customer)' is getting
   called. I even modified the 'PropertyUtils' class to log the
   properties being copied within the 'Enumeration' in the
   'copyProperties' method. You can see these values being copied into
   the 'ActionForm' but when the 'forward' is called and the
   'customer.jsp' is displayed, it is empty.
  
   Please help...
  
  
   
   struts-config.xml
   
  
  
 !-- == Form Bean Definitions
   === --
  
   !-- Customer form bean --
   form-bean  name=customerForm
   type=CustomerForm/
  
   !-- Customer list bean --
   form-bean  name=customerList
   type=CustomerForm/
   .
   .
   .
   .
  
 !-- == Action Mapping Definitions
   == --
   !-- Search customer --
   actionpath=/searchCustomer
  type=CustomerSearchAction
  name=customerForm
 scope=request
 input=/customer.jsp
 forward name=success path=/customer.jsp/
   /action
  
   !-- List customers --
   actionpath=/listCustomers
  type=CustomerListAction
  name=customerList
 scope=request
 forward name=success path=/customers.jsp/
  
   /action
  
   !-- Edit customer --

Re: URL encoded request parameters

2001-05-30 Thread Helmut Rubasch

Hi!

I don't know, if this is what you are looking for, but usually to decode 
URL-Encoded Strings you would use

String decodedString=java.net.URLDecoder.decode(encodedString);


Helmut Rubasch



At 09:31 30.05.2001 +0200, you wrote:
hi
How can I read request parameters with URL encoding from a FormBean?

Jan Fredrik

 ___ Jan Fredrik Øveraasen | Senior Systems Developer
 ___ Cell Network ASA | Pb. 5313, Sørkedalsv. 10A, N-0304 Oslo,
Norway
 ___ Tel: +47 23196600/35 | Fax: +47 23196601 | Mob: +47 93 49 99 88
___ http://www.cellnetwork.com/ |
mailto:[EMAIL PROTECTED]






RE: How do i use entity beans in Action class

2001-05-30 Thread Jon.Ridgway









Hi Ameer,



Can you be more specific about the error,
do you get it after deployment or during compilation? Can you provide a stack
trace ? 



Jon.



-Original Message-
From: ameer
[mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 04:55
To: Struts
Subject: How do i use entity beans
in Action class





I
am refering to an entity bean in Action class and im using struts frame work
for a simple web application on weblogic 6.0. im getting a malfunctioned
weblogic. xml descriptor error .. but when i check that file it sems to be ok.
what would be the error then 





Ameer
Hussain SS
s/w engineer
Yashaa Infotech Pvt.Ltd.
#14 , 10th Main, HAL 3rd Stage
Bangalore 560075
phone: 5294430/53 
http://www.yashaa.com










problem with using forms

2001-05-30 Thread René Boere

Hi,

i am trying to create a jsp page with a form on it using the Struts
framwork.
The problem is that i get an exception when i try to load the jsp page. The
error is the following:

May 30, 2001 11:53:31 AM GMT+02:00 Error HTTP
[WebAppServletContext(66629
69,form)] Root cause of ServletException
javax.servlet.jsp.JspException: Cannot find bean
org.apache.struts.taglib.html.B
EAN in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:486)
at
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.ja
va:188)
at jsp_servlet._form._jspService(_form.java:127)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:213)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:246)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)


I have also included the used files in this message.


I have no idea what causes this error and i hope anyone can help me with
this problem.

Greetings,
Rene Boere


web.xml
***
web-app
servlet
servlet-nameaction/servlet-name

servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
param-nameconfig/param-name

param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
param-namevalidate/param-name
param-valuetrue/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
/servlet-mapping

welcome-file-list
welcome-fileform.jsp/welcome-file
/welcome-file-list

taglib
taglib-uri/WEB-INF/struts-html.tld/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
/taglib
/web-app

***


struts-config.xml

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.0//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;

struts-config
form-beans
form-bean name=TestForm type=form.TestForm/
/form-beans

action-mappings
action path=/test type=form.TestAction
name=TestForm
forward name=test path=/test.jsp /
/action
/action-mappings
/struts-config
***

form.jsp
***
%@page language=java contentType=text/html%
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

html:form action=test.do/
test: html:text property=test/br
html:submit value=OK/
/form
***



RE: Server caught unhandled exception from servlet [jsp11]: cant remo ve Attributes from request scope

2001-05-30 Thread Jon.Ridgway

Hi Siva,

This is a problem that has been addressed on this list before. If I recall
the solution is a *hack* unfortunately. Edit
org.apache.struts.taglib.FormTag.doEndTag so the first two lines read : 

// Remove the page scope attributes we created
pageContext.removeAttribute(Constants.BEAN_KEY);
pageContext.removeAttribute(Constants.FORM_KEY);

This seems to resolve the issue, not sure if its the best way round it
however. 

Jon.

-Original Message-
From: Siva Chilukuri [mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 02:04
To: '[EMAIL PROTECTED]'
Subject: Server caught unhandled exception from servlet [jsp11]: cant remo
ve Attributes from request scope

Hi,

I tried to run struts example application in Websphere3.5.3.  It's
giving following error message. Any ideas how to correct this?

An error has occured while processing
request:http://localhost/struts-example/editRegistration.do
Message: Server caught unhandled exception from servlet [action]: Server
caught unhandled exception from servlet [jsp11]: cant remove Attributes from
request scope

Target Servlet: action
StackTrace: 


Root Error-1: cant remove Attributes from request scope

java.lang.IllegalArgumentException: cant remove Attributes from request
scope

Thanks
Siva

-Original Message-
From: Richard Backhouse [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 29, 2001 4:55 PM
To: [EMAIL PROTECTED]
Subject: Sample HDML/Wireless Struts Application


For anyone who is interested, I have put together a sample hdml/wireless
based 
struts application. 

You can get the source and a pre-build j2ee binary at :

http://www.oakgrovesoftware.com/~rbackhouse

It is a simple shared contact database that phone users can access and 
add/edit/delete contacts. You should be be able to getting it running with 
either the default setup of JBoss/Tomcat or Orion.

There is more information at the above link. 

Richard Backhouse
Oak Grove Software



RE: Multiple Buttons

2001-05-30 Thread Jon.Ridgway









Hi Steven,



There is probably a more *struts* oriented approach, but give your
buttons unique names, then in your action class perform method, call
request.getParameter (button name) if the value returned is not null,
then that button was clicked.



Jon.



-Original Message-
From: Steven Leija
[mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 02:54
To: Struts
Subject: Multiple Buttons





Hey All,











I'm working on creating a form that
has multiple buttons, and based on the button selected, different actions
occur. Is there a way to specify a value for a button and get that value
in the action class?











Thanks!











Steven










html:button and html:radio in 1.0b2

2001-05-30 Thread Klaus Thiele

Hello,

i'm currently switching our application from struts-0.5 to 1.0b2
and i have to made some stupid changes in some of my
jsp-pages:

1) html:radio accepts no 'tabindex'
2) html:button does not get his label from the tag-body (html:submit does it)

is there a reason for this changes?

thanks
  klaus

--
Klaus Thiele - Personal  Informatik AG
mailto:[EMAIL PROTECTED]

 Your mouse has moved.
  Windows must be restarted for the change to take effect.



RE: bean attributes not displaying - please help

2001-05-30 Thread Jon.Ridgway

Hi Thomas  Martin,

I believe this problem has been addressed on this list before, I can't
remember the solution but if you check the archive you should find it.

I think it has something to do with the reset method getting called. Store
your form under a unique tag in the request, then pop it off later. You
might also try setting redirect=false within your struts-config forward
directive i.e.:

forward name=name path=path redirect=false /

Jon.

-Original Message-
From: Thomas Peters [mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 02:01
To: [EMAIL PROTECTED]
Subject: Re: bean attributes not displaying - please help

Thanks for your reply...

I guessed that was the problem. I don't see the new instance being created
in my log file. I also have a fully working struts demo, which does not
display this behavior. What's up with that?

Tom

- Original Message -
From: Martin Zaidel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 29, 2001 6:49 PM
Subject: Re: bean attributes not displaying - please help


 I also have this problem, but alas, no solution (as yet).  I've even
 tried
 in struts-config.xml to set the scope of the actions to session, and
 have explicitly
 added the form to the session within the Action's perform().  I, too,
 can see the form properly populated.  However, when the form's jsp is
 called, a new Form instance is instantiatedthus, the displayed form
 is blank.

 Any ideas?

  Thomas Peters wrote:
 
  I have a jsp page called 'customer.jsp' with a class call
  'CustomerForm' which extendes ActionForm.
 
  I have cut and paste my mappings and listed them below.
 
  The application flow is such, that I have a link with a URI of
  /searchCustomers.do?action=Search. This action calls
  'CustomerSearchAction' which initializes a 'CustomerForm' with null
  values for all the attributes except action, that's defaulted to
  'Search'. That works fine.
 
  When the end user completes and submits the 'CustomerForm' form, I
  construct a query that returns a list of customers matching the
  submitted criteria. 'Customers' is a class which contains a Hashtable
  of 'Customer' objects. This is accomplished with 'CustomerListAction'
  and forwards to 'customers.jsp' which presents the results in a list.
  I have a 'LinkCustomerTag' class which builds links within the
  iteration of 'customers' on the 'customers.jsp' page. The link looks
  like this: '/editCustomer.do?action=EditcustNum=10' where
  'custNum=10' dynamically changes throughout the iteration based on the
  current 'customer'. This works fine too.
 
  I select one of the links in the list which maps to '/editCustomer'
  (see below) and calls the 'CustomerEditAction' class where I copy the
  properties to the instance of 'CustomerForm' and 'forward' to the
  'customer.jsp'. This is where my problem is.
 
   ** The form is blank. **
 
  I have lotts of comments in my code and can see that
  'PropertyUtils.copyProrerties(customerForm, customer)' is getting
  called. I even modified the 'PropertyUtils' class to log the
  properties being copied within the 'Enumeration' in the
  'copyProperties' method. You can see these values being copied into
  the 'ActionForm' but when the 'forward' is called and the
  'customer.jsp' is displayed, it is empty.
 
  Please help...
 
 
  
  struts-config.xml
  
 
 
!-- == Form Bean Definitions
  === --
 
  !-- Customer form bean --
  form-bean  name=customerForm
  type=CustomerForm/
 
  !-- Customer list bean --
  form-bean  name=customerList
  type=CustomerForm/
  .
  .
  .
  .
 
!-- == Action Mapping Definitions
  == --
  !-- Search customer --
  actionpath=/searchCustomer
 type=CustomerSearchAction
 name=customerForm
scope=request
input=/customer.jsp
forward name=success path=/customer.jsp/
  /action
 
  !-- List customers --
  actionpath=/listCustomers
 type=CustomerListAction
 name=customerList
scope=request
forward name=success path=/customers.jsp/
 
  /action
 
  !-- Edit customer --
  actionpath=/editCustomer
 type=CustomerEditAction
 name=customerForm
scope=request
 validate=false
forward name=failure  path=/customers.jsp/
forward name=success  path=/customer.jsp/
  /action

 --
 Martin Zaidel,
 Senior Software Engineer
 Cortex eBusiness P/L, Melbourne
 www.cortexebusiness.com.au




RE: Form tag problem in VAJ 3.5.3 WTE with 1.0b2

2001-05-30 Thread Jon.Ridgway









Hi All,



Opps and apologies, adding a getRequest may
resolve this little one, I tried editing org.apache.struts.taglib.FormTag.doEndTag
as follows : 



// Remove the page scope attributes we
created

pageContext.getRequest().removeAttribute(Constants.BEAN_KEY);

pageContext.getRequest().removeAttribute(Constants.FORM_KEY);



And when I called :



Object o = pageContext.getRequest().getAttribute(Constants.BEAN_KEY);




Got null as I would
expect.



Jon.



-Original Message-
From: Daniel Benzimra-Ceuppens
[mailto:[EMAIL PROTECTED]] 
Sent: 29 May 2001 19:38
To:
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Form tag problem in VAJ
3.5.3 WTE with 1.0b2





Hello,











I had the same problems with WAS
3.5.3. I did try the solution proposed by Jon. It works but without
doing anything: the attributes are still there.In other words, commenting
out the 2 lines completely has exactly the same effect.

















With best regards, 



Daniel. 

-
Daniel Ceuppens
GSM
Ltd. 

[M] +972-54-905-312
[F] +972-3-916-0037
[E] [EMAIL PROTECTED]
- 














Ideas (and a quick implementation) for extending Struts

2001-05-30 Thread SRadford

All,

If anyone read my last (and first) posting to the list they'll know that
I'm new to Struts. Anyway, after deciding to plan on using Struts in my
next project, I felt that for the application many Beans would be required
for the many, many, many, forms. All of which will need extensive
validation. So I decided that ideally one shouldn't need to define a Bean
for each form, only define the data on the form to be picked up by the
ActionServlet, validated and then passed to the custom Action class.
Anyway, I thought that it would be a lot of work to implement and also read
the current plans for version 1.1 (of Struts) and came up with a half-way
house, for us in the interim.

However, at the w/e I got bored and ended up writing my initial design and
it is already just about useable. It's not complete and I'm sure there's
lots of missing pieces and bugs. I intend to carry on with it this week as
much as I can, but thought I'd just pass on more about it. Once it is more
useable I'll willingly pass on the code to others, but it can't be easily
back-engineered into newer releases of Struts, and I don't really want to
spark any code-forking. But at the least it may spark some ideas for the
Struts developers. My implementation of course is very rough and there are
much better ways to do it, and I'm in no doubt that the team (knowing the
framework inside-out) could do it much better. (I also have other ideas
that would be cool too)

Anyway, he's how it is used:
(I've directly re-coded existing classes where necessary, and also made a
new package. All original Struts functionality remains - I hope!.)

1. in the struts-config.xml file you have a definition for your forms, e.g.

  action-mappings
action path=/order
type=com.bar.fu.OrderAction
 name=orderForm
 input=/order.jsp 
  forward name=success path=/confirmOrder.jsp /
/action
  /action-mappings
data-mappings
data-mapping name=orderForm
  property-mapping viewName=customerID modelName=customerID type
=int required=true /
  property-mapping viewName=productID modelName=productID type
=int required=true /
  property-mapping viewName=price modelName=price type=float
required=true regExpr= /
/data-mapping
/data-mappings

An additional property-mapping attribute is 'defaultValue'.

2. If validation is specified in web.xml then each data value is validated
according to the data-type to be converted to and any regular expressions
given (haven't implemented the regExp bit yet). Failure naturally takes the
user back to the 'input' page (in the action-mappings).

3. All that happens then is that the ActionForm given in Action.process()
is a subclass called org.apache.struts.data.DataForm which is a 'glorified
Hashtable' of the values defined in the data-mapping for that form.

4. There will also be populate and extract methods on the DataForm class to
automatically 'move' values to and from the DataForm and a Bean (or EJB)
given.


Using this extension to Struts will greatly speed the development of our
next project, but it would be good if something like it could be
incorporated into the original code-stream.


Anyway, if people are interested in it then let me know and once I've put
some more work into it I'll be happy to pass it on.


Regards,



Sean

--
Dr Sean Radford, MBBS, MSc
Senior Consultant
Agora Professional Services Ltd
[EMAIL PROTECTED]
http://www.agora.co.uk




Fw: How do i use entity beans in Action class

2001-05-30 Thread ameer




Hi Jon, thanx for replying . i am facing 
problems in deployment descriptor .. compilation is fine and the application is 
getting deployed. im refering to entity bean inmy action class and i am 
facing problems like 
May 30, 2001 5:09:39 PM 
GMT+05:30 Error Kernel ExecuteRequest 
failedjava.lang.IllegalArgumentException: bad URLMatchMap path: 
'' at 
weblogic.servlet.utils.URLMatchMap.get(URLMatchMap.java:196) 
at 
weblogic.servlet.security.internal.WebAppSecurity.getConstraint(WebAppSecurity.java:135) 
at 
weblogic.servlet.security.internal.SecurityModule.checkTransport(SecurityModule.java:177) 
at 
weblogic.servlet.security.internal.BasicSecurityModule.checkA(BasicSecurityModule.java:48) 
at 
weblogic.servlet.security.internal.ServletSecurityManager.checkAccess(ServletSecurityManager.java:150) 
at 
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1250) 
at 
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1622) 
at 
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) 
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

with regards and thanx.
Ameer Hussain SSs/w 
engineerYashaa Infotech Pvt.Ltd.#14 , 10th Main, HAL 3rd 
StageBangalore 560075phone: 5294430/53 http://www.yashaa.com


template and I18N

2001-05-30 Thread Gregor Rayman

Hi all, 

I've just started to use Struts and I have some questions:


1. How can I use the I18N features in the template tags?

In my template.jsp I've got the following tag:

titletemplate:get name='title'//title

In the page using this teplate the following:

template:put name='title' content='Kalkulation' direct='true'/

I'd like to replace the German text 'Kalkulation' with its
key e.g. 'app.title.calculation' Is there a nice way to do this?



2. How can I use use the I18N features in Struts directly
in Java Scriplets? 

Sometimes I need the translated texts in scriplets. What is 
the best way to access them?

Now I am using this aproach:

%

  MessageResources resources =
(MessageResources) pageContext.getAttribute(
Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE);

  Locale locale = 
(Locale) pageContext.getAttribute(
   Action.LOCALE_KEY, PageContext.SESSION_SCOPE);

  if (null == locale) {
locale = request.getLocale();
  }

  String myText = resources.getMessage(locale, app.the.text,key);

%

Thanks for an answer

--
gR








use JSP variable as a value of property in html:select ... tag

2001-05-30 Thread someil

Hi,

I would like use an expression such as :
html:select property=%= var% size=1
but I can't do this.

The error obtained is : Attribute value should be quoted

So, I tried : html:select property=%= var% size=1
then it results a new error : Attribute % has no value

that is the problem?
How can I consider a JSP variable for an attribute value?

Thanks for your response ...

- Cyril -



Re: Sample HDML/Wireless Struts Application

2001-05-30 Thread Jeff Trent

Never wrote a wireless app, but the code looks real nice...

- Original Message -
From: Richard Backhouse [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 29, 2001 7:55 PM
Subject: Sample HDML/Wireless Struts Application


 For anyone who is interested, I have put together a sample hdml/wireless
based
 struts application.

 You can get the source and a pre-build j2ee binary at :

 http://www.oakgrovesoftware.com/~rbackhouse

 It is a simple shared contact database that phone users can access and
 add/edit/delete contacts. You should be be able to getting it running with
 either the default setup of JBoss/Tomcat or Orion.

 There is more information at the above link.

 Richard Backhouse
 Oak Grove Software





RE: template and I18N

2001-05-30 Thread Johan Compagner

look at the bean:message tag:

bean:message key=title/

johan


 -Original Message-
 From: Gregor Rayman [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 30, 2001 2:12 PM
 To: [EMAIL PROTECTED]
 Subject: template and I18N
 
 
 Hi all, 
 
 I've just started to use Struts and I have some questions:
 
 
 1. How can I use the I18N features in the template tags?
 
 In my template.jsp I've got the following tag:
 
 titletemplate:get name='title'//title
 
 In the page using this teplate the following:
 
 template:put name='title' content='Kalkulation' direct='true'/
 
 I'd like to replace the German text 'Kalkulation' with its
 key e.g. 'app.title.calculation' Is there a nice way to do this?
 
 
 
 2. How can I use use the I18N features in Struts directly
 in Java Scriplets? 
 
 Sometimes I need the translated texts in scriplets. What is 
 the best way to access them?
 
 Now I am using this aproach:
 
 %
 
   MessageResources resources =
 (MessageResources) pageContext.getAttribute(
 Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE);
 
   Locale locale = 
 (Locale) pageContext.getAttribute(
Action.LOCALE_KEY, PageContext.SESSION_SCOPE);
 
   if (null == locale) {
 locale = request.getLocale();
   }
 
   String myText = resources.getMessage(locale, app.the.text,key);
 
 %
 
 Thanks for an answer
 
 --
 gR
 
 
 
 
 



Re: template and I18N

2001-05-30 Thread Gregor Rayman

Johan Compagner [EMAIL PROTECTED] writes:


 look at the bean:message tag:
 
 bean:message key=title/
 
 johan

Hi Johan, 

this does not help me. bean:message key=title / prints 
the internationalized word Title. But I want to use it in
the template to print various titles. 


Example (without the headers):

ApplicationResources.properties
===

app.login=Login
app.logout=Logout

ApplicationResources_de.properties
==

app.login=Anmelden
app.logout=Abmelden


now the template files:

template.jsp


...
headtitletemplate:get name=title //title/head
...


login.jsp
=

template:insert template='/template.jsp'
  template:put name='title' content='Login' direct='true'/
  ...
/template:insert


logout.jsp
==

template:insert template='/template.jsp'
  template:put name='title' content='Logout' direct='true'/
  ...
/template:insert


As you can see, I have to insert the words Login and Logout 
into the files login.jsp and logout.jsp literally, instead of
inserting the keys app.login and app.logout


Of course I could use the scripplet approach and use


template:put name='title' 
  content='%= resources.getMessage(locale, app.login) %'
  direct='true' /

instead. But is there a nicer way?

Something like: 

template:put name='title' direct='true'
bean:message key='app.login' /
/template:put


Groetjes

--
gR






RE: template and I18N

2001-05-30 Thread Alexander Jesse

try 
bean:message key=%= title % /
== call teh bean and pass the key using a jsp-value

good luck
Alexander

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 3:02 PM
To: [EMAIL PROTECTED]
Subject: Re: template and I18N


Johan Compagner [EMAIL PROTECTED] writes:


 look at the bean:message tag:
 
 bean:message key=title/
 
 johan

Hi Johan, 

this does not help me. bean:message key=title / prints 
the internationalized word Title. But I want to use it in
the template to print various titles. 


Example (without the headers):

ApplicationResources.properties
===

app.login=Login
app.logout=Logout

ApplicationResources_de.properties
==

app.login=Anmelden
app.logout=Abmelden


now the template files:

template.jsp


...
headtitletemplate:get name=title //title/head
...


login.jsp
=

template:insert template='/template.jsp'
  template:put name='title' content='Login' direct='true'/
  ...
/template:insert


logout.jsp
==

template:insert template='/template.jsp'
  template:put name='title' content='Logout' direct='true'/
  ...
/template:insert


As you can see, I have to insert the words Login and Logout 
into the files login.jsp and logout.jsp literally, instead of
inserting the keys app.login and app.logout


Of course I could use the scripplet approach and use


template:put name='title' 
  content='%= resources.getMessage(locale, app.login) %'
  direct='true' /

instead. But is there a nicer way?

Something like: 

template:put name='title' direct='true'
bean:message key='app.login' /
/template:put


Groetjes

--
gR





Which component employs the template:put tags ??

2001-05-30 Thread Jonathan Asbell



is this template tag part of Struts?

template:put 
...


RE: problem with using forms

2001-05-30 Thread Jon.Ridgway

Hi Rene,

A quick glance and I can't see anything wrong in your conf files. Have you
got the examples app to work? I ask because I suspect you have a classpath
issue. What web server are you using?

Jon.

-Original Message-
From: René Boere [mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 10:59
To: '[EMAIL PROTECTED]'
Subject: problem with using forms

Hi,

i am trying to create a jsp page with a form on it using the Struts
framwork.
The problem is that i get an exception when i try to load the jsp page. The
error is the following:

May 30, 2001 11:53:31 AM GMT+02:00 Error HTTP
[WebAppServletContext(66629
69,form)] Root cause of ServletException
javax.servlet.jsp.JspException: Cannot find bean
org.apache.struts.taglib.html.B
EAN in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:486)
at
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.ja
va:188)
at jsp_servlet._form._jspService(_form.java:127)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:213)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:246)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)


I have also included the used files in this message.


I have no idea what causes this error and i hope anyone can help me with
this problem.

Greetings,
Rene Boere


web.xml
***
web-app
servlet
servlet-nameaction/servlet-name

servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
param-nameconfig/param-name

param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
param-namevalidate/param-name
param-valuetrue/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
/servlet-mapping

welcome-file-list
welcome-fileform.jsp/welcome-file
/welcome-file-list

taglib
taglib-uri/WEB-INF/struts-html.tld/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
/taglib
/web-app

***


struts-config.xml

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.0//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;

struts-config
form-beans
form-bean name=TestForm type=form.TestForm/
/form-beans

action-mappings
action path=/test type=form.TestAction
name=TestForm
forward name=test path=/test.jsp /
/action
/action-mappings
/struts-config
***

form.jsp
***
%@page language=java contentType=text/html%
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

html:form action=test.do/
test: html:text property=test/br
html:submit value=OK/
/form
***



RE: Which component employs the template:put tags ??

2001-05-30 Thread Jon.Ridgway









Hi Jonathan,



It certainly is. The template example
provided with struts shows how to use it. The role based templating is
particularly useful.



Jon.



-Original Message-
From: Jonathan Asbell
[mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 14:16
To: [EMAIL PROTECTED]
Subject: Which component employs
the template:put tags ??





is this template tag part of Struts?











template:put ...










RE: use JSP variable as a value of property in html:select ... tag

2001-05-30 Thread someil

any change with : html:select property='%= var%' size=1

there is still an error : Attribute % has no value

- Cyril -

-Message d'origine-
De : Mikkel Bruun [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 30 mai 2001 14:58
À : '[EMAIL PROTECTED]'
Objet : SV: use JSP variable as a value of property in html:select ...
tag


use single qoutes ''

Mikkel

-Oprindelig meddelelse-
Fra: someil [mailto:[EMAIL PROTECTED]]
Sendt: 30 May 2001 14:42
Til: [EMAIL PROTECTED]
Emne: use JSP variable as a value of property in html:select ... tag


Hi,

I would like use an expression such as :
html:select property=%= var% size=1
but I can't do this.

The error obtained is : Attribute value should be quoted

So, I tried : html:select property=%= var% size=1
then it results a new error : Attribute % has no value

that is the problem?
How can I consider a JSP variable for an attribute value?

Thanks for your response ...

- Cyril -




Re: Resources clarification :^)

2001-05-30 Thread Peter Alfors

You could combine all of your property files during your build.
This would allow you to have as many different property files as you
want.
However, you need to be careful that you do not have duplicate names
across multiple files.

HTH,
Pete

Jonathan wrote:

 Hello all.  It appears that the ActionServlet points to a resources
 file, and not a ResourceBundle object. Is this true?  The reason is
 that I would like to group in the same directory the following:1) a
 particular ActionForm2) the Action class that works with that
 ActionForm3) the resources (strings) that work with that
 ActionForm The reason is that it is much easier to manage the
 artifacts on a page by page basis.How can I do this
 properly ThanksJonathan


begin:vcard 
n:;
x-mozilla-html:FALSE
org:BRIMG SRC=http://www.irista.com/logo/irista.gif;BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain
adr:;;
version:2.1
end:vcard



RE: problem with using forms

2001-05-30 Thread René Boere

Hi Jon,

The example applications are working fine, so the classpath is correctly
set.
I have isolated this problem to the html:text tag in my JSP file. If i
remove this line from the JSP file it shows correctly.

The second problem i have with this test jsp file is that when I press the
submit button, nothing happens.

Rene

-Original Message-
From: Jon.Ridgway [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 15:22
To: [EMAIL PROTECTED]
Subject: RE: problem with using forms


Hi Rene,

A quick glance and I can't see anything wrong in your conf files. Have you
got the examples app to work? I ask because I suspect you have a classpath
issue. What web server are you using?

Jon.

-Original Message-
From: René Boere [mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 10:59
To: '[EMAIL PROTECTED]'
Subject: problem with using forms

Hi,

i am trying to create a jsp page with a form on it using the Struts
framwork.
The problem is that i get an exception when i try to load the jsp page. The
error is the following:

May 30, 2001 11:53:31 AM GMT+02:00 Error HTTP
[WebAppServletContext(66629
69,form)] Root cause of ServletException
javax.servlet.jsp.JspException: Cannot find bean
org.apache.struts.taglib.html.B
EAN in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:486)
at
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.ja
va:188)
at jsp_servlet._form._jspService(_form.java:127)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:213)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:246)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)


I have also included the used files in this message.


I have no idea what causes this error and i hope anyone can help me with
this problem.

Greetings,
Rene Boere


web.xml
***
web-app
servlet
servlet-nameaction/servlet-name

servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
param-nameconfig/param-name

param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
param-namevalidate/param-name
param-valuetrue/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
/servlet-mapping

welcome-file-list
welcome-fileform.jsp/welcome-file
/welcome-file-list

taglib
taglib-uri/WEB-INF/struts-html.tld/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
/taglib
/web-app

***


struts-config.xml

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.0//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;

struts-config
form-beans
form-bean name=TestForm type=form.TestForm/
/form-beans

action-mappings
action path=/test type=form.TestAction
name=TestForm
forward name=test path=/test.jsp /
/action
/action-mappings
/struts-config
***

form.jsp
***
%@page language=java contentType=text/html%
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

html:form action=test.do/
test: html:text property=test/br
html:submit value=OK/
/form
***



RE: problem with using forms

2001-05-30 Thread du Clos, John

I received this error message when i didn't have my form bean class compiled
and created in the package as specified in the type attribute of the
form-bean tag definition of the struts-config.xml file  I noticed your
definition is as follows:

form-beans
form-bean name=TestForm type=form.TestForm/
/form-beans

Is form your package name for your TestForm bean form?   Based on this
definition, it looks like form is the package name for TestForm.

Not sure if this is your problem, but make sure your form bean is created
for the corresponding jsp with the correct package name AND make sure you
place your package (including classes) in your WEB-INF\classes directory.   

JD

-Original Message-
From: Jon.Ridgway [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 9:22 AM
To: [EMAIL PROTECTED]
Subject: RE: problem with using forms


Hi Rene,

A quick glance and I can't see anything wrong in your conf files. Have you
got the examples app to work? I ask because I suspect you have a classpath
issue. What web server are you using?

Jon.

-Original Message-
From: René Boere [mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 10:59
To: '[EMAIL PROTECTED]'
Subject: problem with using forms

Hi,

i am trying to create a jsp page with a form on it using the Struts
framwork.
The problem is that i get an exception when i try to load the jsp page. The
error is the following:

May 30, 2001 11:53:31 AM GMT+02:00 Error HTTP
[WebAppServletContext(66629
69,form)] Root cause of ServletException
javax.servlet.jsp.JspException: Cannot find bean
org.apache.struts.taglib.html.B
EAN in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:486)
at
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.ja
va:188)
at jsp_servlet._form._jspService(_form.java:127)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:213)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:246)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)


I have also included the used files in this message.


I have no idea what causes this error and i hope anyone can help me with
this problem.

Greetings,
Rene Boere


web.xml
***
web-app
servlet
servlet-nameaction/servlet-name

servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
param-nameconfig/param-name

param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
param-namevalidate/param-name
param-valuetrue/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
/servlet-mapping

welcome-file-list
welcome-fileform.jsp/welcome-file
/welcome-file-list

taglib
taglib-uri/WEB-INF/struts-html.tld/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
/taglib
/web-app

***


struts-config.xml

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.0//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;

struts-config
form-beans
form-bean name=TestForm type=form.TestForm/
/form-beans

action-mappings
action path=/test type=form.TestAction
name=TestForm
forward name=test path=/test.jsp /
/action
/action-mappings
/struts-config
***

form.jsp
***
%@page language=java contentType=text/html%
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

html:form action=test.do/
test: html:text property=test/br
html:submit value=OK/
/form
***



RE: problem with using forms

2001-05-30 Thread René Boere

I am pretty sure that the TestForm class is correctly compiled in the
correct directory

to be sure i have listed the contents of the form.war i have deployed in
WL6.0

filesystem.attributes
form.jsp
test.jsp
META-INF\MANIFEST.MF
WEB-INF\struts-config.xml
WEB-INF\struts-html.tld
WEB-INF\web.xml
WEB-INF\classes\form\filesystem.attributes
WEB-INF\classes\form\TestAction.class
WEB-INF\classes\form\TestAction.java
WEB-INF\classes\form\TestForm.class
WEB-INF\classes\form\TestForm.java
WEB-INF\lib\struts.jar


There is also an instance created of the TestForm bean. I know that because
of the System.out.println line in the constructor, which displayes
construction info in the weblogic server window.

Rene
-Original Message-
From: du Clos, John [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 15:36
To: '[EMAIL PROTECTED]'
Subject: RE: problem with using forms


I received this error message when i didn't have my form bean class compiled
and created in the package as specified in the type attribute of the
form-bean tag definition of the struts-config.xml file  I noticed your
definition is as follows:

form-beans
form-bean name=TestForm type=form.TestForm/
/form-beans

Is form your package name for your TestForm bean form?   Based on this
definition, it looks like form is the package name for TestForm.

Not sure if this is your problem, but make sure your form bean is created
for the corresponding jsp with the correct package name AND make sure you
place your package (including classes) in your WEB-INF\classes directory.   

JD

-Original Message-
From: Jon.Ridgway [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 9:22 AM
To: [EMAIL PROTECTED]
Subject: RE: problem with using forms


Hi Rene,

A quick glance and I can't see anything wrong in your conf files. Have you
got the examples app to work? I ask because I suspect you have a classpath
issue. What web server are you using?

Jon.

-Original Message-
From: René Boere [mailto:[EMAIL PROTECTED]] 
Sent: 30 May 2001 10:59
To: '[EMAIL PROTECTED]'
Subject: problem with using forms

Hi,

i am trying to create a jsp page with a form on it using the Struts
framwork.
The problem is that i get an exception when i try to load the jsp page. The
error is the following:

May 30, 2001 11:53:31 AM GMT+02:00 Error HTTP
[WebAppServletContext(66629
69,form)] Root cause of ServletException
javax.servlet.jsp.JspException: Cannot find bean
org.apache.struts.taglib.html.B
EAN in scope null
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:486)
at
org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.ja
va:188)
at jsp_servlet._form._jspService(_form.java:127)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:213)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:246)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:1265)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:1622)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)


I have also included the used files in this message.


I have no idea what causes this error and i hope anyone can help me with
this problem.

Greetings,
Rene Boere


web.xml
***
web-app
servlet
servlet-nameaction/servlet-name

servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
param-nameconfig/param-name

param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
param-namevalidate/param-name
param-valuetrue/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
/servlet-mapping

welcome-file-list
welcome-fileform.jsp/welcome-file
/welcome-file-list

taglib
taglib-uri/WEB-INF/struts-html.tld/taglib-uri
taglib-location/WEB-INF/struts-html.tld/taglib-location
/taglib
/web-app

***


struts-config.xml

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.0//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;

struts-config
form-beans
form-bean name=TestForm type=form.TestForm/
/form-beans

action-mappings
action path=/test type=form.TestAction
name=TestForm

RE: html:button and html:radio in 1.0b2

2001-05-30 Thread Deadman, Hal

I think problem 1 was fixed last night. Problem 2 was an accidental
regression and has been reported as a bug.

 -Original Message-
 From: Klaus Thiele [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 30, 2001 6:20 AM
 To: STRUTS-USER
 Subject: html:button and html:radio in 1.0b2


 Hello,

 i'm currently switching our application from struts-0.5 to 1.0b2
 and i have to made some stupid changes in some of my
 jsp-pages:

 1) html:radio accepts no 'tabindex'
 2) html:button does not get his label from the tag-body
 (html:submit does it)

 is there a reason for this changes?

 thanks
   klaus

 --
 Klaus Thiele - Personal  Informatik AG
 mailto:[EMAIL PROTECTED]

  Your mouse has moved.
   Windows must be restarted for the change to take effect.




generate ActionForms

2001-05-30 Thread Michael Schommer

Hi,

I want to generate the ActionForm-classes.
Do somebody know something about tools to generate Java-classes?


Gruß
Michael

--
Java - write once, run anywhere





Re: generate ActionForms

2001-05-30 Thread SRadford


TogetherJ by togethersoft will (www.togethersoft.com)

They have a free 'lightweight' version that will do what you want.

Regards,

Sean

--
Dr Sean Radford, MBBS, MSc
Senior Consultant
Agora Professional Services Ltd
[EMAIL PROTECTED]
http://www.agora.co.uk




   
   
Michael Schommer 
   
Michael.Schommer@ferTo: 
[EMAIL PROTECTED]   
nbach.com   cc:   
   
 Subject: generate ActionForms 
   
30/05/2001 15:56   
   
Please respond to  
   
struts-user
   
   
   
   
   




Hi,

I want to generate the ActionForm-classes.
Do somebody know something about tools to generate Java-classes?


Gruß
Michael

--
Java - write once, run anywhere








Re: Solution: bean attributes not displaying (please comment)

2001-05-30 Thread Thomas Peters

The struts documentation indicates that 'mapping.getAttribute()' returns the
mapping name. In the case of the perform method in an Action instance, this
is a passed in property.

Therefore, 'request.removeAttribute(mapping,getAttribute())' removes the
stored attribute from the request context where attribute is the name of the
mapping.

This would have been stored in the request context in some previous step.
However, in the case that the mapping.getScope() doesn't return 'request' it
is removed from the session scope.


- Original Message -
From: Martin Zaidel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 12:12 AM
Subject: Solution: bean attributes not displaying (please comment)


 Got it:  My problem resided in these lines of code in perform() (which I
 copied from an Action class in the struts-example):

if (mapping.getAttribute() != null) {
if (request.equals(mapping.getScope()))
request.removeAttribute(mapping.getAttribute());
else
session.removeAttribute(mapping.getAttribute());
}

 So my question to the list is: what exactly are these lines doing?

 Thanks,
 Martin

 Thomas Peters wrote:
 
  Thanks for your reply...
 
  I guessed that was the problem. I don't see the new instance being
created
  in my log file. I also have a fully working struts demo, which does not
  display this behavior. What's up with that?
 
  Tom
 
  - Original Message -
  From: Martin Zaidel [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, May 29, 2001 6:49 PM
  Subject: Re: bean attributes not displaying - please help
 
   I also have this problem, but alas, no solution (as yet).  I've even
   tried
   in struts-config.xml to set the scope of the actions to session, and
   have explicitly
   added the form to the session within the Action's perform().  I, too,
   can see the form properly populated.  However, when the form's jsp is
   called, a new Form instance is instantiatedthus, the displayed
form
   is blank.
  
   Any ideas?
  
Thomas Peters wrote:
   
I have a jsp page called 'customer.jsp' with a class call
'CustomerForm' which extendes ActionForm.
   
I have cut and paste my mappings and listed them below.
   
The application flow is such, that I have a link with a URI of
/searchCustomers.do?action=Search. This action calls
'CustomerSearchAction' which initializes a 'CustomerForm' with null
values for all the attributes except action, that's defaulted to
'Search'. That works fine.
   
When the end user completes and submits the 'CustomerForm' form, I
construct a query that returns a list of customers matching the
submitted criteria. 'Customers' is a class which contains a
Hashtable
of 'Customer' objects. This is accomplished with
'CustomerListAction'
and forwards to 'customers.jsp' which presents the results in a
list.
I have a 'LinkCustomerTag' class which builds links within the
iteration of 'customers' on the 'customers.jsp' page. The link looks
like this: '/editCustomer.do?action=EditcustNum=10' where
'custNum=10' dynamically changes throughout the iteration based on
the
current 'customer'. This works fine too.
   
I select one of the links in the list which maps to '/editCustomer'
(see below) and calls the 'CustomerEditAction' class where I copy
the
properties to the instance of 'CustomerForm' and 'forward' to the
'customer.jsp'. This is where my problem is.
   
 ** The form is blank. **
   
I have lotts of comments in my code and can see that
'PropertyUtils.copyProrerties(customerForm, customer)' is getting
called. I even modified the 'PropertyUtils' class to log the
properties being copied within the 'Enumeration' in the
'copyProperties' method. You can see these values being copied into
the 'ActionForm' but when the 'forward' is called and the
'customer.jsp' is displayed, it is empty.
   
Please help...
   
   

struts-config.xml

   
   
  !-- == Form Bean Definitions
=== --
   
!-- Customer form bean --
form-bean  name=customerForm
type=CustomerForm/
   
!-- Customer list bean --
form-bean  name=customerList
type=CustomerForm/
.
.
.
.
   
  !-- == Action Mapping Definitions
== --
!-- Search customer --
actionpath=/searchCustomer
   type=CustomerSearchAction
   name=customerForm
  scope=request
  input=/customer.jsp
  forward name=success path=/customer.jsp/
/action
   
!-- List customers --
actionpath=/listCustomers
   type=CustomerListAction

Any hosting sites that use Struts?

2001-05-30 Thread Jeff Trent



Anyone know of a hosting facility that offers Java 
web hosting + Struts?



RE: Any hosting sites that use Struts?

2001-05-30 Thread TJM Todd McGregor

Check out MMA Web at http://www.mmaweb.com/ http://www.mmaweb.com/ . They
offer hosting accounts with a private VM so you can install Struts on your
own. They also have support for Cocoon.

-Original Message-
From: Jeff Trent [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 9:12 AM
To: [EMAIL PROTECTED]
Subject: Any hosting sites that use Struts?


Anyone know of a hosting facility that offers Java web hosting + Struts?
 




Multipart and IIS

2001-05-30 Thread Michael Binette

I just created a jsp page with a html:file tag on it, setup the ActionForm
to accept the file, etc.  The Action class gets called, I do what I need to
do with the file and then return mapping.findForward(success).

The mapping is returning /admin/index.jsp which is correct.  In
struts-config, I have redirect=true for the success forward.

When doing this on my devl machine, using Tomcat as my http and jsp server,
it works fine.

When doing this on our production system with IIS 5.0 as my http and Tomcat
3.2.1 as the jsp server, it fails.  The redirect is failing.  If I change it
to not redirect but forward, it works.  Or, if I take out the
enctype=multipart/form-data from the posting page, the redirect works as
well.

Has anyone seen this?  Am I explaining it well enough?

--
Thanks,
Michael Binette




Re: Any hosting sites that use Struts?

2001-05-30 Thread Anders K. Olsen

You can take a look at http://www.webappcabaret.com

I don't have any experience with their service.

/Anders.

- Original Message - 
From: Jeff Trent 
To: [EMAIL PROTECTED] 
Sent: Wednesday, May 30, 2001 6:12 PM
Subject: Any hosting sites that use Struts?


Anyone know of a hosting facility that offers Java web hosting + Struts?



RE: Any hosting sites that use Struts?

2001-05-30 Thread Deadman, Hal



I 
looked around for sites that host jsp/servlet based apps awhile ago and came up 
with these links:

http://www.irdesign.com/services/hosting/website_hosting.html
http://www.hostjsp.com/
http://www.mmaweb.net/
http://www.servlets.net/index.html
http://www.infinitehost.com/

I 
can't vouch for any of them. I would be interested in hearing feedback about 
these providers or other options. 

Hal


  -Original Message-From: Jeff Trent 
  [mailto:[EMAIL PROTECTED]]Sent: Wednesday, May 30, 2001 12:12 
  PMTo: [EMAIL PROTECTED]Subject: Any hosting 
  sites that use Struts?
  Anyone know of a hosting facility that offers 
  Java web hosting + Struts?
  


Re: getting a specific ArrayList element

2001-05-30 Thread David Winterfeldt

The iterate tag has 'offset' and 'length' as
attributes.  You should be able to use both of these
to retrieve a specific element.

http://jakarta.apache.org/struts/struts-logic.html#iterate

length - The maximum number of entries (from the
underlying collection) to be iterated through on this
page. This can be either an integer that directly
expresses the desired value, or the name of a JSP bean
(in any scope) of type java.lang.Integer that defines
the desired value. If not present, there will be no
limit on the number of iterations performed.
[RT Expr]  

offset - The zero-relative index of the starting point
at which entries from the underlying collection will
be iterated through. This can be either an integer
that directly expresses the desired value, or the name
of a JSP bean (in any scope) of type java.lang.Integer
that defines the desired value. If not present, zero
is assumed (meaning that the collection will be
iterated from the beginning.
[RT Expr]  

David

--- Charlesworth, Chico
[EMAIL PROTECTED] wrote:
 
 To iterate through a java.util.ArrayList i use
 logic:iterate struts tag
 and that works fine ...
 
 but which tag do i need to use and what attribute
 settings do i need to
 access a specific ArrayList element?
 for example if i wanted to access the second element
 of my ArrayList using
 jsp, i would just do:
 
 %MyObject o = (MyObject) myArrayList.get(1);%
 
 Any ideas?
 chico
 
 
 
 -- 
 The content of this e-mail is confidential, may
 contain privileged material
 and is intended solely for the recipient(s) named
 above. If you receive this
 in error, please notify Software AG immediately and
 delete this e-mail.
 
 Software AG (UK) Limited
 Registered in England  Wales 1310740
 Registered Office: Hudson House, Hudson Way,
 Pride Park, Derby DE24 8HS


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



RE: Any hosting sites that use Struts?

2001-05-30 Thread Thane Eisener



http://www.webappcabaret.com/

  -Original Message-From: Jeff Trent 
  [mailto:[EMAIL PROTECTED]]Sent: Wednesday, May 30, 2001 12:12 
  PMTo: struts-userSubject: Any hosting sites that use 
  Struts?
  Anyone know of a hosting facility that offers 
  Java web hosting + Struts?
  


SV: Any hosting sites that use Struts?

2001-05-30 Thread Mikkel Bruun



or www.aoindustries.com

Its 
run by (among others) a guynamed Dan. Until about a year ago Dan offered 
hosting for free!! including jsp, servlets, mysql to 
anybody
Unfortunaltely some punks took advantage of this, and used his servers in 
a DOS attack...
He the 
moved on and founded aoindustries

Nevertheless, I HAVE to recommend him because of his great 
initiative...

Mikkel

  -Oprindelig meddelelse-Fra: Deadman, Hal 
  [mailto:[EMAIL PROTECTED]]Sendt: 30 May 2001 
  18:22Til: [EMAIL PROTECTED]Emne: RE: Any 
  hosting sites that use Struts?
  I 
  looked around for sites that host jsp/servlet based apps awhile ago and came 
  up with these links:
  
  http://www.irdesign.com/services/hosting/website_hosting.html
  http://www.hostjsp.com/
  http://www.mmaweb.net/
  http://www.servlets.net/index.html
  http://www.infinitehost.com/
  
  I 
  can't vouch for any of them. I would be interested in hearing feedback about 
  these providers or other options. 
  
  Hal
  
  
-Original Message-From: Jeff Trent 
[mailto:[EMAIL PROTECTED]]Sent: Wednesday, May 30, 2001 12:12 
PMTo: [EMAIL PROTECTED]Subject: Any 
hosting sites that use Struts?
Anyone know of a hosting facility that offers 
Java web hosting + Struts?



problems with radio tag in html tag library

2001-05-30 Thread Cukovic, Mirela


I'm having problems using radio buttons on my jsp. One would expect it
to be very straight forward, and it is as long as I have just one group
of radio buttons (i.e. the same property). But for some reason, as soon
as I introduce another 'group' of radio buttons, it chokes at that tag.
Has anybody ever had any similar experience with radio tags? What
possibly am I doing wrong?
This is what I have:

[...in JSP...]
tr
  td width=197 valign=top
div align=leftMember Type:/div
  /td
  td width=442 valign=top
p
html:radio name=memberDetailsForm property=type
value=MEMBER/ Member br
html:radio name=memberDetailsForm property=type
value=GUEST/Guestbr
/p
  /td
/tr
 tr
  td width=197 valign=top
div align=leftWeb Enabled:/div
  /td
  td width=442 valign=top
p
html:radio name=memberDetailsForm property=web
value=YES/ Yes br
html:radio name=memberDetailsForm property=web
value=NO/No br
/p
  /td
 /tr
[...]
[...In memberDetailsForm]

private String type; //with setters and getters
private String web;




RE: getting a specific ArrayList element

2001-05-30 Thread Deadman, Hal

Each element in the collection is exposed as a bean with name determined by
the id attribute of the iterate tag. So inside your tag you can access
that bean in a scriptlet or with the bean:write tag. The bean will be of
type Object unless you use the type attribute of the iterate tag.

 -Original Message-
 From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 30, 2001 12:09 PM
 To: '[EMAIL PROTECTED]'
 Subject: getting a specific ArrayList element



 To iterate through a java.util.ArrayList i use
 logic:iterate struts tag
 and that works fine ...

 but which tag do i need to use and what attribute settings do
 i need to
 access a specific ArrayList element?
 for example if i wanted to access the second element of my
 ArrayList using
 jsp, i would just do:

 %MyObject o = (MyObject) myArrayList.get(1);%

 Any ideas?
 chico



 --
 The content of this e-mail is confidential, may contain
 privileged material
 and is intended solely for the recipient(s) named above. If
 you receive this
 in error, please notify Software AG immediately and delete
 this e-mail.

 Software AG (UK) Limited
 Registered in England  Wales 1310740
 Registered Office: Hudson House, Hudson Way,
 Pride Park, Derby DE24 8HS




RE: getting a specific ArrayList element

2001-05-30 Thread Charlesworth, Chico


excellent, missed that one, cheers
chico

-Original Message-
From: David Winterfeldt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 5:22 PM
To: [EMAIL PROTECTED]
Subject: Re: getting a specific ArrayList element


The iterate tag has 'offset' and 'length' as
attributes.  You should be able to use both of these
to retrieve a specific element.

http://jakarta.apache.org/struts/struts-logic.html#iterate

length - The maximum number of entries (from the
underlying collection) to be iterated through on this
page. This can be either an integer that directly
expresses the desired value, or the name of a JSP bean
(in any scope) of type java.lang.Integer that defines
the desired value. If not present, there will be no
limit on the number of iterations performed.
[RT Expr]  

offset - The zero-relative index of the starting point
at which entries from the underlying collection will
be iterated through. This can be either an integer
that directly expresses the desired value, or the name
of a JSP bean (in any scope) of type java.lang.Integer
that defines the desired value. If not present, zero
is assumed (meaning that the collection will be
iterated from the beginning.
[RT Expr]  

David

--- Charlesworth, Chico
[EMAIL PROTECTED] wrote:
 
 To iterate through a java.util.ArrayList i use
 logic:iterate struts tag
 and that works fine ...
 
 but which tag do i need to use and what attribute
 settings do i need to
 access a specific ArrayList element?
 for example if i wanted to access the second element
 of my ArrayList using
 jsp, i would just do:
 
 %MyObject o = (MyObject) myArrayList.get(1);%
 
 Any ideas?
 chico
 
 
 
 -- 
 The content of this e-mail is confidential, may
 contain privileged material
 and is intended solely for the recipient(s) named
 above. If you receive this
 in error, please notify Software AG immediately and
 delete this e-mail.
 
 Software AG (UK) Limited
 Registered in England  Wales 1310740
 Registered Office: Hudson House, Hudson Way,
 Pride Park, Derby DE24 8HS


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-- 
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England  Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS



Re: Question on the ActionForm design for dynamic data?

2001-05-30 Thread Jeff Trent

Here are two examples:

logic:iterate id=product name=products
html:multibox property=productsInstalled
bean:write name=product property=id/
/html:multibox
bean:write name=product property=name/br
/logic:iterate

This handles simple checkbox arrays.

---

However, if you want to have rows of data (more then just checkbox's), I
needed to do something like this:

% int i = 0; %
logic:iterate id=customerContact name=adminUpdateProfileForm
property=customerContacts
   tr
td class=smallFontinput type='text' name=customerContact[%= i
%].contactName value=%=
((com.domain.app.CustomerContact)customerContact).getContactName() %
size=20 maxlength=%= com.domain.app.CustomerContact.MAXLEN_CONTACTNAME
%/td
td class=smallFontinput type='text' name=customerContact[%= i
%].contactTitle value=%=
((com.domain.app.CustomerContact)customerContact).getContactTitle() %
size=30 maxlength=%= com.domain.app.CustomerContact.MAXLEN_CONTACTTITLE
%/td
td class=smallFontinput type='text' name=customerContact[%= i
%].contactPhone value=%=
((com.domain.app.CustomerContact)customerContact).getContactPhone() %
size=20 maxlength=%= com.domain.app.CustomerContact.MAXLEN_CONTACTPHONE
%/td
td class=smallFontinput type='text' name=customerContact[%= i
%].contactEmail value=%=
((com.domain.app.CustomerContact)customerContact).getContactEmail() %
size=20 maxlength=%= com.domain.app.CustomerContact.MAXLEN_CONTACTEMAIL
%/td
   /tr
   % i++; %
/logic:iterate

Not the prettiest, but it works.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 12:39 PM
Subject: Re: Question on the ActionForm design for dynamic data?


 Hi Jeff,

 Does this really work for you ? It works fine for me, to put the
information to
 the screen, but the setting of the data back to the form on the return
journey,
 does not work for me. If the automatic calling of the setters supposed to
work?

 I have code as below ... But the call
 getRow.getElementAt(X).setCounterpartySelected(true); does not get called
!!!
 In your example, are the text values in your form REALLY being updated ?

 % int i = 0; %
 logic:iterate name=CounterpartyFilterForm
property=counterpartyFilterRows
 id=row
 logic:equal name=row property=counterpartySelected value=true
 INPUT type=checkbox checked name=row[%= i
 %].counterpartySelected
 /logic:equal
 logic:equal name=row property=counterpartySelected value=false
 INPUT type=checkbox name=row[%= i %].counterpartySelected
 /logic:equal

 bean:write name=row property=counterpartyDisplayName/BR
 % i++; %
 /logic:iterate

 Thanks in advance
 Andre Glauser.

 --
--
 

(1) Have a Vector / Collection of contributors (ie.
 getContributors())
belonging to your form.  Inside that function, check to see
if
 you need
more rows by using code similar to the following:

public Vector getCustomerContacts()


CustomerContact lastCustomerContact =
(CustomerContact)this.customerContacts.lastElement();
if (!lastCustomerContact.isEmpty())
// is this slot being used?
this.customerContacts.addElement(new
 CustomerContact());
// always have one available slot at the end of the matrix

return this.customerContacts;
}

(2) Do not use the reset() method.

(3) On your JSP, use code like this:
% int i = 0; %
logic:iterate id=customerContact
 name=adminUpdateProfileForm
property=customerContacts
   tr
td class=smallFontinput type='text'
name=customerContact[%= i %].contactName value=%=

 ((com.domain.project.CustomerContact)customerContact).getContactName()
%/td
td class=smallFontinput type='text'
name=customerContact[%= i %].contactTitle value=%=

 ((com.domain.project.CustomerContact)customerContact).getContactTitle()
%/td
td class=smallFontinput type='text'
name=customerContact[%= i %].contactPhone value=%=

 ((com.domain.project.CustomerContact)customerContact).getContactPhone()
%/td
   /tr
   % i++; %
/logic:iterate

(4) Have a button on the form Add more rows in which case
the
 form
posts to itself and will cause a new row to be added at the
 bottom of
the grid.


Hope this help,
Jeff






redirect errors back to initial frame

2001-05-30 Thread dhay



Hi everyone.

I have the same problem that David Firmin posted back on the 8th March, but have
not seen any solution posted.

I have set the target frame in my html:form tag to be a different frame.
However, if errors occur with the first filter page, the errors should be
displayed in the original frame.

Does anyone know how to do this?  David, did you find any work around?

Many thanks,

Dave






extract key/value from HashMap

2001-05-30 Thread Steve A Drake


 Hello. I have a bean (referred to as resultBean) that contains a
HashMap (called properties) and would like to extract key/value pairs
from this HashMap. Presently, I'm iterating through the HashMap with:


  logic:iterate id=element name=resultBean property=properties
   bean:write name=element property=key/
   bean:write name=element property=value/
   br /
  /logic:iterate

The problem is that I'd like to be able to extract and display the values
in an order other than the order the key/value pairs are returned through
the iteration mechanism. (For example, supply a key explicitly and
extract it's value.) Any ideas on how to accomplish this using tags?
Thanks in advance.





RE: Multipart and IIS

2001-05-30 Thread SCHACHTER,MICHAEL (HP-NewJersey,ex2)

Michael,

Could you give more information on the nature of the failure?
Are any error messages displayed?

Also, what build of Struts
are you using?  There was a short period of time (a few days maybe)
where this would be broken.  If not already doing so, I'd suggest
you try out a nightly build or beta 2.

-Original Message-
From: Michael Binette [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 12:18 PM
To: Struts-User
Subject: Multipart and IIS


I just created a jsp page with a html:file tag on it, setup the ActionForm
to accept the file, etc.  The Action class gets called, I do what I need to
do with the file and then return mapping.findForward(success).

The mapping is returning /admin/index.jsp which is correct.  In
struts-config, I have redirect=true for the success forward.

When doing this on my devl machine, using Tomcat as my http and jsp server,
it works fine.

When doing this on our production system with IIS 5.0 as my http and Tomcat
3.2.1 as the jsp server, it fails.  The redirect is failing.  If I change it
to not redirect but forward, it works.  Or, if I take out the
enctype=multipart/form-data from the posting page, the redirect works as
well.

Has anyone seen this?  Am I explaining it well enough?

--
Thanks,
Michael Binette



RE: redirect errors back to initial frame

2001-05-30 Thread Abraham Kang

Hi Dave,

   Can you set the target to be the parent of both frames and reload both
frames every time?

   Another way of doing it would be to forget targeting the other frame and
dynamically building the subframe from the error frame using

DHTML's
parent.targetedFrame.document.open();
parent.targetedFrame.document.write(HMTL for currently targeted window);
parent.targetedFrame.document.close();

in the frame that is supposed to display the errors.

--Abraham

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 30, 2001 12:31 PM
 To: [EMAIL PROTECTED]
 Subject: redirect errors back to initial frame




 Hi everyone.

 I have the same problem that David Firmin posted back on the 8th
 March, but have
 not seen any solution posted.

 I have set the target frame in my html:form tag to be a different frame.
 However, if errors occur with the first filter page, the errors should be
 displayed in the original frame.

 Does anyone know how to do this?  David, did you find any work around?

 Many thanks,

 Dave








RE: template and I18N

2001-05-30 Thread Niall Pemberton


1. This was answered before. See following message:

  http://www.mail-archive.com/struts-user@jakarta.apache.org/msg05207.html

2. IMHO avoid scriptlets.

Niall

 -Original Message-
 From: Gregor Rayman [mailto:[EMAIL PROTECTED]]
 Sent: 30 May 2001 13:12
 To: [EMAIL PROTECTED]
 Subject: template and I18N
 
 
 Hi all, 
 
 I've just started to use Struts and I have some questions:
 
 
 1. How can I use the I18N features in the template tags?
 
 In my template.jsp I've got the following tag:
 
 titletemplate:get name='title'//title
 
 In the page using this teplate the following:
 
 template:put name='title' content='Kalkulation' direct='true'/
 
 I'd like to replace the German text 'Kalkulation' with its
 key e.g. 'app.title.calculation' Is there a nice way to do this?
 
 
 
 2. How can I use use the I18N features in Struts directly
 in Java Scriplets? 
 
 Sometimes I need the translated texts in scriplets. What is 
 the best way to access them?
 
 Now I am using this aproach:
 
 %
 
   MessageResources resources =
 (MessageResources) pageContext.getAttribute(
 Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE);
 
   Locale locale = 
 (Locale) pageContext.getAttribute(
Action.LOCALE_KEY, PageContext.SESSION_SCOPE);
 
   if (null == locale) {
 locale = request.getLocale();
   }
 
   String myText = resources.getMessage(locale, app.the.text,key);
 
 %
 
 Thanks for an answer
 
 --
 gR
 
 
 
 
 
 



Re: SV: Any hosting sites that use Struts?

2001-05-30 Thread Ted Husted

Here are two other Java hosting sites:

Imagine Internet Services - www.imagineit.com
Web APP Cabaret - www.webappcabaret.com (free, Tripod-style ISP)



-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/



RE: Multipart and IIS

2001-05-30 Thread Michael Binette

I am using the 1.0 b1 build of Struts, not a nightly version or b2.  I will
give that a shot tomorrow.

The error message I get in IE 5.5 is Server not Found, possible DNS error.
Of course that is wrong because if I just type in the exact path it was
redirecting to, it works fine.  And if I forward instead of redirect to the
same path, it works fine.

If I then do a Refresh in my browser, A NullPointerException is thrown, not
exactly sure where.

--
Thanks,
Michael Binette


-Original Message-
From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 4:12 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Multipart and IIS


Michael,

Could you give more information on the nature of the failure?
Are any error messages displayed?

Also, what build of Struts
are you using?  There was a short period of time (a few days maybe)
where this would be broken.  If not already doing so, I'd suggest
you try out a nightly build or beta 2.

-Original Message-
From: Michael Binette [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 12:18 PM
To: Struts-User
Subject: Multipart and IIS


I just created a jsp page with a html:file tag on it, setup the ActionForm
to accept the file, etc.  The Action class gets called, I do what I need to
do with the file and then return mapping.findForward(success).

The mapping is returning /admin/index.jsp which is correct.  In
struts-config, I have redirect=true for the success forward.

When doing this on my devl machine, using Tomcat as my http and jsp server,
it works fine.

When doing this on our production system with IIS 5.0 as my http and Tomcat
3.2.1 as the jsp server, it fails.  The redirect is failing.  If I change it
to not redirect but forward, it works.  Or, if I take out the
enctype=multipart/form-data from the posting page, the redirect works as
well.

Has anyone seen this?  Am I explaining it well enough?

--
Thanks,
Michael Binette




RE: Any hosting sites that use Struts?

2001-05-30 Thread David Noll


I can recommend Servlets.net quite strongly. They recently switched to Resin
1.25 which works very well with Struts. I've successfully hosted a 50,000
session/month site with them. They are a small shop, but their support staff
is responsive and they offer a plethora of services--CVS, MySQL, Postgres,
c.

In short, I would use them for anything that didn't require a dedicated box.

Cheers,

David


-Original Message-
From: Jeff Trent [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 12:12 PM
To: [EMAIL PROTECTED]
Subject: Any hosting sites that use Struts?


Anyone know of a hosting facility that offers Java web hosting + Struts?




Re: ActionErrors inside perform() methods; application context; andi18n issues

2001-05-30 Thread Craig R. McClanahan

This response is horrendously late because of my schedule, but the answers
are still useful.

On Mon, 23 Apr 2001, Regular Expression wrote:

 These are three unrelated questions that have arisen as I've learned Struts;
 I thought I'd lump them together for brevity's sake. I've perused quite a
 bit of documentation and never found answers to any of these, else I
 wouldn't resort to spamming the list.
 
 1) While ActionForm.validate() can return some ActionErrors, it seems the
 only way an action itself can signal an error condition is to forward to an
 appropriate page--but even in this case, there is no standardized way to
 return descriptive error information. Might it not make sense to allow
 actions to somehow associate an ActionErrors with the ActionForward they
 return, and let the errors become available to the target? That way, an
 action can perform business logic-related validation from within its
 perform() method, and simply findForward(input) if it finds some error.
 Right now, I plan on remedying this by subclassing Action and providing a
 method which will stuff an ActionErrors into the request (with the
 appropriate attribute key) and forward to the input forward. This
 mechanism will break whenever someone decides to change the name of the key
 under which ActionErrors are stored.
 

The example application does something like this, because there are some
things you can check in a validate() method -- was the username
entered? -- and some things you cannot -- does this username exist in the
database?.  Check out how the logon action
(org.apache.struts.webapp.example.LogonAction) creates its own
ActionErrors object, and then forwards to the input page, if it encounters
any problems that were not found by the validate() method.

 2) Is there some way for my lowly Actions to get access to the
 ServletContext under which they're running? I'd like to be able to get the
 values of application-context variables.
 

You can call getServlet().getServletContext() to get the ServletContext
for your web application.  From there, you can access application
attributes, call log() to write logging messages, and so on.

 3) The user guide mentions that sessions may have a Locale associated with
 them, which will control the ResourceBundle used for things like the
 bean:message tag. But it fails to mention the name of the session key
 under which the Locale will be stored. Does anybody have an idea what the
 key is, and if it's subject to change between versions?
 
 

To reference this in your code, you should use the symbolic string
constant Action.LOCALE_STRING which resolves to the literal string value
org.apache.struts.action.LOCALE.


Craig McClanahan





Re: Resources clarification - is there a work around

2001-05-30 Thread Jonathan Asbell

Thanks Pete.  However it just seems strange that Struts just offers one big
resource file for each Local.  I have developed 3 international sites, and I
can safely say that when a set of resources are associated with a particular
page it is much easier to manage than 1 resources for all pages.  Has anyone
hacked at the Struts code to get around this?  I dont like the concatenating
idea because it is too easy to have duplicates; and you probably want to use
the same resource names anyway to keep a consistency.  Anyone else have any
ideas?

- Original Message -
From: Peter Alfors [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 9:33 AM
Subject: Re: Resources clarification :^)


 You could combine all of your property files during your build.
 This would allow you to have as many different property files as you
 want.
 However, you need to be careful that you do not have duplicate names
 across multiple files.

 HTH,
 Pete

 Jonathan wrote:

  Hello all.  It appears that the ActionServlet points to a resources
  file, and not a ResourceBundle object. Is this true?  The reason is
  that I would like to group in the same directory the following:1) a
  particular ActionForm2) the Action class that works with that
  ActionForm3) the resources (strings) that work with that
  ActionForm The reason is that it is much easier to manage the
  artifacts on a page by page basis.How can I do this
  properly ThanksJonathan





Re: jsp:useBean -vs- DefineTag

2001-05-30 Thread Craig R. McClanahan



On Tue, 24 Apr 2001, Peter Alfors wrote:

 Hello all,
 
 Sorry this is a bit off topic...I posted this on the taglibs-user
 list but haven't had any luck.
 
 How do you make an object available to the page as a script variable in
 a taglib without having to use a getAttribute() method to retrieve it?
 The jsp:useBean taglib allows you to specify the name of an object to
 retrieve from the desired scope.  From then on in the page, you can
 access this object using the specified id.
 
 I have tried placing the object in the pageContext (using the PAGE,
 REQUEST, and APPLICATION scope)  However, you then need to
 do something like pageContext.getAttribute() to access it.
 
 Any ideas on how jsp:useBean is getting around this???
 

The jsp:useBean tag (and the bean:define tag as well) actually does
two things:
* It creates an attribute in whichever scope you tell it to.
* It defines a scripting variable that can be used (in scriptlets
  and runtime expressions) as a local variable.

In general, Struts based JSP pages tend not to use the scripting variable
approach, because nearly every Struts custom tag supports the name (and
optional scope) attributes that access these beans for you.  In
application logic, though -- such as in an Action -- calling the
appropriate getAttribute() method is the only way to access these
attributes.  (The same is true when defining your own custom tags -- the
getAttribute() and findAttribute() methods in PageContext are very
commonly called.)

 Thanks,
 Pete
 
 

Craig





Re: File upload/download design question

2001-05-30 Thread Craig R. McClanahan



On Wed, 25 Apr 2001 [EMAIL PROTECTED] wrote:

 
 I have a design question regarding file upload/download which is not
 completely Struts related but I was hoping someone could provide some
 suggestions.  I have succeeded with the upload using the struts upload
 package, and then I load the file into an Oracle BLOB field. Now I need to
 get it back to the user if they want to view it.
 
 I was planning to create an Action for processing the file download. The
 user will click on a URL and pass in the ID of the file as a request
 parameter to the Action (i.e. fileDownload.do?id=1234). The Action will
 access a session EJB which then locates the requested file and returns it to
 the Action as a File object. Here is where I need advice: what is the best
 way to send this File back to the browser?  Can I change the response type
 to file somehow and stream this to the browser? Another option I thought
 about was saving the file to a temp directory and then redirecting the
 browser to this file. I would rather not write temp files if I don't have
 to. Or, is there any functionality provided with struts for sending a file
 back to the browser?
 

This is one of the cases where you might actually want to have an Action
create the response itself, instead of forwarding to a JSP page to do
it.  The reason for this is that JSP pages aren't meant for binary output
(like a GIF image) -- but servlets can do this easily.

An example of an Action to do this might look like this:

  byte buffer[] = ... load byte array from the database ...
  int size = xxx; // Number of bytes to be sent

  response.setContentLength(size);
  response.setContentType(image/gif);  // Or whatever is correct
  ServletOutputStream stream = response.getOutputStream();
  int sent = 0;
  while (sent  size) {
int count = stream.write(buffer, sent, size - sent);
sent += count;
  }
  stream.flush();

  return (null);

Note that NULL is returned, instead of an ActionForward.  This is the
signal to the controller servlet that the Action has already created the
response, so no forwarding is required.


 Any suggestions greatly appreciated...
 
 Thanks,
 Bob
 

Craig





RE: Help me defend Struts taglibs!!!

2001-05-30 Thread Niall Pemberton

I submitted an if/else and switch/case set of tags a couple of weeks ago
under the Struts developer list.

   http://www.mail-archive.com/struts-dev@jakarta.apache.org/msg01372.html

It uses three tags If, Then  Else (based on existing Struts CompareTagBase
logic)

  logic:if op=GreaterThan name=testbean property=doubleProperty
value=400
  logic:then
Property Greater Than Value
  /logic:then
  logic:else
Property Not Greater Than Value
  /logic:else
  /logic:if


Does this come under the really ugly category or will you consider it for
Struts?

Niall

 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
 Sent: 31 May 2001 04:18
 To: '[EMAIL PROTECTED]'
 Subject: RE: Help me defend Struts taglibs!!!




 On Thu, 26 Apr 2001, Scott Cressler wrote:

  One thing this argument might come down to is why custom tags,
 especially
  for if...else stuff (which, BTW, IMHO is not handled real well by the
  struts tags...would be nicer to have more flexibility in the
 conditions you
  can check and to have the ability to do else, rather than
  logic:equal.../logic:equallogic:notEqual.../logic:notEqual...but
  that's another discussion :-).  In other words, if it is so easy to just
  slap some Java in their to do some conditional stuff, why use a
 clumsy tag.
 

 It turns out to be surprisingly difficult to come up with syntax for an
 else construct that is legal XML syntax and isn't really ugly.

 There's currently work going on in the JSP Standard Tag Library effort
 (JSR-052) to create tags that will eventually be known to all containters
 in the same way that tags like jsp:useBean are -- which will also deal
 with a lot of the performance related concerns.  It looks like there will
 be reasonable ways to do switch and if-else type processing with them.

 In the mean time, we can reconsider adding an else capability in Struts
 1.1, if someone can come up with a good syntax.

 Craig






Re: Correctly using token mechanism

2001-05-30 Thread Craig R. McClanahan

It appears this never got answered, so better late than never ...

On Sun, 29 Apr 2001, Jonathan Asbell wrote:

 After studying how the token mechanism works, I understand the following:
 
 1) The token is a unique identifier (value) which may be found in the
 Session and Request, which is used with certain form submissions.
 
 2) It is created, if it does not already exist, by an Action object
 that wants to use one, and its value is subsequently put in the
 session.
 
 3) Its value is taken from Session by and used in conjunction with an
 org.apache.struts.taglib.html.FormTag as a hiden form field value.
 
 4) When the form is submitted, the token's value in the submitted form
 request is compared to the value of the token sitting in the Session.  
 If they are equal than the Action may be processed.
 
 QUESTION 1:  In what situation should we use the token mechanism, as
 it seems that in the Struts example not all form actions need it.
 

There's nothing stopping you from using it on every single request.  
However, the primary purpose is to catch the user that does things like
the following:
* Sumit a form
* Hit the back arrow
* Submit the form again

If a user who does this will cause undesireable consequences (like adding
two items to your shopping cart instead of one :-), then use the token.

 QUESTION 2:  At what strategic point should the token be created for
 use, as it seems like one Action creates it and another Action looks
 for it and uses it?
 

The token has to be created before the page you are trying to protect
against multiple submits is displayed.  My general pattern is to have one
action that sets up the data for a form (editRegistration and
editSubscription in the example app) and a separate action that actually
processes the results (saveRegistration or saveSubscription).  In such a
case, I would set up the token in the editXxx action, and check it in
the saveXxx action.

Craig





Re: Solution: bean attributes not displaying (please comment)

2001-05-30 Thread Martin Cooper

Actually, the getAttribute() method returns the name of the attribute used
to store the form bean, not the mapping. The mapping is maintained
internally within the Struts controller, and is not saved under an
attribute.

Also, the form bean may be in request scope or session scope. This is
configurable in struts-config.xml.

--
Martin Cooper


- Original Message -
From: Thomas Peters [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 8:45 AM
Subject: Re: Solution: bean attributes not displaying (please comment)


 The struts documentation indicates that 'mapping.getAttribute()' returns
the
 mapping name. In the case of the perform method in an Action instance,
this
 is a passed in property.

 Therefore, 'request.removeAttribute(mapping,getAttribute())' removes the
 stored attribute from the request context where attribute is the name of
the
 mapping.

 This would have been stored in the request context in some previous step.
 However, in the case that the mapping.getScope() doesn't return 'request'
it
 is removed from the session scope.


 - Original Message -
 From: Martin Zaidel [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, May 30, 2001 12:12 AM
 Subject: Solution: bean attributes not displaying (please comment)


  Got it:  My problem resided in these lines of code in perform() (which I
  copied from an Action class in the struts-example):
 
 if (mapping.getAttribute() != null) {
 if (request.equals(mapping.getScope()))
 request.removeAttribute(mapping.getAttribute());
 else
 session.removeAttribute(mapping.getAttribute());
 }
 
  So my question to the list is: what exactly are these lines doing?
 
  Thanks,
  Martin
 
  Thomas Peters wrote:
  
   Thanks for your reply...
  
   I guessed that was the problem. I don't see the new instance being
 created
   in my log file. I also have a fully working struts demo, which does
not
   display this behavior. What's up with that?
  
   Tom
  
   - Original Message -
   From: Martin Zaidel [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Tuesday, May 29, 2001 6:49 PM
   Subject: Re: bean attributes not displaying - please help
  
I also have this problem, but alas, no solution (as yet).  I've even
tried
in struts-config.xml to set the scope of the actions to session,
and
have explicitly
added the form to the session within the Action's perform().  I,
too,
can see the form properly populated.  However, when the form's jsp
is
called, a new Form instance is instantiatedthus, the displayed
 form
is blank.
   
Any ideas?
   
 Thomas Peters wrote:

 I have a jsp page called 'customer.jsp' with a class call
 'CustomerForm' which extendes ActionForm.

 I have cut and paste my mappings and listed them below.

 The application flow is such, that I have a link with a URI of
 /searchCustomers.do?action=Search. This action calls
 'CustomerSearchAction' which initializes a 'CustomerForm' with
null
 values for all the attributes except action, that's defaulted to
 'Search'. That works fine.

 When the end user completes and submits the 'CustomerForm' form, I
 construct a query that returns a list of customers matching the
 submitted criteria. 'Customers' is a class which contains a
 Hashtable
 of 'Customer' objects. This is accomplished with
 'CustomerListAction'
 and forwards to 'customers.jsp' which presents the results in a
 list.
 I have a 'LinkCustomerTag' class which builds links within the
 iteration of 'customers' on the 'customers.jsp' page. The link
looks
 like this: '/editCustomer.do?action=EditcustNum=10' where
 'custNum=10' dynamically changes throughout the iteration based on
 the
 current 'customer'. This works fine too.

 I select one of the links in the list which maps to
'/editCustomer'
 (see below) and calls the 'CustomerEditAction' class where I copy
 the
 properties to the instance of 'CustomerForm' and 'forward' to the
 'customer.jsp'. This is where my problem is.

  ** The form is blank. **

 I have lotts of comments in my code and can see that
 'PropertyUtils.copyProrerties(customerForm, customer)' is getting
 called. I even modified the 'PropertyUtils' class to log the
 properties being copied within the 'Enumeration' in the
 'copyProperties' method. You can see these values being copied
into
 the 'ActionForm' but when the 'forward' is called and the
 'customer.jsp' is displayed, it is empty.

 Please help...


 
 struts-config.xml
 


   !-- == Form Bean Definitions
 === --

 !-- Customer form bean --
 form-bean  name=customerForm
 

Re: problem with using forms

2001-05-30 Thread Martin Cooper

The problem is in your JSP page. First, you are closing the form tag
immediately. That's why you are seeing the error - because the other tags
are not, in fact, in the form. Second, you have the wrong closing tag.

Try this:

html:form action=test.do %-- No '/' character here --%
test: html:text property=test/br
html:submit value=OK/
/html:form %-- Use the correct closing tag here --%

Hope this helps.

--
Martin Cooper


- Original Message -
From: René Boere [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 2:58 AM
Subject: problem with using forms


 Hi,

 i am trying to create a jsp page with a form on it using the Struts
 framwork.
 The problem is that i get an exception when i try to load the jsp page.
The
 error is the following:

 May 30, 2001 11:53:31 AM GMT+02:00 Error HTTP
 [WebAppServletContext(66629
 69,form)] Root cause of ServletException
 javax.servlet.jsp.JspException: Cannot find bean
 org.apache.struts.taglib.html.B
 EAN in scope null
 at
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:486)
 at
 org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.ja
 va:188)
 at jsp_servlet._form._jspService(_form.java:127)
 at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
 at
 weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
 pl.java:213)
 at
 weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
 pl.java:246)
 at
 weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
 rvletContext.java:1265)
 at
 weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
 pl.java:1622)
 at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
 at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)


 I have also included the used files in this message.


 I have no idea what causes this error and i hope anyone can help me with
 this problem.

 Greetings,
 Rene Boere


 web.xml
 ***
 web-app
 servlet
 servlet-nameaction/servlet-name

 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
 param-nameconfig/param-name

 param-value/WEB-INF/struts-config.xml/param-value
 /init-param
 init-param
 param-namevalidate/param-name
 param-valuetrue/param-value
 /init-param
 load-on-startup1/load-on-startup
 /servlet

 servlet-mapping
 servlet-nameaction/servlet-name
 url-pattern*.do/url-pattern
 /servlet-mapping

 welcome-file-list
 welcome-fileform.jsp/welcome-file
 /welcome-file-list

 taglib
 taglib-uri/WEB-INF/struts-html.tld/taglib-uri
 taglib-location/WEB-INF/struts-html.tld/taglib-location
 /taglib
 /web-app

 ***


 struts-config.xml
 
 ?xml version=1.0 encoding=ISO-8859-1 ?

 !DOCTYPE struts-config PUBLIC
   -//Apache Software Foundation//DTD Struts Configuration
1.0//EN
   http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;

 struts-config
 form-beans
 form-bean name=TestForm type=form.TestForm/
 /form-beans

 action-mappings
 action path=/test type=form.TestAction
 name=TestForm
 forward name=test path=/test.jsp /
 /action
 /action-mappings
 /struts-config
 ***

 form.jsp
 ***
 %@page language=java contentType=text/html%
 %@ taglib uri=/WEB-INF/struts-html.tld prefix=html %

 html:form action=test.do/
 test: html:text property=test/br
 html:submit value=OK/
 /form
 ***





Re: use JSP variable as a value of property in html:select... tag

2001-05-30 Thread Martin Cooper

I think you just need a space on each side of 'var'. Try this:

html:select property=%= var % size=1

Hope this helps.

--
Martin Cooper


- Original Message - 
From: someil [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 5:42 AM
Subject: use JSP variable as a value of property in html:select ... tag


 Hi,
 
 I would like use an expression such as :
 html:select property=%= var% size=1
 but I can't do this.
 
 The error obtained is : Attribute value should be quoted
 
 So, I tried : html:select property=%= var% size=1
 then it results a new error : Attribute % has no value
 
 that is the problem?
 How can I consider a JSP variable for an attribute value?
 
 Thanks for your response ...
 
 - Cyril -





Re: Resources clarification - is there a work around

2001-05-30 Thread Martin Cooper

Personally, I would have thought that per-page resources would introduce
more problems than they solve. If there is text that needs to be consistent
across pages, it's much better to have it in only one place. Even if keys
are the same across pages, there is no assurance that the text will be. And
when it comes to translation time, all those strings will have to be
translated multiple times - and perhaps not always the same way, especially
with multiple translators working on a large app.

Just my 2 cents...

--
Martin Cooper


- Original Message -
From: Jonathan Asbell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 30, 2001 8:01 PM
Subject: Re: Resources clarification - is there a work around


 Thanks Pete.  However it just seems strange that Struts just offers one
big
 resource file for each Local.  I have developed 3 international sites, and
I
 can safely say that when a set of resources are associated with a
particular
 page it is much easier to manage than 1 resources for all pages.  Has
anyone
 hacked at the Struts code to get around this?  I dont like the
concatenating
 idea because it is too easy to have duplicates; and you probably want to
use
 the same resource names anyway to keep a consistency.  Anyone else have
any
 ideas?

 - Original Message -
 From: Peter Alfors [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, May 30, 2001 9:33 AM
 Subject: Re: Resources clarification :^)


  You could combine all of your property files during your build.
  This would allow you to have as many different property files as you
  want.
  However, you need to be careful that you do not have duplicate names
  across multiple files.
 
  HTH,
  Pete
 
  Jonathan wrote:
 
   Hello all.  It appears that the ActionServlet points to a resources
   file, and not a ResourceBundle object. Is this true?  The reason is
   that I would like to group in the same directory the following:1) a
   particular ActionForm2) the Action class that works with that
   ActionForm3) the resources (strings) that work with that
   ActionForm The reason is that it is much easier to manage the
   artifacts on a page by page basis.How can I do this
   properly ThanksJonathan
 






Re: Suggestion for Inclusion in HTML Bean

2001-05-30 Thread Martin Cooper

If what you want is the name of the form appearing in the output stream,
there is a way to do that (albeit a little unconventional, I suppose):

bean:write name='org.apache.struts.taglib.html.FORM' property='name'/

The value of the 'name' attribute here is the value of the constant
org.apache.struts.taglib.html.FORM_KEY, which is where the FormTag object
itself is stored between html:form and /html:form.

If you want a bean that has that value, you can do something similar with
bean:define.

Hope this helps.

--
Martin Cooper


- Original Message -
From: Jeff Trent [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 07, 2001 11:12 AM
Subject: Suggestion for Inclusion in HTML Bean


Can I suggest to any Struts developers listening that a new form tag
called static be added which will simply return the current form value
as static text...







Re: Potential Security Flaw in Struts MVC

2001-05-30 Thread Craig R. McClanahan



On Mon, 7 May 2001, Jeff Trent wrote:

 Ah, this maybe a problem in the way I've adapted Struts.  I reflect all UserForm 
method calls directly into the contained User object owned by the UserForm.  So for 
instance, I have
 
 public class UserForm extends ActionsForm
 {
 protected User user;
 
 ...
 
 public String getName()
 {
 return user.getName();
 }
 
 public void setName(String name)
 {
 user.setName(name);
 }
 
 ...
 
 }
 
 Now can you begin to see my original concern?  Maybe I need to
 separate the model from the form a little more than what I have.
 

This is where I can step in (better late than never :-) and point out that
this is *not* the recommended design pattern for form beans.  They really
should be independent, and you really should decide what properties should
be copied from UserForm to User in your Action (or the business logic that
it calls).

The important issue here -- and it's not unique to Struts, the issue is
common to all web application environments -- is that you have absolutely
zero control over what the client decides to send you.  For example, if
you rely on client side JavaScript for field validation, what happens when
your client turns JavaScript off?  You get garbage input, so you should
always be paranoid and validate (again) on the server side.

In the case at hand, nothing stops your user from logging on (so your
security checks won't catch anything) and then hand typing a URL with
query string parameters that maliciously or accidentally try to change
things in the system.  If the user is successful at doing this, it's shame
on the app developer for listening to request parameters that you
shouldn't.

Of course, you need to take other defensive measures as well (like using
the transaction control support to avoid accidental or malicious resubmits
of the same data).

For those of you going to JavaOne, I'm hosting a BOF on Thursday night at
7pm (BOF #1291) called Approaches to User Authentication and Access
Control in Web Applications.  This discussion has given me some
additional topical material to make sure that we cover.

 - jeff
 

Craig McClanahan




RE: Potential Security Flaw in Struts MVC

2001-05-30 Thread Craig R. McClanahan



On Tue, 8 May 2001, Manabendra Sarkar wrote:

 but if i use external security mechanism, will it be dynamic? i mean to say,
 if the admin wants to change his/her password from the application
 (using admin interface), how can he/she do that without restarting the
 server? 
 

There is no global answer to that question, because it depends on how your
security information is looked up.

Just as an example of what's possible, consider how Tomcat 4.0 implements
container managed security.  The default mechanism is a simple XML file
that is read once when the app starts up, so any changes require an
application restart.  However, you can easily configure Tomcat to look up
users and roles in a database (via JDBC) or a directory server (via
JNDI).  In these cases, changes you make to the usernames, their
passwords, and their security roles *are* dynamically recognized, because
they are looked up every time the user logs on.

Craig McClanahan




Re: Struts on Tomcat 4.0-b3

2001-05-30 Thread Craig R. McClanahan



On Wed, 2 May 2001, Nanduri, Amarnath wrote:

 Hi Guys,
 
  I was trying to use Struts on Tomcat 4.0 Beta 3. I am getting the
 following errors when starting up Tomcat. Anybody out there can point out my
 problem ? Thanks a lot.
 
 cheers,
 Amar..
 
 

As the error message points out, it's inside the Crimson parser, and it's
just a warning that the JIT cannot optimize this piece of Java bytecode
for some reason.  It's been fixed in the 1.3.1 releases that I'm currently
using.

Craig




Re: unload database

2001-05-30 Thread Craig R. McClanahan



On Wed, 2 May 2001, Ying Teng wrote:

 How do I unload database to its persistent storage version? If we are
 running directly out of a WAR file, saving cannot occur. How do we make the
 save possible?
 

The short answer is you can't.  Remember, that the whole point of this
example is to focus on the Struts tags and the way that actions works.  In
a real life application, you'd be talking to a database instead.

 Thanks.
 
 Ying
 
 
Craig





Re: Usage of include or forward in Action definition

2001-05-30 Thread Craig R. McClanahan



On Thu, 3 May 2001, James Howe wrote:

 Could someone explain a little more about when you would want to use either 
 the include or forward attributes of the action tag (used in 
 struts-config.xml) instead of the type attribute?  An example or two 
 would go a long way to clarifying when and why someone might want to use 
 either include or forward.
 
 Thanks.
 
 

The basic idea is that you might have existing logic, implemented as a
servlet, that you want to integrate into a Struts-based application.  You
can still take advantage of the automatic form bean handling and so on,
but then utilize the existing servlet instead of (or in addition
to) writing an Action.

A more radical use that I'm experimenting with a little is the idea of
scripting an action -- in a JSP page (?!?!?!).  These pages would not
actually create any output -- but they would allow application developers
who are not heavy duty Java programmers to create Actions out of existing
custom tag libraries (including our very own bean and logic tags).  Such a
business logic page would then forward to a different JSP page for the
presentation, just as you would from an Action that is coded in Java.

Craig McClanahan






Re: Potential Security Flaw in Struts MVC

2001-05-30 Thread Jeff Trent

I've sure my ears will be ringing at home that night :^)

- Original Message -
From: Craig R. McClanahan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 31, 2001 1:01 AM
Subject: Re: Potential Security Flaw in Struts MVC




 On Mon, 7 May 2001, Jeff Trent wrote:

  Ah, this maybe a problem in the way I've adapted Struts.  I reflect all
UserForm method calls directly into the contained User object owned by the
UserForm.  So for instance, I have
 
  public class UserForm extends ActionsForm
  {
  protected User user;
 
  ...
 
  public String getName()
  {
  return user.getName();
  }
 
  public void setName(String name)
  {
  user.setName(name);
  }
 
  ...
 
  }
 
  Now can you begin to see my original concern?  Maybe I need to
  separate the model from the form a little more than what I have.
 

 This is where I can step in (better late than never :-) and point out that
 this is *not* the recommended design pattern for form beans.  They really
 should be independent, and you really should decide what properties should
 be copied from UserForm to User in your Action (or the business logic that
 it calls).

 The important issue here -- and it's not unique to Struts, the issue is
 common to all web application environments -- is that you have absolutely
 zero control over what the client decides to send you.  For example, if
 you rely on client side JavaScript for field validation, what happens when
 your client turns JavaScript off?  You get garbage input, so you should
 always be paranoid and validate (again) on the server side.

 In the case at hand, nothing stops your user from logging on (so your
 security checks won't catch anything) and then hand typing a URL with
 query string parameters that maliciously or accidentally try to change
 things in the system.  If the user is successful at doing this, it's shame
 on the app developer for listening to request parameters that you
 shouldn't.

 Of course, you need to take other defensive measures as well (like using
 the transaction control support to avoid accidental or malicious resubmits
 of the same data).

 For those of you going to JavaOne, I'm hosting a BOF on Thursday night at
 7pm (BOF #1291) called Approaches to User Authentication and Access
 Control in Web Applications.  This discussion has given me some
 additional topical material to make sure that we cover.

  - jeff
 

 Craig McClanahan






Re: regd. action classes --- please help

2001-05-30 Thread Craig R. McClanahan



On Fri, 4 May 2001, Manabendra Sarkar wrote:

 Hi All,
   is there init() and destroy() like methods in Action class so that we
 can be sure that those methods will always be called
 by the action servlet?
   actually i need to aquire some resources (like database connection)
 and initialize the action class. i want to hold thoise resources
 through out the life of the action object. i want to release those resources
 only when i don't need the action object anymore. 
  please help me in doing this. any other procedure to do this except
 init()  destroy() ? 
 

The Javadocs for the org.apache.struts.action.Action class tell you what
you can expect with regards to Action lifecycle:

When an Action instance is first created, the controller
servlet will call setServlet() with a non-null argument
to identify the controller servlet instance to which this
Action is attached.  When the controller servlet is to be
shut down (or restarted), setServlet() will be called with
a null argument, which can be used to clean up any allocated
resources in use by this Action.

So, all you need to do in your Action is override the setServlet() method:

public void setServlet(ActionServlet servlet) {

if (servlet != null) {
super.setServlet(servlet);
... perform init() activities ...
} else {
... perform destroy() activities ...
super.setServlet(null);
}

}

 
 Regards
 
 Manabendra Sarkar
 
 

Craig McClanahan