struts - servlet/xml

2001-02-27 Thread Sebastian . Guzy

hi there,

I've got working software on the server side and I would like (I have) 
to create servlet-XML interface for it.

The questions are: How 'struts' is able to help me to do it faster ? Is 
it able to support me at all ? Will I have something more from it ?


Thanks in advance
Sebastian




AW: Template tags?

2001-02-27 Thread D. Veniseleas



-Ursprungliche Nachricht-
Von:John Nikolai [SMTP:[EMAIL PROTECTED]]
Gesendet am:Mittwoch, 21. Februar 2001 01:31
An: [EMAIL PROTECTED]
Betreff:Template tags?


Hi all!

I'm defiantly new to the struts and taglibs so please bear with my questions:

We are writing a proof of concept to see if struts will meet our needs for 
a non-profit customer we are working with. Several questions have come up 
during this process. First off,  the web pages we will be creating will 
have a common navigation bar used across the whole web site. It would be 
great if we can create one HTML file called navigation.jsp which all pages 
use. It seems that the struts template taglibs might be the solution, 
unfortunately the 0.5 version of struts we downloaded does not contain 
these taglibs. The template taglibs are in CVS and easily accessed but I'm 
wondering if these are going to be distributed in the next release of 
struts. Also I'm wondering if the template taglibs will suit our needs. Any 
other solutions to the above problem would be greatly appreciated.

OK, this was only one question. I'm sure as we move along with the proof of 
concept more will pop up.

Thanks for all your help,
  - John
[]  
Hi,

I'm using a nightly build of struts 1.0 since some weeks and template tags are working 
quite well.
I insert data from files as well as from a database.
You can also invoke a template by itself and get very strange results...

Dimitris




Re: Stupd question about Struts and EJB.

2001-02-27 Thread Jim Richards


EJBs come in two flavours (as opposed to flavors), session beans and entity
beans.
Session beans represent business logic and rules, entity beans represent a
row in the database.

The model that you'd use is to have Actions do the basic processing of form
elements into data beans (just regular beans, nothing special), but no business
rules.
The Action then calls a session bean with the data bean to do something 
(eg. usdate user details in the database). The session bean connects to the
database with an entity bean (or more than one depending on the database
structure).

Visually, you'd have

JSP =  Action  =  Session Bean= Entity Bean  = Database

Hope that helps.


At 06:37 AM 27/02/01 -0500, you wrote: 

 I am in the process of convincing my company to go with MVC and Struts. As
 with any thing new, people are sometimes resistant 
 to change. One of the opposition questions I am getting is, how will this
 work with EJB(problem is I don't know too much about EJB currently).  Do the
 EJB's references just go in the Form and Action Bean and every thing else
 behaves the same? Are there any obvious points that I can bring up on the
 subject? 
 Any help on this subject would be much appreciated!
  
 Thanks, Cameron Ingram



--
Kumera - a new Open Source Content Management System
for small to medium web sites written in Perl and using XML
http://www.cyber4.org/kumera/index.html



Re: Stupd question about Struts and EJB.

2001-02-27 Thread Robert Leland

As far as struts 1.0, the Form bean is used only to redisplay
information to the jsp page. Typically the EJB might be loaded/unloaded in the
action class. If you search www.mail-archives.co,m Craig talked more about this in 
detail.

In future version of struts this may be enhanced.

-Rob

 Cameron Ingram0 wrote:
 
 I am in the process of convincing my company to go with MVC and Struts. As with any 
thing new,
 people are sometimes resistant
 to change. One of the opposition questions I am getting is, how will this work with 
EJB(problem is
 I don't know too much about EJB currently).  Do the EJB's references just go in the 
Form and
 Action Bean and every thing else behaves the same? Are there any obvious points that 
I can bring
 up on the subject?
 Any help on this subject would be much appreciated!
 
 Thanks, Cameron Ingram



Re: faq

2001-02-27 Thread Ted Husted

Unfortunately, there's not an official FAQ for Struts right now.
(Jakarta's Jyve
installation seems to be hopelessly broken.) 

I've started a draft of a "kickstart" FAQ at 

 http://husted.com/about/struts/kickstart.html 

in case that helps. 

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



Re: AW: Template tags?

2001-02-27 Thread Robert Leland



"D. Veniseleas" wrote:
 these taglibs. The template taglibs are in CVS and easily accessed but I'm
 wondering if these are going to be distributed in the next release of
 struts. 

To quote David Geary, 'templates are here to stay'. All functionality that is in the
Beta or nightly builds will be in the final release of struts 1.0.

-Rob



Re: hide a link or JSP's URL

2001-02-27 Thread Maya Muchnik

Thank you both, Craig M. and Craig T. very much!
Maya

"Craig R. McClanahan" wrote:

 Maya Muchnik wrote:

  Hi,
 
  How make a link or JSP URL "invisible" to a browser? I have read some chapter
  in a book, I know that this is possible. Is it possible with Struts?  Is it
  some property "visible=true / false"?
 

 Another Craig knew the JavaScript trick for this one :-).

 
  The second question is about "input" parameter in "Action Mapping" section of
  struts-config.xml. For example, struts-example has no "input" for "Edit user
  registration", but has "forward" for "success". On the other hand, "A walking
  tour of the example application"
  (http://localhost:8080/struts-example/tour.htm) has both (paragraph
  "CheckLoginTag.java":
 

 I suspect this part of the walking tour was based on an older version of
 the
 example code.

  ---
  !-- Edit user registration --
  action path="/editRegistration"
  type="org.apache.struts.example.EditRegistrationAction"
  name="registrationForm"
  scope="request"
  validate="false"
  input="/registration.jsp"
  forward name="success" path="/registration.jsp"/
  /action
  --
  What is right?
 

 The "official" version of the example (that is, the code that is
 actually
 executed when you run the example), does not have an "input" attribute
 on the
 "/editRegistration" action.  The reasoning is this:  the
 "/editRegistration"
 action is never used as the target of a form submit, so there is no
 concept of
 returning to an input form after a validation error.  This action is
 invoked to
 "set up" a new form bean before transferring to "registration.jsp" for
 entry, so
 there is no need for input processing before it is invoked.

 One of the places that "/editRegistration.do" is referenced is on the
 main menu
 page -- it is the destination of the hyperlink for the "Edit your user
 registration profile".  So, if we follow through on what happens when
 you run the
 app:
 (1) Log on and go to the main menu.
 (2) Click the hyperlink for "/editRegistration.do"
 (3) This action sets up a form bean, populated from your current
 user information.
 (4) This action returns a forward to the "success" page,
 registration.jsp
 (5) The registration page displays, accepts your input,
 and submits to the "/saveRegistration" action
 (6) This action has an input form declared, so the validation occurs.
 If there are any errors, returns to (5) with the error messages
 object
 created
 (7) If there are no errors, the save registration action is called.

 So, you should use an "input" attribute only on actions that actually
 accept an
 input form (and therefore might detect validation errors and need to
 return).
 Actions that don't do this do not need an "input" attribute.

 
  Maya

 Craig




Re: What a jar file is needed?

2001-02-27 Thread Maya Muchnik

Wayne,

Thank you for your suggestion. I put copies of jaxp.jar and parser.jar from
jaxp1.0.1 package (Sun Microsystems) to /usr/java/jre/lib/ext and the file
was compiled.

Does anyone know why and what case we need to have crimson.jar, xlan.jar?

The second Q. (maybe it was corrected for the beta release): why is needed
to use deprecated functions in struts.util.BeanUtils.java:

LinkUserTag.java:191: warning: filter(java.lang.String) in
org.apache.struts.util.BeanUtils has been deprecated
 url.append(BeanUtils.filter(user.getUsername()));
^
LinkUserTag.java:197: warning: filter(java.lang.String) in
org.apache.struts.util.BeanUtils has been deprecated
 results.append(response.encodeURL(BeanUtils.filter(url.toString(;
   ^
Similar output for LinkSubscriptionTag.java.

In struts.util.BeanUtils.java two deprecated functions are used:
ResponseUtils.filter() and PropertyUtils.getProperty().  I have (and maybe
others) a tag "filter" to filtering special characters for HTML
interpreters. Maybe it is possible to use this code instead of the
deprecated function?


Thanks,

Maya

Wayne Ohm wrote:

 Are you sure you have installed an XML parser?  Make sure you download it
 first (http://java.sun.com/xml), and install the jar files (jaxp.jar,
 crimson.jar, xlan.jar) in C:\jdk1.3\jre\lib\ext (for JDK v1.3, for
 example).  This will eliminate the need to modify CLASSPATH.

 Maya Muchnik wrote:

  Hi,
  I have tried to compile struts-example. DatabaseServlet.java is looking
  for HandlerBase.class and InputSource.class from org.xml.sax. The error
  messages are:
 
  DatabaseServlet.java:273: cannot access org.xml.sax.HandlerBase
  file org/xml/sax/HandlerBase.class not found
   Digester digester = new Digester();
  ^
  DatabaseServlet.java:287: cannot access org.xml.sax.InputSource
  file org/xml/sax/InputSource.class not found
   digester.parse(bis);
  ^
 
  Maybe I have missed this question from others.
 
  Maya
  P.S. Maybe I have the old struts.jar?




stupid Q: setters are not called if properties are empty

2001-02-27 Thread Kan Leung, MK

Sorry if you find if this is a bit off topic. ;)

Hi all,

Hope this is not a FAQ. (I spent 2 hours to do net search but didn't
get a good answer)

8
jsp:useBean name="abc" scope="session"  /
jsp:setProperty name="abc" property="*"/
8

Introspection magic makes the property setters called if they match the
input parameters by GET or by POST.

e.g. URL?address1=aaddress2=address3=


There are exceptions: setters of some parameters which have no value
won't get called. In the above string, the later two are not called
because they have no values assigned. Suppose my bean has session scope.
Values kept unchanged.

My question is: how can the web users clear a text field if the field is
incorrectly filled?

I suppose the introspection magic is a life-saver. I just don't want to
check the return value of request.getParameter("address2) for each input
to determine if it's empty.

Can anybody give me a good alternative to clear unwanted fields easily?

--
Kan LEUNG, M K
email: [EMAIL PROTECTED]
Digital Empires Company Limited







Problems trying to deploy the struts example (1.0b) on solaris

2001-02-27 Thread Pablo Estades Fernández

Hi all,

The struts example works fine on my W2K but when I try
to deploy it on solaris fails.

This is my setup:
Solaris 2.6
Sun JDK1.2

If it helps you, you can take a look on the
weblogic.properties, the start script (startEx.sh) and
the log (weblogic_pgn.log)

If you need something more, please tell me.

Thanx!
Pablo.


___
Do You Yahoo!?
Enva mensajes instantneos y recibe alertas de correo con 
Yahoo! Messenger - http://messenger.yahoo.es
 myConf.zip


Re: Base tag question

2001-02-27 Thread James Howe

At 05:35 PM 2/26/2001 -0800, you wrote:
James Howe wrote:

  Is there some reason why the base tag defined in the HTML tag library
  doesn't let you specify the optional target attribute?  I'm working with a
  frames based web application and I need to use both the href and target
  attributes.  I know I could subclass the custom base tag, but before I do,
  I was wondering if there was any particular reason why the standard Struts
  base tag does let the user specify the target.
 

I prefer not to support attributes that aren't in the official HTML 4.01
specs, and this is one of those.  You're welcome to support it yourself
in a subclass, however.

 
  Thanks.

Craig

I thought target was part of the spec.  In looking at the spec on 
www.w3c.org, the following page specifically mentions the target attribute:

http://www.w3.org/TR/html4/struct/links.html#edef-BASE

However, the DTD does not mention the target attribute so I'm a bit 
confused.  Perhaps target will be superceded by a style-sheet 
specification?  If you don't want to change the base tag implementation I 
will just plan on creating my own subclass.

Thanks.


James W. Howe   mailto:[EMAIL PROTECTED]
Allen Creek Software, Inc.  pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103




Building a Form dynamically

2001-02-27 Thread Dorai, Harish (c)

Hello all,

I am developing an application, where I need to have a form which is a
simple table. This table is built dynamically based on a database query.
When I click on each row, I should navigate to a page corresponding to that
row, and use the values in that row to display the page. How can I use the
controller,ActionForm and the Form tags for such a scenario? Do I need to
use an action form bean for each row? If that is the case, if I have too
many rows, wouldn't that create that many instances of ActionForm and
becomes a performance issue?

Please send your suggestions. I am new to Struts.

Thanks,
Harish.




Re: Problems trying to deploy the struts example (1.0b) on solaris

2001-02-27 Thread Maya Muchnik

I think it is WebLogic related, because I do not have a problem to run
struts-example on Sun 2.7 with Sun JDK 1.3.

Pablo Estades Fernndez wrote:

 Hi all,

 The struts example works fine on my W2K but when I try
 to deploy it on solaris fails.

 This is my setup:
 Solaris 2.6
 Sun JDK1.2

 If it helps you, you can take a look on the
 weblogic.properties, the start script (startEx.sh) and
 the log (weblogic_pgn.log)

 If you need something more, please tell me.

 Thanx!
 Pablo.

 ___
 Do You Yahoo!?
 Enva mensajes instantneos y recibe alertas de correo con
 Yahoo! Messenger - http://messenger.yahoo.es

   
 Name: myConf.zip
myConf.zip   Type: Zip Compressed Data (application/x-zip-compressed)
 Encoding: base64
  Description: myConf.zip




Sample Servlet Controller

2001-02-27 Thread Nageshwar Charka

Hi there,

Can somebody help me in getting some sample code snippet for Struts Servlet
Controller(Struts Application startup Servlet).
Currently I am using SaServletEngine.class as the controller from Bluestone
Software(HP).
It just works fine, but I want to make a vender neutral app.

Thanks in advance

-nagesh



in struts frame: onclick does not work

2001-02-27 Thread Nageshwar Charka


Hi folks,
My onclick (for a button ) does not work with javascript validation. 
If I call the same javascipt function with onsubmit event in a form it works
fine. I tried both Netscape4.7 and IE5.0. Since there are no javascipt
errors in both the cases I am not able to debug. I guess event is not
getting triggered. Am I missing anything here.

Practically, we do button events javascript validations, since we deal with
multiple buttons on each form.

I am impressed by this framework, works just great both in client/server
side validations!

Thanks to Craig and his support team. 

-nagesh






RE: Sample Servlet Controller

2001-02-27 Thread Torben Norling

Hi!
Check the example application that is included with the distribution.

Another nice intro to struts can be found on:
http://www-106.ibm.com/developerworks/library/j-struts/index.html?openl=jls
t004,t=gr,p=Struts

// Torben

-Original Message-
From: Nageshwar Charka [mailto:[EMAIL PROTECTED]]
Sent: den 27 februari 2001 16:47
To: '[EMAIL PROTECTED]'
Subject: Sample Servlet Controller


Hi there,

Can somebody help me in getting some sample code snippet for Struts Servlet
Controller(Struts Application startup Servlet).
Currently I am using SaServletEngine.class as the controller from Bluestone
Software(HP).
It just works fine, but I want to make a vender neutral app.

Thanks in advance

-nagesh



Re: Problems trying to deploy the struts example (1.0b) on solaris

2001-02-27 Thread Pablo Estades Fernández

More information;

Here is my problematic index.jsp.

Do you think the error can be related to NOT to use
JDK1.3?

%@ page language="java" %
%@ taglib uri="/WEB-INF/struts-bean.tld"
prefix="bean" %
%@ taglib uri="/WEB-INF/struts-html.tld"
prefix="html" %
%@ taglib uri="/WEB-INF/struts-logic.tld"
prefix="logic" %

html:html locale="true"
head
titlebean:message key="index.title"//title
html:base/
/head
body bgcolor="white"

logic:notPresent name="database" scope="application"
  font color="red"
ERROR:  User database not loaded -- check servlet
container logs
for error messages.
  /font
  hr
/logic:notPresent

logic:notPresent
name="org.apache.struts.action.MESSAGE"
scope="application"
  font color="red"
ERROR:  Application resources not loaded -- check
servlet container
logs for error messages.
  /font
/logic:notPresent

h3bean:message key="index.heading"//h3
ul
lihtml:link
page="/editRegistration.do?action=Create"bean:message
key="index.registration"//html:link/li
lihtml:link page="/logon.jsp"bean:message
key="index.logon"//html:link/li
/ul

pnbsp;/p
pa target="_blank" href="tour.htm"font size="1"A
Walking Tour of the Example Application/font/a/p

html:img page="/struts-power.gif" alt="Powered by
Struts"/

/body
/html:html


--- Pablo Estades Fernndez [EMAIL PROTECTED]
escribi:  Hi all,
 
 The struts example works fine on my W2K but when I
 try
 to deploy it on solaris fails.
 
 This is my setup:
 Solaris 2.6
 Sun JDK1.2
 
 If it helps you, you can take a look on the
 weblogic.properties, the start script (startEx.sh)
 and
 the log (weblogic_pgn.log)
 
 If you need something more, please tell me.
 
 Thanx!
 Pablo.
 
 

___
 Do You Yahoo!?
 Enva mensajes instantneos y recibe alertas de
 correo con 
 Yahoo! Messenger - http://messenger.yahoo.es

 ATTACHMENT part 2 application/x-zip-compressed
name=myConf.zip



___
Do You Yahoo!?
Enva mensajes instantneos y recibe alertas de correo con 
Yahoo! Messenger - http://messenger.yahoo.es



Re: Problems trying to deploy the struts example (1.0b) on solaris

2001-02-27 Thread Pablo Estades Fernández

Yes Maya, it seems to be WebLogic.

Are you using Tomcat under solaris or another server?

--- Maya Muchnik [EMAIL PROTECTED] escribi:  I
think it is WebLogic related, because I do not
 have a problem to run
 struts-example on Sun 2.7 with Sun JDK 1.3.
 
 Pablo Estades Fernndez wrote:
 
  Hi all,
 
  The struts example works fine on my W2K but when I
 try
  to deploy it on solaris fails.
 
  This is my setup:
  Solaris 2.6
  Sun JDK1.2
 
  If it helps you, you can take a look on the
  weblogic.properties, the start script (startEx.sh)
 and
  the log (weblogic_pgn.log)
 
  If you need something more, please tell me.
 
  Thanx!
  Pablo.
 
 

___
  Do You Yahoo!?
  Enva mensajes instantneos y recibe alertas de
 correo con
  Yahoo! Messenger - http://messenger.yahoo.es
 
   


  Name: myConf.zip
 myConf.zip   Type: Zip Compressed Data
 (application/x-zip-compressed)
  Encoding: base64
   Description: myConf.zip
 


___
Do You Yahoo!?
Enva mensajes instantneos y recibe alertas de correo con 
Yahoo! Messenger - http://messenger.yahoo.es



Re: Problems trying to deploy the struts example (1.0b) on solaris

2001-02-27 Thread Maya Muchnik

Is this the same index.jsp from struts-example? If so, I do not have a
problem to run example on Sun 2.7 and JDK 1.3.
Maya

Pablo Estades Fernndez wrote:

 More information;

 Here is my problematic index.jsp.

 Do you think the error can be related to NOT to use
 JDK1.3?

 %@ page language="java" %
 %@ taglib uri="/WEB-INF/struts-bean.tld"
 prefix="bean" %
 %@ taglib uri="/WEB-INF/struts-html.tld"
 prefix="html" %
 %@ taglib uri="/WEB-INF/struts-logic.tld"
 prefix="logic" %

 html:html locale="true"
 head
 titlebean:message key="index.title"//title
 html:base/
 /head
 body bgcolor="white"

 logic:notPresent name="database" scope="application"
   font color="red"
 ERROR:  User database not loaded -- check servlet
 container logs
 for error messages.
   /font
   hr
 /logic:notPresent

 logic:notPresent
 name="org.apache.struts.action.MESSAGE"
 scope="application"
   font color="red"
 ERROR:  Application resources not loaded -- check
 servlet container
 logs for error messages.
   /font
 /logic:notPresent

 h3bean:message key="index.heading"//h3
 ul
 lihtml:link
 page="/editRegistration.do?action=Create"bean:message
 key="index.registration"//html:link/li
 lihtml:link page="/logon.jsp"bean:message
 key="index.logon"//html:link/li
 /ul

 pnbsp;/p
 pa target="_blank" href="tour.htm"font size="1"A
 Walking Tour of the Example Application/font/a/p

 html:img page="/struts-power.gif" alt="Powered by
 Struts"/

 /body
 /html:html

 --- Pablo Estades Fernndez [EMAIL PROTECTED]
 escribi:  Hi all,
 
  The struts example works fine on my W2K but when I
  try
  to deploy it on solaris fails.
 
  This is my setup:
  Solaris 2.6
  Sun JDK1.2
 
  If it helps you, you can take a look on the
  weblogic.properties, the start script (startEx.sh)
  and
  the log (weblogic_pgn.log)
 
  If you need something more, please tell me.
 
  Thanx!
  Pablo.
 
 
 
 ___
  Do You Yahoo!?
  Enva mensajes instantneos y recibe alertas de
  correo con
  Yahoo! Messenger - http://messenger.yahoo.es

  ATTACHMENT part 2 application/x-zip-compressed
 name=myConf.zip

 ___
 Do You Yahoo!?
 Enva mensajes instantneos y recibe alertas de correo con
 Yahoo! Messenger - http://messenger.yahoo.es




RE: Sample Servlet Controller

2001-02-27 Thread McCay, Larry

nagesh,

I am not sure what you are asking for.

You are able to write a vendor neutral app using the bluestone servlet
engine.

If you elaborate a bit I can offer some advice.

You can get to a Trail Map on the gallery website for further information

http://gallery.bluestone.com/scripts/SaISAPI.dll/Gallery.class/demos/trailMa
ps/index.jsp

thanks,

Larry

-Original Message-
From: Nageshwar Charka [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 10:47 AM
To: '[EMAIL PROTECTED]'
Subject: Sample Servlet Controller


Hi there,

Can somebody help me in getting some sample code snippet for Struts Servlet
Controller(Struts Application startup Servlet).
Currently I am using SaServletEngine.class as the controller from Bluestone
Software(HP).
It just works fine, but I want to make a vender neutral app.

Thanks in advance

-nagesh



struts-example - handle of ServletException

2001-02-27 Thread Maya Muchnik

Hi,
Do you have any ideas how registration.jsp file (struts-example) can be
changed to handle a situation when a user call it directly. I do not "like" a
SevletException to be displayed:

Error: 500
Location: /struts-example/registration.jsp
Internal Servlet Error:

javax.servlet.ServletException: No bean found under attribute key
registrationForm.A LOT OF ERRORS MESSAGES

It is better to display some "friendly" error message or return to login.jsp.

Maya






Re: struts-example - handle of ServletException

2001-02-27 Thread Jean-Noël Ribette


- Original Message -
From: Maya Muchnik [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 27, 2001 5:07 PM
Subject: struts-example - handle of ServletException


 Hi,
 Do you have any ideas how registration.jsp file (struts-example) can be
 changed to handle a situation when a user call it directly. I do not
"like" a
 SevletException to be displayed:

 Error: 500
 Location: /struts-example/registration.jsp
 Internal Servlet Error:

 javax.servlet.ServletException: No bean found under attribute key
 registrationForm.A LOT OF ERRORS MESSAGES

 It is better to display some "friendly" error message or return to
login.jsp.


Hi Maya,

You can specify a defaut error page in case you get a exception in your page
using the %@ page errorPage="myErrorPage.jsp" % tag. If an error occurs in
the JSP, the user is send to this page. Have a look at the jsp spec for more
details.

Jean-Nol




Re: Base tag question

2001-02-27 Thread Incze Lajos

 I thought target was part of the spec.  In looking at the spec on 
 www.w3c.org, the following page specifically mentions the target attribute:
 
 http://www.w3.org/TR/html4/struct/links.html#edef-BASE
 
 However, the DTD does not mention the target attribute so I'm a bit 
 confused.

I have my own copy of http://www.w3.org/TR/1999/REC-html401-19991224
and can assert that the spec does specify 'target' attribute in lieau
of frames. The attributes.html file contains a table what tags are
involved:

Name   Related Elements  Type  Default   Depr   DTD   Comment
            ---   --
......   ...   ...   ......   ...
target A, AREA, BASE,%FrameTarget; #IMPLIED L render in this
   FORM, LINK frame

So, target is not even deprecated, The "L" in the DTD columne means
"Loose DTD" according to the legend, which explains why you don't
find it in the strict (?) DTD. Most "L" attributes are deprecated
as well, but this is not. (The other not-D L attribute is "height"
for IFRAME.)

Form this table tyou can navigate to a very detailed explanation of the
target attribute, where the BASE tag is mentioned explicitly in the
attribute semantics:

--
"16.3.2 Target semantics

User agents should determine the target frame in which to load
a linked resource according to the following precedences (highest
priority to lowest):

1.If an element has its target attribute set to a known frame, when
  the element is activated (i.e., a link is followed or a form is
  processed), the resource designated by the element should be loaded
  into the target frame. 
2.If an element does not have the target attribute set but the BASE
  element does, the BASE element's target attribute determines the frame. 
3.If neither the element nor the BASE element refers to a target,
  the resource designated by the element should be loaded into
  the frame containing the element. 
4.If any target attribute refers to an unknown frame F, the user agent
  should create a new window and frame, assign the name F to the frame,
  and load the resource designated by the element in the new frame. 

User agents may provide users with a mechanism to override the target
attribute."
--

So, we have an attribute which is specified, not deprecated but "L" - and not
found in the strict DTD. Also, there are some attributes flagged with "F"
which stands for "Frameset DTD". Seemengly, the decision
is whether Struts taglibs support _frames_ (not D, L+F)  or not (strict
HTML DTD).   incze



Re: struts-example - handle of ServletException

2001-02-27 Thread Maya Muchnik

Thank you.
I thought, that some struts "magic" I can use. If I will use a standard
"errorPage" as you suggest, I will lose all pluses of the good struts
interface.
Maya

Jean-Nol Ribette wrote:

 - Original Message -
 From: Maya Muchnik [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, February 27, 2001 5:07 PM
 Subject: struts-example - handle of ServletException

  Hi,
  Do you have any ideas how registration.jsp file (struts-example) can be
  changed to handle a situation when a user call it directly. I do not
 "like" a
  SevletException to be displayed:
 
  Error: 500
  Location: /struts-example/registration.jsp
  Internal Servlet Error:
 
  javax.servlet.ServletException: No bean found under attribute key
  registrationForm.A LOT OF ERRORS MESSAGES
 
  It is better to display some "friendly" error message or return to
 login.jsp.
 

 Hi Maya,

 You can specify a defaut error page in case you get a exception in your page
 using the %@ page errorPage="myErrorPage.jsp" % tag. If an error occurs in
 the JSP, the user is send to this page. Have a look at the jsp spec for more
 details.

 Jean-Nol




form initialization using session

2001-02-27 Thread Simon Sadedin

Hi all,

I am working on an application where form fields need to default to
values that depend on the user's profile, which is stored in the
session.  Unfortunately, it seems like struts forms are created
automatically without any hooks that allow access to the session to
initialize these fields.

The only thing that I can think of is to have our application
proactively place the forms into the session with values initialized,
possibly to have the form page link through an action which creates and
initializes the form.  However this abandons the utility of having
struts automatically create the forms for us - one of the many nice
things about struts!

This seems to me like it would be a common problem.  Does anyone have a
good solution for it?

Cheers,

Simon.





Where are form tags?

2001-02-27 Thread Sundar @eSaravana

Hello,

In the beta release, which I downloaded and built, struts.jar did not have
html tags. So, I just downloaded yesterday's binary and it does not have
form tags. Am I missing something here?

Any information is appreciated.

Sundar




Re: struts-example - handle of ServletException

2001-02-27 Thread Peter Alfors

We wrap errors in our own exception class, and store them in our request/session.
Then redirect the user to a standard error page that knows how to retrieve the
error from the request/session, and display it in a 'friendly' way to the user.
Our exception class contains a user message, as well as the actuall error.  The
standard error page displays the user message with a link to an 'error details'
page that displays the actual error, stack trace, etc (for developers, admins,
etc).

This allows your errors to be localized as well.  :)

Pete

Maya Muchnik wrote:

 Thank you.
 I thought, that some struts "magic" I can use. If I will use a standard
 "errorPage" as you suggest, I will lose all pluses of the good struts
 interface.
 Maya

 Jean-Nol Ribette wrote:

  - Original Message -
  From: Maya Muchnik [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, February 27, 2001 5:07 PM
  Subject: struts-example - handle of ServletException
 
   Hi,
   Do you have any ideas how registration.jsp file (struts-example) can be
   changed to handle a situation when a user call it directly. I do not
  "like" a
   SevletException to be displayed:
  
   Error: 500
   Location: /struts-example/registration.jsp
   Internal Servlet Error:
  
   javax.servlet.ServletException: No bean found under attribute key
   registrationForm.A LOT OF ERRORS MESSAGES
  
   It is better to display some "friendly" error message or return to
  login.jsp.
  
 
  Hi Maya,
 
  You can specify a defaut error page in case you get a exception in your page
  using the %@ page errorPage="myErrorPage.jsp" % tag. If an error occurs in
  the JSP, the user is send to this page. Have a look at the jsp spec for more
  details.
 
  Jean-Nol


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: struts-example - handle of ServletException

2001-02-27 Thread Maya Muchnik

Thank you, David.

David Winterfeldt wrote:

 You can always add some logic tags at the top of the
 registration.jsp to check if he is logged in, certain
 objects are in scope that the form needs, etc.  If the
 criteria aren't met, forward him to any page you want
 and display a message.  You could also forward it to
 an error.do page that could create a struts error
 message that could be displayed on a page with the
 html:errors tag.

 David

 --- Maya Muchnik [EMAIL PROTECTED] wrote:
  Hi,
  Do you have any ideas how registration.jsp file
  (struts-example) can be
  changed to handle a situation when a user call it
  directly. I do not "like" a
  SevletException to be displayed:
 
  Error: 500
  Location: /struts-example/registration.jsp
  Internal Servlet Error:
 
  javax.servlet.ServletException: No bean found under
  attribute key
  registrationForm.A LOT OF ERRORS MESSAGES
 
  It is better to display some "friendly" error
  message or return to login.jsp.
 
  Maya
 
 
 

 __
 Do You Yahoo!?
 Get email at your own domain with Yahoo! Mail.
 http://personal.mail.yahoo.com/




Re: struts-example - handle of ServletException

2001-02-27 Thread Maya Muchnik

Thank you, Peter. So many good implementations around!

Peter Alfors wrote:

 We wrap errors in our own exception class, and store them in our request/session.
 Then redirect the user to a standard error page that knows how to retrieve the
 error from the request/session, and display it in a 'friendly' way to the user.
 Our exception class contains a user message, as well as the actuall error.  The
 standard error page displays the user message with a link to an 'error details'
 page that displays the actual error, stack trace, etc (for developers, admins,
 etc).

 This allows your errors to be localized as well.  :)

 Pete

 Maya Muchnik wrote:

  Thank you.
  I thought, that some struts "magic" I can use. If I will use a standard
  "errorPage" as you suggest, I will lose all pluses of the good struts
  interface.
  Maya
 
  Jean-Nol Ribette wrote:
 
   - Original Message -
   From: Maya Muchnik [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Tuesday, February 27, 2001 5:07 PM
   Subject: struts-example - handle of ServletException
  
Hi,
Do you have any ideas how registration.jsp file (struts-example) can be
changed to handle a situation when a user call it directly. I do not
   "like" a
SevletException to be displayed:
   
Error: 500
Location: /struts-example/registration.jsp
Internal Servlet Error:
   
javax.servlet.ServletException: No bean found under attribute key
registrationForm.A LOT OF ERRORS MESSAGES
   
It is better to display some "friendly" error message or return to
   login.jsp.
   
  
   Hi Maya,
  
   You can specify a defaut error page in case you get a exception in your page
   using the %@ page errorPage="myErrorPage.jsp" % tag. If an error occurs in
   the JSP, the user is send to this page. Have a look at the jsp spec for more
   details.
  
   Jean-Nol




Question about iterate tag

2001-02-27 Thread Shamdasani Nimmi-ANS004

Hi,

Could someone please tell me what I am doing wrong below:

user is a bean in session scope in my JSP and its getSuppliers() method returns a 
hashtable where keys are Suppliers Ids and elements are Supplier beans. 


logic:iterate collection="%= user.getSuppliers() %" id="supplier" 
type="com.motorola.mms.msqc.beans.SupplierBean"

TR
TDbean:write name="supplier" property="seq_nbr" scope="page" //TD
TDbean:write name="supplier" property="name" scope="page" //TD
TDbean:write name="supplier" property="country_name" scope="page" //TD
/TR

/logic:iterate

Thanks in advance.

-Nimmi





Re: form initialization using session

2001-02-27 Thread Michael McCallister

The way this is typically handled is to use an Action to populate the 
bean.  So instead of linking your user directly to the JSP page, you link 
them to an Action.  This Action typically loads the bean and then returns 
the success mapping, which, in struts-config.xml, you've mapped to the JSP 
that displays the values from the bean.

The example application that comes with struts shows how to do this.  The 
walking tour that accompanies the example explains it better than I 
have.  Look at the relationship between EditSubscriptionAction.java, 
subscription.jsp, and SaveSubscriptionAction.java.


Mike

At 11:46 AM 2/27/2001, you wrote:
Hi all,

I am working on an application where form fields need to default to
values that depend on the user's profile, which is stored in the
session.  Unfortunately, it seems like struts forms are created
automatically without any hooks that allow access to the session to
initialize these fields.

The only thing that I can think of is to have our application
proactively place the forms into the session with values initialized,
possibly to have the form page link through an action which creates and
initializes the form.  However this abandons the utility of having
struts automatically create the forms for us - one of the many nice
things about struts!

This seems to me like it would be a common problem.  Does anyone have a
good solution for it?

Cheers,

Simon.




Re: Has any one used struts and log4j successfully?

2001-02-27 Thread Mark Balster

I currently use Log4j with NDC enabled combined with struts.

Here is how I use it:

- Run PropertyConfigurator from a startup servlet
- import org.apache.log4j.Category in your code
- set reference to log4j in your code

public class loginAction extends Action {
static Category cat = Category.getInstance(loginAction.class.getName());

...
.
.


and in the body just call it:
if ( cat.isDebugEnabled() )
cat.debug("Attempting login with session: " + sessionid);


I hope that helps.  I wish all products were as easy as log4j to integrate.

-Mark

- Original Message -
From: "Sundar @eSaravana" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 27, 2001 2:01 PM
Subject: Has any one used struts and log4j successfully?


 Has anyone used log4j with struts? I have used log4j before, but I am new
to
 struts. So, I am just looking for a short cut. If you have,could you
please
 send me some code fragments to start off.

 I would really appreciate it.

 Cheers.!
 Sundar





Re: struts-example - handle of ServletException

2001-02-27 Thread Incze Lajos

On Tue, Feb 27, 2001 at 12:07:15PM -0500, Maya Muchnik wrote:
 Hi,
 Do you have any ideas how registration.jsp file (struts-example) can be
 changed to handle a situation when a user call it directly. I do not "like" a
 SevletException to be displayed:
 
 Error: 500
 Location: /struts-example/registration.jsp
 Internal Servlet Error:
 
 javax.servlet.ServletException: No bean found under attribute key
 registrationForm.A LOT OF ERRORS MESSAGES
 
 It is better to display some "friendly" error message or return to login.jsp.
 
 Maya
 
To avoid situations when a user targets directly to view page I see
three strategies:

1. Take all your view pages under WEB-INF.
2. Use container managed security and disable access to directories
   where your view pages reside (thes will be available only for
   servlet dispather's forwarding/including).
3. Place a logic at the start of your view pages which checks the
   calling URL and redirects/forwards to the appropriate controler
   action.

Each of them has their odds but couldn't find a better solution so far.
  incze



Re: struts-example - handle of ServletException

2001-02-27 Thread Maya Muchnik

Thank you Incze. This is the 3rd or 4th good suggestions!!! We have so many gurus.
The Life is good.
Maya

Incze Lajos wrote:

 On Tue, Feb 27, 2001 at 12:07:15PM -0500, Maya Muchnik wrote:
  Hi,
  Do you have any ideas how registration.jsp file (struts-example) can be
  changed to handle a situation when a user call it directly. I do not "like" a
  SevletException to be displayed:
 
  Error: 500
  Location: /struts-example/registration.jsp
  Internal Servlet Error:
 
  javax.servlet.ServletException: No bean found under attribute key
  registrationForm.A LOT OF ERRORS MESSAGES
 
  It is better to display some "friendly" error message or return to login.jsp.
 
  Maya
 
 To avoid situations when a user targets directly to view page I see
 three strategies:

 1. Take all your view pages under WEB-INF.
 2. Use container managed security and disable access to directories
where your view pages reside (thes will be available only for
servlet dispather's forwarding/including).
 3. Place a logic at the start of your view pages which checks the
calling URL and redirects/forwards to the appropriate controler
action.

 Each of them has their odds but couldn't find a better solution so far.
   incze




RE: struts-example - handle of ServletException

2001-02-27 Thread Deadman, Hal

This is the 3rd or 4th thank you email!!! We have so many emails. The Life
is bad. 

But seriously, I think everyone is thankful for responses they get to their
submissions. If everyone thanked people for every response the list would be
too cluttered. Why not say thanks in advance?

Hal

-Original Message-
From: Maya Muchnik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 3:21 PM
To: [EMAIL PROTECTED]
Subject: Re: struts-example - handle of ServletException


Thank you Incze. This is the 3rd or 4th good suggestions!!! We have so many
gurus.
The Life is good.
Maya

Incze Lajos wrote:

 On Tue, Feb 27, 2001 at 12:07:15PM -0500, Maya Muchnik wrote:
  Hi,
  Do you have any ideas how registration.jsp file (struts-example) can be
  changed to handle a situation when a user call it directly. I do not
"like" a
  SevletException to be displayed:
 
  Error: 500
  Location: /struts-example/registration.jsp
  Internal Servlet Error:
 
  javax.servlet.ServletException: No bean found under attribute key
  registrationForm.A LOT OF ERRORS MESSAGES
 
  It is better to display some "friendly" error message or return to
login.jsp.
 
  Maya
 
 To avoid situations when a user targets directly to view page I see
 three strategies:

 1. Take all your view pages under WEB-INF.
 2. Use container managed security and disable access to directories
where your view pages reside (thes will be available only for
servlet dispather's forwarding/including).
 3. Place a logic at the start of your view pages which checks the
calling URL and redirects/forwards to the appropriate controler
action.

 Each of them has their odds but couldn't find a better solution so far.
   incze



How do I iterate thru a hashtable using iterate tag?

2001-02-27 Thread Shamdasani Nimmi-ANS004

Hi,

Could someone please tell me what I am doing wrong below:

user is a bean in session scope in my JSP and its getSuppliers() method returns a 
hashtable where keys are Suppliers Ids and elements are Supplier beans. 


logic:iterate collection="%= user.getSuppliers() %" id="supplier" 
type="com.motorola.mms.msqc.beans.SupplierBean"

TR
TDbean:write name="supplier" property="seq_nbr" scope="page" //TD
TDbean:write name="supplier" property="name" scope="page" //TD
TDbean:write name="supplier" property="country_name" scope="page" //TD
/TR

/logic:iterate

--
I had the following code earlier and that was working.

%
Hashtable hashTable = (Hashtable) user.getSuppliers();
for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) {
SupplierBean supplier = (SupplierBean) e.nextElement();
%

TR

TD%= supplier.getCode() %/FONT/TD
TD%= supplier.getName() %/TD
TD%= supplier.getCountryName() %/FONT/TD
/TR

% } %

Thanks in advance.

-Nimmi




Re: Has any one used struts and log4j successfully?

2001-02-27 Thread Puneet Vardhan

Hi,

   Is there anyway that I could prevent the call to getInstance of Category
in every action class.
  So I can have instance of Category in base action class and every other
class would extend from it.
  public class baseAction extends Action {
static Category cat =
Category.getInstance(loginAction.class.getName());}

  this way I can just use this cat instance in all other action class which
extends from this base...
  public class logonAction extends baseAction{
and I can put cat.debug etc. here

  but the problem is that it would always print the base class name in the
log. 
  I was wondering if it is required to have Category as static bcoz
otherwise I could pass the instance name of every classs instance to it..
-puneet




I currently use Log4j with NDC enabled combined with struts.

Here is how I use it:

- Run PropertyConfigurator from a startup servlet
- import org.apache.log4j.Category in your code
- set reference to log4j in your code

public class loginAction extends Action {
static Category cat = Category.getInstance(loginAction.class.getName());

...
.
.


and in the body just call it:
if ( cat.isDebugEnabled() )
cat.debug("Attempting login with session: " + sessionid);


I hope that helps.  I wish all products were as easy as log4j to integrate.

-Mark

- Original Message -
From: "Sundar @eSaravana" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 27, 2001 2:01 PM
Subject: Has any one used struts and log4j successfully?


 Has anyone used log4j with struts? I have used log4j before, but I am new
to
 struts. So, I am just looking for a short cut. If you have,could you
please
 send me some code fragments to start off.

 I would really appreciate it.

 Cheers.!
 Sundar






RE: Struggling with select/options

2001-02-27 Thread Martin J. La Jeunesse

Jean-Noel, merci beaucoup.
Although using the collection mode of options, rather than name made, I'm
accomplishing what I wanted to do.
thanks again

 -Original Message-
 From: Jean-Nol Ribette [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 27, 2001 7:43 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Struggling with select/options


  Did you put an int in your collection ? Did you try with a Integer ?

 Not in the collection of course but check you don't have an
 int which should
 be an Integer or a String somewhere.





(Newbie question) Abstracting/wrapping the HTML link tag

2001-02-27 Thread Bern McCarty


We specify CSS files in our JSP output with the HTML link tag.  The
precise CSS files referenced should sometimes be different depending on
locale and a concept of brand within our application. I could easily write
my own JSP tag to do this but I was wondering if struts already offered
something along these lines? If nothing else, I could build upon struts
syntax in my own tag...

Bern McCarty
Bentley Systems, Inc.



Re: stupid Q: setters are not called if properties are empty

2001-02-27 Thread martin . cooper

It's not a stupid question. I'm not sure if it's off-topic or not. :-)

The JSP fragment you posted suggests that your JSP is being invoked 
directly. That is, the URL coming from the browser references the JSP, and 
not a Struts Action (e.g. doSomthing.do). If this is the case, then I don't 
think Struts can help you much, since it won't have a chance to touch the bean.

In a typical Struts application, the request will be handled by the 
controller servlet, which will parse the request and populate a form bean 
with the parameters. An Action will then process the request and forward to 
a JSP for displaying the results to the user. In this scenario, since 
Struts populated form bean for you, there is usually no need to use the 
useBean/setProperty mechanism you have.

Also - and this is the piece you need - the controller servlet will call 
the reset() method on your form bean immediately before populating it with 
the values from the new request. That gives you the chance to clear out the 
old values, so that they are not left in the form bean if there is no 
corresponding value in the request.

Hope this helps.

--
Martin Cooper
Tumbleweed Communications


At 10:42 PM 2/27/01 +0800, Kan Leung, MK wrote:
Sorry if you find if this is a bit off topic. ;)

Hi all,

Hope this is not a FAQ. (I spent 2 hours to do net search but didn't
get a good answer)

8
jsp:useBean name="abc" scope="session"  /
jsp:setProperty name="abc" property="*"/
8

Introspection magic makes the property setters called if they match the
input parameters by GET or by POST.

e.g. URL?address1=aaddress2=address3=


There are exceptions: setters of some parameters which have no value
won't get called. In the above string, the later two are not called
because they have no values assigned. Suppose my bean has session scope.
Values kept unchanged.

My question is: how can the web users clear a text field if the field is
incorrectly filled?

I suppose the introspection magic is a life-saver. I just don't want to
check the return value of request.getParameter("address2) for each input
to determine if it's empty.

Can anybody give me a good alternative to clear unwanted fields easily?

--
Kan LEUNG, M K
email: [EMAIL PROTECTED]
Digital Empires Company Limited





Re: How do I iterate thru a hashtable using iterate tag?

2001-02-27 Thread Maya Muchnik

Nimmi,

Check the properties names. In the working variant they are:
code, name, countryName. In the 2nd (not working variant) they are:
seq_nbr, name, country_name.
The second, maybe underscore sign is not allowed.
Maya

Shamdasani Nimmi-ANS004 wrote:

 Hi,

 Could someone please tell me what I am doing wrong below:

 user is a bean in session scope in my JSP and its getSuppliers() method returns a 
hashtable where keys are Suppliers Ids and elements are Supplier beans.

 logic:iterate collection="%= user.getSuppliers() %" id="supplier" 
type="com.motorola.mms.msqc.beans.SupplierBean"

 TR
 TDbean:write name="supplier" property="seq_nbr" scope="page" //TD
 TDbean:write name="supplier" property="name" scope="page" //TD
 TDbean:write name="supplier" property="country_name" scope="page" //TD
 /TR

 /logic:iterate

 --
 I had the following code earlier and that was working.

 %
 Hashtable hashTable = (Hashtable) user.getSuppliers();
 for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) {
 SupplierBean supplier = (SupplierBean) e.nextElement();
 %

 TR

 TD%= supplier.getCode() %/FONT/TD
 TD%= supplier.getName() %/TD
 TD%= supplier.getCountryName() %/FONT/TD
 /TR

 % } %

 Thanks in advance.

 -Nimmi




German version of presentation online!

2001-02-27 Thread Craig Tataryn

Uwe Pleyer of Germany was gracious enough to translate the Struts
Prensentation at http://www.us-eh.com/craiger/articles/struts/ to
German!  Check it out if that is your native tounge.

Now I don't know German personally, so let me know if it's a real
translation, or just some German drinking song ;)

Thanks Uwe!

Craig T.

--
I've been trying to change the world for years, but they just won't give
me the source code



begin:vcard 
n:Tataryn;Craig
tel;home:952-884-6752
tel;work:952-842-5576
x-mozilla-html:TRUE
url:http://www.computer-programmer.org
org:Compuware;Professional Division
adr:;;3600 West 80th St. Suite 400;Bloomington;MN;55431;United States of America
version:2.1
email;internet:[EMAIL PROTECTED]
title:Senior Staff Analyst
fn:Craig Tataryn
end:vcard



RE: Has any one used struts and log4j successfully?

2001-02-27 Thread Martin J. La Jeunesse

I had a little trouble using PropertyConfigurator.configure() to log to a
file: I wasn't exactly sure where to put the .lcf file so that servlets
could find it. I ended-up coding an absolute location. I kind-of thought it
should go in the application directory under WEBAPPS or in the application
web-inf, but that didn't seem to work. Other than that, works great!

 -Original Message-
 From: Sundar @eSaravana [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 27, 2001 11:02 AM
 To: [EMAIL PROTECTED]
 Subject: Has any one used struts and log4j successfully?


 Has anyone used log4j with struts? I have used log4j before,
 but I am new to
 struts. So, I am just looking for a short cut. If you
 have,could you please
 send me some code fragments to start off.

 I would really appreciate it.

 Cheers.!
 Sundar





Re: Has any one used struts and log4j successfully?

2001-02-27 Thread Mark Balster

PropertyConfigurator.configure() does like an absolute path and you still
can give it one using a relative web path in your webapp directory.  You can
even specify the relative path your struts resource file ( if you chose to
do so ).

If you use a startup servlet, something like this should work:

MessageResources messages = (MessageResources)
getServletContext().getAttribute(Action.MESSAGES_KEY);

Properties props = new Properties();
try {
FileInputStream inFile = new
FileInputStream(getServletContext().getRealPath(messages.getMessage("Log.Pro
pertiesFile")) );
props.load(inFile);
inFile.close();

// manipulate what needs to be manipulated :-)
props.setProperty("log4j.appender.stdlog.File",

getServletContext().getRealPath(messages.getMessage("Log.Qwickrate"))  );

props.setProperty("log4j.appender.ddrlog.File",

getServletContext().getRealPath(messages.getMessage("Log.DDR"))  );

// configure the logging device
PropertyConfigurator.configure(props);

} catch (IOException io) {
  System.out.println(io.getMessage());
}



- Original Message -
From: "Martin J. La Jeunesse" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 27, 2001 3:57 PM
Subject: RE: Has any one used struts and log4j successfully?


 I had a little trouble using PropertyConfigurator.configure() to log to a
 file: I wasn't exactly sure where to put the .lcf file so that servlets
 could find it. I ended-up coding an absolute location. I kind-of thought
it
 should go in the application directory under WEBAPPS or in the application
 web-inf, but that didn't seem to work. Other than that, works great!

  -Original Message-
  From: Sundar @eSaravana [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, February 27, 2001 11:02 AM
  To: [EMAIL PROTECTED]
  Subject: Has any one used struts and log4j successfully?
 
 
  Has anyone used log4j with struts? I have used log4j before,
  but I am new to
  struts. So, I am just looking for a short cut. If you
  have,could you please
  send me some code fragments to start off.
 
  I would really appreciate it.
 
  Cheers.!
  Sundar
 





Modeling Struts apps with TogetherJ?

2001-02-27 Thread Bryan Field-Elliot

I'm exercising my new copy of TogetherJ, and at the same time learning 
Struts for the first time. I was wondering if anyone has had any 
experience trying to model a Struts application using Together? (e.g. 
which diagram types did you use, etc.)?

Regards,
Bryan




RE: How do I iterate thru a hashtable using iterate tag?

2001-02-27 Thread Shamdasani Nimmi-ANS004

No, the typo was on my email not in the code.

-Nimmi

-Original Message-
From: Maya Muchnik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 2:51 PM
To: [EMAIL PROTECTED]
Subject: Re: How do I iterate thru a hashtable using iterate tag?


Nimmi,

Check the properties names. In the working variant they are:
code, name, countryName. In the 2nd (not working variant) they are:
seq_nbr, name, country_name.
The second, maybe underscore sign is not allowed.
Maya

Shamdasani Nimmi-ANS004 wrote:

 Hi,

 Could someone please tell me what I am doing wrong below:

 user is a bean in session scope in my JSP and its getSuppliers() method returns a 
hashtable where keys are Suppliers Ids and elements are Supplier beans.

 logic:iterate collection="%= user.getSuppliers() %" id="supplier" 
type="com.motorola.mms.msqc.beans.SupplierBean"

 TR
 TDbean:write name="supplier" property="seq_nbr" scope="page" //TD
 TDbean:write name="supplier" property="name" scope="page" //TD
 TDbean:write name="supplier" property="country_name" scope="page" //TD
 /TR

 /logic:iterate

 --
 I had the following code earlier and that was working.

 %
 Hashtable hashTable = (Hashtable) user.getSuppliers();
 for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) {
 SupplierBean supplier = (SupplierBean) e.nextElement();
 %

 TR

 TD%= supplier.getCode() %/FONT/TD
 TD%= supplier.getName() %/TD
 TD%= supplier.getCountryName() %/FONT/TD
 /TR

 % } %

 Thanks in advance.

 -Nimmi



Is the struts example itself is multi-thread safe?

2001-02-27 Thread Maya Muchnik

Hi,

In "A Walking Tour of the Struts App", the author has mentioned that "There is only 
one object for each action (URI), so your action objects must be
multi-thread safe". Is the example itself is multi-thread safe?
I am asking this, because are several actions here, but not one of them use 
"synchronized" statement.

Maybe I am missing something...

THANKS in advance.

Maya




RE: Is the struts example itself is multi-thread safe?

2001-02-27 Thread Deadman, Hal

The example is thread safe. Methods don't need to be synchronized if they
aren't manipulating a shared object such as an instance variable. If your
action class doesn't have any instance variables and it only deals with
local variables and parameters then there is a good bet that it is thread
safe. 

Hal

-Original Message-
From: Maya Muchnik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 5:09 PM
To: [EMAIL PROTECTED]
Subject: Is the struts example itself is multi-thread safe? 


Hi,

In "A Walking Tour of the Struts App", the author has mentioned that "There
is only one object for each action (URI), so your action objects must be
multi-thread safe". Is the example itself is multi-thread safe?
I am asking this, because are several actions here, but not one of them use
"synchronized" statement.

Maybe I am missing something...

THANKS in advance.

Maya



Re: Stupd question about Struts and EJB.

2001-02-27 Thread Nick Pellow


Hello, 

Robert Leland wrote:
 
 As far as struts 1.0, the Form bean is used only to redisplay
 information to the jsp page. Typically the EJB might be loaded/unloaded in the
 action class. If you search www.mail-archives.co,m Craig talked more about this in 
detail.

My understanding is that with struts you should keep your EJBs entirely
independant of
anything to do with struts or servlets. You can and should however have
a standard naming
convention for the getters and setters across the EJB, the ActionForm
and the html form elements.
this allows you to call PropertyUtils.copyProperties(java.lang.Object
dest, java.lang.Object orig)
when you are ready to store the details entered by the user.

Please let me know if this does not sound right.

Cheers, 
Nick

 In future version of struts this may be enhanced.
 
 -Rob
 
  Cameron Ingram0 wrote:
 
  I am in the process of convincing my company to go with MVC and Struts. As with 
any thing new,
  people are sometimes resistant
  to change. One of the opposition questions I am getting is, how will this work 
with EJB(problem is
  I don't know too much about EJB currently).  Do the EJB's references just go in 
the Form and
  Action Bean and every thing else behaves the same? Are there any obvious points 
that I can bring
  up on the subject?
  Any help on this subject would be much appreciated!
 
  Thanks, Cameron Ingram



RE: Stupd question about Struts and EJB.

2001-02-27 Thread Deadman, Hal

I use EJBs without using copyProperties although it's a matter of
preference. I have a set of JavaBeans that you could call "Data Beans"
because they are often similar to my Entity Beans and they don't contain any
business logic. They are struts free and I pass these data beans to some EJB
components. I often nest the data bean inside the ActionForm class as a
property and use the Struts nested property functionality to populate the
Data JavaBean directly. Sometimes I don't use a nested JavaBean and I just
pass the individual properties of the form to the EJB component. I like
using nested java beans better than calling copyproperties because if I have
a Databean anyway, I don't want to have to redefine lots of getters and
setters in the Struts form bean. 

Hal
-Original Message-
From: Nick Pellow [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 5:23 PM
To: [EMAIL PROTECTED]
Subject: Re: Stupd question about Struts and EJB.



Hello, 

Robert Leland wrote:
 
 As far as struts 1.0, the Form bean is used only to redisplay
 information to the jsp page. Typically the EJB might be loaded/unloaded in
the
 action class. If you search www.mail-archives.co,m Craig talked more about
this in detail.

My understanding is that with struts you should keep your EJBs entirely
independant of
anything to do with struts or servlets. You can and should however have
a standard naming
convention for the getters and setters across the EJB, the ActionForm
and the html form elements.
this allows you to call PropertyUtils.copyProperties(java.lang.Object
dest, java.lang.Object orig)
when you are ready to store the details entered by the user.

Please let me know if this does not sound right.

Cheers, 
Nick

 In future version of struts this may be enhanced.
 
 -Rob
 
  Cameron Ingram0 wrote:
 
  I am in the process of convincing my company to go with MVC and Struts.
As with any thing new,
  people are sometimes resistant
  to change. One of the opposition questions I am getting is, how will
this work with EJB(problem is
  I don't know too much about EJB currently).  Do the EJB's references
just go in the Form and
  Action Bean and every thing else behaves the same? Are there any obvious
points that I can bring
  up on the subject?
  Any help on this subject would be much appreciated!
 
  Thanks, Cameron Ingram



Re: Stupd question about Struts and EJB.

2001-02-27 Thread Maya Muchnik

I have the similar case with Beans not implemented "Serializable". I will use
PropertyUtils.copyProperties(destBean, srcBean) to propogate the properties.

Nick Pellow wrote:

 Hello,

 Robert Leland wrote:
 
  As far as struts 1.0, the Form bean is used only to redisplay
  information to the jsp page. Typically the EJB might be loaded/unloaded in the
  action class. If you search www.mail-archives.co,m Craig talked more about this in 
detail.

 My understanding is that with struts you should keep your EJBs entirely
 independant of
 anything to do with struts or servlets. You can and should however have
 a standard naming
 convention for the getters and setters across the EJB, the ActionForm
 and the html form elements.
 this allows you to call PropertyUtils.copyProperties(java.lang.Object
 dest, java.lang.Object orig)
 when you are ready to store the details entered by the user.

 Please let me know if this does not sound right.

 Cheers,
 Nick

  In future version of struts this may be enhanced.
 
  -Rob
 
   Cameron Ingram0 wrote:
  
   I am in the process of convincing my company to go with MVC and Struts. As with 
any thing new,
   people are sometimes resistant
   to change. One of the opposition questions I am getting is, how will this work 
with EJB(problem is
   I don't know too much about EJB currently).  Do the EJB's references just go in 
the Form and
   Action Bean and every thing else behaves the same? Are there any obvious points 
that I can bring
   up on the subject?
   Any help on this subject would be much appreciated!
  
   Thanks, Cameron Ingram




Re: Where are form tags?

2001-02-27 Thread martin . cooper

I'm not sure exactly what problem you're seeing, but here are a couple of 
points that might be relevant:

1) The taglib that used to be referred to with the 'form' prefix (e.g. 
form:html) is now deprecated. Those tags are now in the 'html' taglib 
(e.g. html:html). The old struts-form.tld is still there, but is marked 
as deprecated.

2) The struts-*.tld files are not part of the source distribution. They are 
generated from the struts-*.xml files as a part of the build process.

Hope this helps.

--
Martin Cooper
Tumbleweed Communications


At 10:41 AM 2/27/01 -0700, Sundar @eSaravana wrote:
Hello,

In the beta release, which I downloaded and built, struts.jar did not have
html tags. So, I just downloaded yesterday's binary and it does not have
form tags. Am I missing something here?

Any information is appreciated.

Sundar





Re: Stupd question about Struts and EJB.

2001-02-27 Thread Nick Pellow



[EMAIL PROTECTED] wrote:
 
 This is the approach that I am using, but to simplify the design I have
 interconnected the view and model. I would like to eliminate this coupling-
 so if anyone has some suggestions or could recommend a pattern I could apply
 please let me know :) What I am doing is creating entity beans that resemble
 the ActionForm as much as possible- for the most part there is a loose 1 to
 1 relationship between entity EJB and ActionForm. There are some exceptions,
 but this is how 80% of the app is designed. I use session EJBs to manage the
 entity EJBs and map these to appropriate ActionForms (using the Struts
 copyProperties util). So, the session EJB must be aware of the ActionForm,
 since this is the object that it returns. To persist data, the ActionServlet
 obtains a reference to the session EJB and would send a save() method I have
 implemented the ActionForm which then is copied to an entity EJB. Ideally
 there should be a proxy between the EJB tier and the Struts tier, so the
 session EJB does not need to be aware of the ActionForm. But, I am not about
 to create another intermediate object with the same properties and
 setters/getters. Some of my forms have up to 30 properties so this is way
 too much work! I think this should be done automatically.
 
 One more thing- the copyProperties requires that properties are the same
 type. But, the view is basically just String-based where the ejb tier
 consists of real Date, BigDecimal, etc... So what I find myself doing is
 creating additional methods in the ActionForm that make this transformation.
 For example setCustomerId(BigDecimal) and setCustomerIdStr(String). Then use
 the string version for Struts, and when copyProperties is invoked it will
 map the BigDecimal value to the EJB. Perhaps I should extend copyProperties
 to support basic type conversions- or has this already been done elsewhere?
 
 thoughts or suggestions?

Bob, 
I can see what you mean. The 
RequestUtils.populate(Object bean, String prefix, String suffix, 
HttpServletRequest request)
methods do no type conversions.
So do you call the additional conversion methods during the validate()
method on the ActionForm?

I am very new to struts as is, but as I far as I can tell from reading
the implementation of the above method, 
the ActionForm can only have String properties. Is this correct?

If so, it would be nice if the ActionForm could support types other than
String and the
struts engine would convert these in a similar fashion as Ant does to
the attributes in the xml build file.
An error message could be returned to the user if they entered a String
into an Integer field, say.
This behavour may not be always desired, so it could be switched on and
off in the Action.
 This may open a can of worms however, Date formats spring to mind.
However, comming from a background of using tags in anger, I wrote a lot
of code
converting Strings to other objects, (mostly Longs, ints, (B)booleans ).

Just my 2 Bobs worth.


cheers, 
Nick



 
 Thanks,
 Bob
 
 -Original Message-
 From: Nick Pellow [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 27, 2001 5:23 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Stupd question about Struts and EJB.
 
 Hello,
 
 Robert Leland wrote:
 
  As far as struts 1.0, the Form bean is used only to redisplay
  information to the jsp page. Typically the EJB might be loaded/unloaded in
 the
  action class. If you search www.mail-archives.co,m Craig talked more about
 this in detail.
 
 My understanding is that with struts you should keep your EJBs entirely
 independant of
 anything to do with struts or servlets. You can and should however have
 a standard naming
 convention for the getters and setters across the EJB, the ActionForm
 and the html form elements.
 this allows you to call PropertyUtils.copyProperties(java.lang.Object
 dest, java.lang.Object orig)
 when you are ready to store the details entered by the user.
 
 Please let me know if this does not sound right.
 
 Cheers,
 Nick
 
  In future version of struts this may be enhanced.
 
  -Rob
 
   Cameron Ingram0 wrote:
  
   I am in the process of convincing my company to go with MVC and Struts.
 As with any thing new,
   people are sometimes resistant
   to change. One of the opposition questions I am getting is, how will
 this work with EJB(problem is
   I don't know too much about EJB currently).  Do the EJB's references
 just go in the Form and
   Action Bean and every thing else behaves the same? Are there any obvious
 points that I can bring
   up on the subject?
   Any help on this subject would be much appreciated!
  
   Thanks, Cameron Ingram



How does nested syntax in property attribute work

2001-02-27 Thread Shamdasani Nimmi-ANS004

Hi,

In some of the e-mails I have seen nested syntax being used for property attribute, 
e.g.,

html:text property="mailingAddress.street"/

what does that mean? Is it that the getMailingAddress() method of the bean will be 
called, and then what is ".street" for?

-Nimmi





Has the image tag property attribute problem been fixed?

2001-02-27 Thread Sundar @eSaravana

Hello,

 Where is 26th nightly build binary/src version? Or any other build that has
image tag fixed for property attribute.

Cheers!
Sundar




Newbie to Struts

2001-02-27 Thread JeanX

Hi all,

Pls excuse for my poor english.
I want to put request URIs that mapped to some actions in jsp:include tag 
like this:
jsp:include page="/action.do?queryString=xxx" flush="true"/
And the container can execute the requested action ,but the client can not 
get the correct response.
So pls help me.


:=)
Best regards,
JeanX
pacificnet.com(GZ)




Simple question about Struts

2001-02-27 Thread javaCool

Has anyone used Allaire's JRun and Struts yet?  If so, are any of you fine
people willing to share tips or tricks of what to do or not do?  Thanks in
advance.

Mike V.




RE: form initialization using session

2001-02-27 Thread Simon Sadedin


The way this is typically handled is to use an Action to populate the 
bean.  So instead of linking your user directly to the JSP page, you
link 
them to an Action. 

Thanks for your response - i guess I arrived at the conclusion you
propose.  However I'm still unhappy with the notion that lots of forms
are going to need their own dedicated action just to initialize them.

Instead, I am experimenting with overriding the struts
processActionForm() to notice when the form is created and call a
form.create() method on my ActionForm subclass, passing the
request/session in at that time.  This seems to be working nicely - i
still have to have all requests for the page containing the form
accessed by an action to force initialization before the form is
displayed, but I have only one action class for all forms and the
initialization logic stays where it belongs - inside the form.

I'm curious if others think having a form.create() method would be
useful, and if so, if there is a possibiliy to incorporate it into the
struts core?  

I guess the signature would look like

  void create(HttpServletRequest request)

and it would be called each time a new action form bean instance is
created, on the instance created.

Cheers,

Simon.

-Original Message-
From: Michael McCallister [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 1:01 PM
To: [EMAIL PROTECTED]
Subject: Re: form initialization using session


The way this is typically handled is to use an Action to populate the 
bean.  So instead of linking your user directly to the JSP page, you
link 
them to an Action.  This Action typically loads the bean and then
returns 
the success mapping, which, in struts-config.xml, you've mapped to the
JSP 
that displays the values from the bean.

The example application that comes with struts shows how to do this.
The 
walking tour that accompanies the example explains it better than I 
have.  Look at the relationship between EditSubscriptionAction.java, 
subscription.jsp, and SaveSubscriptionAction.java.


Mike

At 11:46 AM 2/27/2001, you wrote:
Hi all,

I am working on an application where form fields need to default to
values that depend on the user's profile, which is stored in the
session.  Unfortunately, it seems like struts forms are created
automatically without any hooks that allow access to the session to
initialize these fields.

The only thing that I can think of is to have our application
proactively place the forms into the session with values initialized,
possibly to have the form page link through an action which creates and
initializes the form.  However this abandons the utility of having
struts automatically create the forms for us - one of the many nice
things about struts!

This seems to me like it would be a common problem.  Does anyone have a
good solution for it?

Cheers,

Simon.




Re: Stupd question about Struts and EJB.

2001-02-27 Thread martin . cooper

At 11:17 AM 2/28/01 +1100, Nick Pellow wrote:
I am very new to struts as is, but as I far as I can tell from reading
the implementation of the above method,
the ActionForm can only have String properties. Is this correct?

If so, it would be nice if the ActionForm could support types other than
String and the
struts engine would convert these in a similar fashion as Ant does to
the attributes in the xml build file.

Actually, Struts will attempt to convert values as it populates a form 
bean. This is done in BeanUtils.populate(), which is called right at the 
end of RequestUtils.populate(). However, the problem is what to do if it 
can't be converted. For example, if I define a form bean property as an 
int, and the request contains "abc", what should Struts do?

In 1.0, it will set the property to a (configurable) default value, but 
that's not a good solution when there's no obvious candidate meaning 
"invalid" (e.g. for a boolean). It also destroys the original user input, 
so when validate() fails and returns the user to the input form, you can no 
longer display to them the mistake they made. (By default, in the situation 
I described above, the user would see "0" where they entered "abc".)

So it's really best if form bean properties are all strings. What you *can* 
do, though, is have your validate() method check that the value can be 
converted to what you want, and return an error if it can't. For example, 
you might use Integer.parseInt() to ensure that a valid integer was entered.

--
Martin Cooper
Tumbleweed Communications





struts and XSL

2001-02-27 Thread Michael_J_Quinn




 There are many competing technologies to embrace the
 Model 2 pattern.

 I get the feeling that XML/XSL and Struts are mutually
 exclusive.  Is this a valid concern ??

[EMAIL PROTECTED]


__
The information contained in this email communication may be confidential. You
should only read, disclose, re-transmit, copy, distribute, act in reliance on or
commercialise the information if you are authorised to do so. If you are not the
intended recipient of this email communication, please notify us immediately by
email to [EMAIL PROTECTED] or reply by email direct to the sender
and then destroy any electronic or paper copy of this message.  Any views
expressed in this email communication are those of the individual sender, except
where the sender specifically states them to be the views of a member of the
National Australia Bank Group of companies.  The National Australia Bank Group
of companies does not represent, warrant or guarantee that the integrity of this
communication has been maintained nor that the communication is free of errors,
virus or interference.





Re: Volunteer for Validation Framework

2001-02-27 Thread Spencer Smith

I have a lot of experience using validation.  I am of the opinion that if
possible validation should be done client-side using javascript.  Is there a
way to implement this by extending Struts?  If so, I would be very
interested in helping.  Currently, I am working on expanding Struts Custom
Tag Library.  I've added Pattern, IsRequired, and errorMessage to
Struts-html.tld and modified the Struts source files to accomodate for this.
It uses pattern because I am using Perl5 regular expressions to send the
validation parameterss to the Form bean.

Spencer

- Original Message -
From: David Winterfeldt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, February 25, 2001 5:35 PM
Subject: Volunteer for Validation Framework


 I'd like to volunteer to help on client and server
 side validation listed on the Struts 1.1 To Do list.

 I added some basic support for constants (global and
 on the Locale level).  I also made the validations
 more configurable.  You can define what class and
 method should do a type of validation.  I added a
 depends attribute to the validation definitions so you
 could say that checking for an integer shouldn't be
 done until required validations are done.  It's
 probably needs some work on the logic, but it seems to
 be working on the basics.  Also a number of objects
 could be created and cached somewhere.

 I also started on some methods to do basic type
 checking.  It's just some numeric primitives right now
 and a date.  I added an example page to the sample
 webapp doing the type checking.

 The code and sample web app is on my site.  I have a
 basic explanation, but I think it's lacking since I've
 added so much, but the examples should help.
 http://home.earthlink.net/~dwinterfeldt/

 David


 __
 Do You Yahoo!?
 Get email at your own domain with Yahoo! Mail.
 http://personal.mail.yahoo.com/






Re: Stupd question about Struts and EJB.

2001-02-27 Thread Nick Pellow

Martin, 

[EMAIL PROTECTED] wrote:
 
 At 11:17 AM 2/28/01 +1100, Nick Pellow wrote:
 I am very new to struts as is, but as I far as I can tell from reading
 the implementation of the above method,
 the ActionForm can only have String properties. Is this correct?
 
 If so, it would be nice if the ActionForm could support types other than
 String and the
 struts engine would convert these in a similar fashion as Ant does to
 the attributes in the xml build file.
 
 Actually, Struts will attempt to convert values as it populates a form
 bean. This is done in BeanUtils.populate(), which is called right at the
 end of RequestUtils.populate(). 

Ooops, thats what I was looking for but did not find.

 However, the problem is what to do if it
 can't be converted. For example, if I define a form bean property as an
 int, and the request contains "abc", what should Struts do?

Struts could create an ActionErrors object with an ActionError for each
conversion error.
If an error does get raised at that early stage, then one will no doubt
be raised later on
in the Action. The difference is that the coder has to 
a) check for the conversion error again, 
b) raise an error again.
It also means that checking for such user mistakes is spread across
mulitple layers in the application
and also across multiple components within the system. I think it would
be nice to centralize
such type checking in one part of the system. 


The error message strings could be defined in a similar fashion to
errors.header and errors.footer.
Maybe something like: 
errors.conversion.NumberFormatException=You must enter a number for the
{0} field, not {1}.

Then when Struts comes across a type error, it raises the error then and
there, using a resource
such as the one above to report to the user.

As mentioned earlier in this thread this option could be configurable in
Struts as it may not
always be desirable.

 In 1.0, it will set the property to a (configurable) default value, but
 that's not a good solution when there's no obvious candidate meaning
 "invalid" (e.g. for a boolean). It also destroys the original user input,
 so when validate() fails and returns the user to the input form, you can no
 longer display to them the mistake they made. (By default, in the situation
 I described above, the user would see "0" where they entered "abc".)
 
 So it's really best if form bean properties are all strings. What you *can*
 do, though, is have your validate() method check that the value can be
 converted to what you want, and return an error if it can't. For example,
 you might use Integer.parseInt() to ensure that a valid integer was entered.

If the validate() method does the type checking then we must implement
type
conversion code and type checking code in every single form bean we
write!
On large systems, this is sometimes very unfun.

Any thoughts?

Regards, 
Nick



 
 --
 Martin Cooper
 Tumbleweed Communications



Validating bean properties (WAS: Re: Stupd question aboutStruts and EJB.)

2001-02-27 Thread martin . cooper

Actually, the plan is to build exactly this type of validation into Struts 
1.1. In particular, I am hoping to incorporate it into the automated bean 
creation tool, one way or another.

The idea is to define your bean(s) in an XML file, and have the tool 
generate the actual bean code for you. When you define a bean, you can 
specify its type, along with some other validation rules (yet to be 
determined). The tool will create a validate() method, and that method will 
populate ActionErrors as appropriate.

My original thought was to generate code based on the validation rules. 
However, David Winterfeldt has written an interesting validator that runs 
off an XML spec directly. This may be a better approach, in that you can 
modify the rules later without recreating the bean, among other things.

I'm not sure how this will all fall out in the end, but I will be very 
surprised if Struts 1.1 does not include ways of automating the creation of 
form beans, and ways of specifying validation rules without writing code. 
There are several people interested in working on each of these topics, so 
I expect lots of interesting discussion on each and on how to integrate them.

--
Martin Cooper
Tumbleweed Communications


At 02:46 PM 2/28/01 +1100, Nick Pellow wrote:
Martin,

[EMAIL PROTECTED] wrote:
 
  At 11:17 AM 2/28/01 +1100, Nick Pellow wrote:
  I am very new to struts as is, but as I far as I can tell from reading
  the implementation of the above method,
  the ActionForm can only have String properties. Is this correct?
  
  If so, it would be nice if the ActionForm could support types other than
  String and the
  struts engine would convert these in a similar fashion as Ant does to
  the attributes in the xml build file.
 
  Actually, Struts will attempt to convert values as it populates a form
  bean. This is done in BeanUtils.populate(), which is called right at the
  end of RequestUtils.populate().

Ooops, thats what I was looking for but did not find.

  However, the problem is what to do if it
  can't be converted. For example, if I define a form bean property as an
  int, and the request contains "abc", what should Struts do?

Struts could create an ActionErrors object with an ActionError for each
conversion error.
If an error does get raised at that early stage, then one will no doubt
be raised later on
in the Action. The difference is that the coder has to
a) check for the conversion error again,
b) raise an error again.
It also means that checking for such user mistakes is spread across
mulitple layers in the application
and also across multiple components within the system. I think it would
be nice to centralize
such type checking in one part of the system.


The error message strings could be defined in a similar fashion to
errors.header and errors.footer.
Maybe something like:
errors.conversion.NumberFormatException=You must enter a number for the
{0} field, not {1}.

Then when Struts comes across a type error, it raises the error then and
there, using a resource
such as the one above to report to the user.

As mentioned earlier in this thread this option could be configurable in
Struts as it may not
always be desirable.

  In 1.0, it will set the property to a (configurable) default value, but
  that's not a good solution when there's no obvious candidate meaning
  "invalid" (e.g. for a boolean). It also destroys the original user input,
  so when validate() fails and returns the user to the input form, you can no
  longer display to them the mistake they made. (By default, in the situation
  I described above, the user would see "0" where they entered "abc".)
 
  So it's really best if form bean properties are all strings. What you *can*
  do, though, is have your validate() method check that the value can be
  converted to what you want, and return an error if it can't. For example,
  you might use Integer.parseInt() to ensure that a valid integer was 
 entered.

If the validate() method does the type checking then we must implement
type
conversion code and type checking code in every single form bean we
write!
On large systems, this is sometimes very unfun.

Any thoughts?

Regards,
Nick



 
  --
  Martin Cooper
  Tumbleweed Communications





Re: Iteration with html:link - BUG?

2001-02-27 Thread Martin Cooper

Jessica,

You have not closed the link tag. After the %= display %, you need
/html:link.

Also, you might want to look into using the Struts logic:iterate tag
instead of using a while loop in a scriptlet.

Hope this helps.

--
Martin Cooper
Tumbleweed Communications


- Original Message -
From: "Anderson, Jessica" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 27, 2001 1:02 PM
Subject: Iteration with html:link - BUG?


 I am attempting to iterate through an enumeration and display key/value
 pairs as part of the link using jsp expressions (%= value %).

 while (enum.hasMoreElements()){
 jsp = (String)enum.nextElement();
 display = (String)navigation.get(jsp);  %

 html:link page="/%= jsp %.do?action=jsp/%= jsp %.jsp"
target="body"%=
 display %BR

 % } %

 However, using this code results in the following error and it seems to
have
 something to do with the closing brace for the while loop.  I tested the
 while loop without the html:link tag included and it was working
properly.
 Is this a bug or am I missing something?

 Thanks,
 Jessica

 org.apache.jasper.JasperException: Unable to compile class for

JSPE:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigatio
 n_0002ejspnavigation_jsp_33.java:111: 'while' expected.
 }
  ^

E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
 002ejspnavigation_jsp_33.java:873: 'try' without 'catch' or 'finally'.
 } while (_jspx_th_html_link_22.doAfterBody() == BodyTag.EVAL_BODY_TAG);
   ^

E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
 002ejspnavigation_jsp_33.java:874: 'finally' without 'try'.
 } finally {
   ^

E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
 002ejspnavigation_jsp_33.java:879: 'try' without 'catch' or 'finally'.
 if (_jspx_th_html_link_22.doEndTag() == Tag.SKIP_PAGE)
 ^

E:\jakarta-tomcat\work\localhost_8080%2Finternal\_0002fjsp_0002fnavigation_0
 002ejspnavigation_jsp_33.java:881: 'finally' without 'try'.
 } finally {
   ^
 5 errors

 at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
 at
org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
 at

org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
 rvlet.java:149)
 at

org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
 va:161)
 at
 org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
 at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
 at
 org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
 at

org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
 onnectionHandler.java:160)
 at

org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
 )
 at java.lang.Thread.run(Thread.java:484)





Re: Validating bean properties (WAS: Re: Stupd question aboutStruts and EJB.)

2001-02-27 Thread Nick Pellow

Martin, 


[EMAIL PROTECTED] wrote:
 
 Actually, the plan is to build exactly this type of validation into Struts
 1.1. In particular, I am hoping to incorporate it into the automated bean
 creation tool, one way or another.

Yup, I minutes after my lost post, I received the post for Volunteer for
Validation
Framework. Wish I had read that first! The validation stuff sure could
be interesting.

 The idea is to define your bean(s) in an XML file, and have the tool
 generate the actual bean code for you. When you define a bean, you can
 specify its type, along with some other validation rules (yet to be
 determined). The tool will create a validate() method, and that method will
 populate ActionErrors as appropriate.

 My original thought was to generate code based on the validation rules.
 However, David Winterfeldt has written an interesting validator that runs
 off an XML spec directly. This may be a better approach, in that you can
 modify the rules later without recreating the bean, among other things.

I was considering an approach where coders wrote validation code in Java
(we all know java!)
yet the Struts framework executed it. You would extend or implement a
common java class/interface defining a single method, 
public ValidationErrors validate();  say.
That is then mapped to the form field in an xml file somewhere.

Struts, however could ship all the standard validations (such as Strings
to ints)
together.

It is something I have not given much thought to yet, but would be
interested in
exploring further.


 I'm not sure how this will all fall out in the end, but I will be very
 surprised if Struts 1.1 does not include ways of automating the creation of
 form beans, and ways of specifying validation rules without writing code.
 There are several people interested in working on each of these topics, so
 I expect lots of interesting discussion on each and on how to integrate them.

Sounds great!


 Martin Cooper
 Tumbleweed Communications
 
 At 02:46 PM 2/28/01 +1100, Nick Pellow wrote:
 Martin,
 
 [EMAIL PROTECTED] wrote:
  
   At 11:17 AM 2/28/01 +1100, Nick Pellow wrote:
   I am very new to struts as is, but as I far as I can tell from reading
   the implementation of the above method,
   the ActionForm can only have String properties. Is this correct?
   
   If so, it would be nice if the ActionForm could support types other than
   String and the
   struts engine would convert these in a similar fashion as Ant does to
   the attributes in the xml build file.
  
   Actually, Struts will attempt to convert values as it populates a form
   bean. This is done in BeanUtils.populate(), which is called right at the
   end of RequestUtils.populate().
 
 Ooops, thats what I was looking for but did not find.
 
   However, the problem is what to do if it
   can't be converted. For example, if I define a form bean property as an
   int, and the request contains "abc", what should Struts do?
 
 Struts could create an ActionErrors object with an ActionError for each
 conversion error.
 If an error does get raised at that early stage, then one will no doubt
 be raised later on
 in the Action. The difference is that the coder has to
 a) check for the conversion error again,
 b) raise an error again.
 It also means that checking for such user mistakes is spread across
 mulitple layers in the application
 and also across multiple components within the system. I think it would
 be nice to centralize
 such type checking in one part of the system.
 
 
 The error message strings could be defined in a similar fashion to
 errors.header and errors.footer.
 Maybe something like:
 errors.conversion.NumberFormatException=You must enter a number for the
 {0} field, not {1}.
 
 Then when Struts comes across a type error, it raises the error then and
 there, using a resource
 such as the one above to report to the user.
 
 As mentioned earlier in this thread this option could be configurable in
 Struts as it may not
 always be desirable.
 
   In 1.0, it will set the property to a (configurable) default value, but
   that's not a good solution when there's no obvious candidate meaning
   "invalid" (e.g. for a boolean). It also destroys the original user input,
   so when validate() fails and returns the user to the input form, you can no
   longer display to them the mistake they made. (By default, in the situation
   I described above, the user would see "0" where they entered "abc".)
  
   So it's really best if form bean properties are all strings. What you *can*
   do, though, is have your validate() method check that the value can be
   converted to what you want, and return an error if it can't. For example,
   you might use Integer.parseInt() to ensure that a valid integer was
  entered.
 
 If the validate() method does the type checking then we must implement
 type
 conversion code and type checking code in every single form bean we
 write!
 On large systems, this is sometimes very unfun.
 
 Any thoughts?
 
 

PROPOSAL: Template Screens

2001-02-27 Thread David Geary

Joel Regen wrote:

 David,
 Wouldn't it make sense to introduce a few attributes to the template tags
 that allow specification of values using references to beans?  This idea is
 used extensively in the other struts tags.  Look at the html:link tag, for
 example.  It allows you to specify a bean that contains a property that can
 be used as the value for a named request parameter.  This kind of
 parameterization is fairly powerful.

Indeed.

 With these attributes in place you can leverage the use of the controller
 actions (in an MVC architecture) to setup one or more 'template specifiers'
 in session or request context and redirect to the JSP that contains the
 template tags.  It alleviates the need for extensive use of logic: tags.
 yes?

Absolutely. Thanks to Joel for pointing this out! I found his email so
inspiring that I took a crack at this in my local build. Here's how it works:

Currently, you use templates like this: (this is from the struts-template
example)

%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template' %

template:insert template='/chapterTemplate.jsp'
  template:put name='title' content='Templates' direct='true'/
  template:put name='header' content='/header.html' /
  template:put name='sidebar' content='/sidebar.jsp' /
  template:put name='content' content='/introduction.html'/
  template:put name='footer' content='/footer.html' /
/template:insert

Collectively, template:put tags within a template:insert tag define a screen,
which is equivalent to a single Web page. Each screen contains regions; for
example, there are five regions in the code fragment above: title, header,
sidebar, content, and footer. Those regions, identified by the name attribute,
either include content or print it directly, depending upon the direct
attribute.

The template:put tag stores its three attributes--name, content, and direct--in
an instance of ScreenDefinition. That class is a simple faade for a hash
table. (See org.apache.struts.taglib.template.util.ScreenDefinition).

I've added a new template tag** that lets you specify that screen definition
directly. Here's how you use it:

%@ page import='org.apache.struts.taglib.template.util.Content'%
%@ page import='org.apache.struts.taglib.template.util.ScreenDefinition' %

% ScreenDefinition screenDefinition = new ScreenDefinition();
 screenDefinition.put("title",   new Content("Struts Templates Example",
"true"));
 screenDefinition.put("header",  new Content("/header.html", "false"));
 screenDefinition.put("sidebar", new Content("/sidebar.jsp", "false"));
 screenDefinition.put("content", new Content("/introduction.html",
"false"));
 screenDefinition.put("footer",  new Content("/footer.html", "false"));
%

template:screen template='/chapterTemplate.jsp'
  screen='%= introductionScreen %'/

The template:screen tag effectively lets you move the template:put tags into a
bean (a ScreenDefinition). But creating that bean is too painful because the
author must know about the Content and ScreenDefinition classes (I can hardly
remember where they are or what they're called). We can fix the problem with
another tag that creates a screen definition, like this:

template:screenDefinition id='introductionScreen' scope='request'
regions='%= new String[] {
"title", "header", "sidebar", "content", "footer" } %'

   content='%= new String[][] {
{ "Struts Template Example", "true"  }, // title
{ "/header.html","false" }, // header
{ "/sidebar.jsp","false" }, // sidebar
{ "/introduction.html",  "false" }, // content
{ "/footer.html","false" }  // footer
   }%'
/

The template:screenDefinition tag creates a screen definition and stores it in
the specified scope, with the specified id. For the code listed above, that
screen definition is named introductionScreen and it's placed in request scope.
You can specify any of the four scopes (page/request/session/application).

With the screenDefinition tag, the author only deals with String arrays,
instead of Content and ScreenDefinitions.

Templates are powerful because they centralize page layout, which simplifies
page maintenance, and allows global changes. The tags proposed here let you
define numerous screen definitions in a single JSP file, which centralizes your
screen definitions.

Like templates themselves, which simplify page layout and enable global layout
changes, screens simplify screen creation and maintenance, and allow global
screen changes.


david

* The ContentMap class has been renamed to ScreenDefinition.

** I wanted to take Joel's advice and add some attributes to the existing
template:insert tag, but this new tag doesn't have a body, so they must be
separate tags.


 Joel

 -Original Message-
 From: David Geary [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 21, 2001 2:52 PM
 To: Joel Regen