Problem with html:form enctype=multipart/form-data/

2001-08-06 Thread Bar³omiej Paw³owski

Hi again

I have created multipart form
  html:form action=/upload enctype=multipart/form-data
html:file property=theFile styleClass=form2/
   html:submit/
  /html:form

When I submit it, I receive following exception:
java.lang.ArrayIndexOutOfBoundsException
 at
javax.servlet.http.MultipartHandler.readLine(MultipartHandler.java:139)
 at
javax.servlet.http.MultipartHandler.readLine(MultipartHandler.java:103)
 at
javax.servlet.http.MultipartHandler.gotoBoundary(MultipartHandler.java:160)

 at
javax.servlet.http.MultipartHandler.nextPart(MultipartHandler.java:315)

What do I wrong?
thanks




URL links ActionServlet

2001-08-06 Thread Rodney Smith

Hallo,

Firstly I would like to thank Ted Husted for all his help with me getting a
better understanding of Struts, as I am a new to this area a lot of the
information that I have found is great but not detailed enough to understand some
of the process as what Ted has mentioned is perfect, thanks again Ted.

OK the questions are still coming as follows.
I am using Tomcate3.2.2 and runing of a localhost:
In the example I am using I have the index.jsp page and in that I have two
html links, one goes to get registered with the web application and the other
is logon to the web application. If I click on logon this takes me to the
logon.jsp page. When I client clicks on this as this is a .jsp this does not go
to the actionservlet as that is not a .do action 'is that correct'? instead
that just calls the viewer of logon.jsp??? or does this go direct to the
JAVABEAN by passing the ActionServlet to get the logonform.java???

Now if the client clicks on the registation URL link on the index.jsp it
comes back with a editregistration.do on the browser bar, in this case, as this
is displaying the .do, does that mean that actually has been to the
ActionServlet to JAVABEAN and comes back with the registration form display or does
this just go to the viewer and retreives the registration.jsp form, with out
going to the ActionServlet?? I understand that if the person sends a request
'A' to logon to the web application it needs to be a .do and needs to go to the
ActionServlet 'B' I think that it goes the same with the registration as
well. It is when they are asking for the forms to submit is where I don't know
where they are stored or if they need to be retreived from the JSP viewer etc.

Thanks for your time and I hope that can get another good response.
Many thanks Ted and have a great day.

Kind Regards
Rodney Smith

-- 
Sent through GMX FreeMail - http://www.gmx.net




A small Favour

2001-08-06 Thread Rohit Dewangan


Hi All,

Could anybody help me to unsubscribe from your mailing list.

I have tried atleast 3-4 times from http://jakarta.apache.org/struts but am
still getting tons of mail.

Thanks in advance.

Regards
Rohit

 -Original Message-
From: Rodney Smith [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 4:30 PM
To:  [EMAIL PROTECTED]
Subject:  URL links  ActionServlet

Hallo,

Firstly I would like to thank Ted Husted for all his help with me getting a
better understanding of Struts, as I am a new to this area a lot of the
information that I have found is great but not detailed enough to
understand
some
of the process as what Ted has mentioned is perfect, thanks again Ted.

OK the questions are still coming as follows.
I am using Tomcate3.2.2 and runing of a localhost:
In the example I am using I have the index.jsp page and in that I have two
html links, one goes to get registered with the web application and the
other
is logon to the web application. If I click on logon this takes me to the
logon.jsp page. When I client clicks on this as this is a .jsp this does
not
go
to the actionservlet as that is not a .do action 'is that correct'? instead
that just calls the viewer of logon.jsp??? or does this go direct to the
JAVABEAN by passing the ActionServlet to get the logonform.java???

Now if the client clicks on the registation URL link on the index.jsp it
comes back with a editregistration.do on the browser bar, in this case, as
this
is displaying the .do, does that mean that actually has been to the
ActionServlet to JAVABEAN and comes back with the registration form display
or does
this just go to the viewer and retreives the registration.jsp form, with
out
going to the ActionServlet?? I understand that if the person sends a
request
'A' to logon to the web application it needs to be a .do and needs to go to
the
ActionServlet 'B' I think that it goes the same with the registration as
well. It is when they are asking for the forms to submit is where I don't
know
where they are stored or if they need to be retreived from the JSP viewer
etc.

Thanks for your time and I hope that can get another good response.
Many thanks Ted and have a great day.

Kind Regards
Rodney Smith

--
Sent through GMX FreeMail - http://www.gmx.net


*Disclaimer*

This mail and any accompanying documents contain confidential information
intended for a specific individual and purpose. This information is private
and protected by law. If you are not the intended recipient, you are hereby
notified that any disclosure, copying or distribution, or the taking of any
action based on the contents of this information, is strictly prohibited.

Please let us know immediately if you have received this by mistake and
appreciate if you could delete the original message.






Re: A small Favour

2001-08-06 Thread Pham Thanh Quan

In particular, in order to remove yourself from struts mailing list, send an
empty email to the following address
[EMAIL PROTECTED]


- Original Message -
From: Rohit Dewangan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 06, 2001 3:34 PM
Subject: A small Favour



 Hi All,

 Could anybody help me to unsubscribe from your mailing list.

 I have tried atleast 3-4 times from http://jakarta.apache.org/struts but
am
 still getting tons of mail.

 Thanks in advance.

 Regards
 Rohit

  -Original Message-
 From: Rodney Smith [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 06, 2001 4:30 PM
 To:  [EMAIL PROTECTED]
 Subject:  URL links  ActionServlet

 Hallo,

 Firstly I would like to thank Ted Husted for all his help with me getting
a
 better understanding of Struts, as I am a new to this area a lot of the
 information that I have found is great but not detailed enough to
 understand
 some
 of the process as what Ted has mentioned is perfect, thanks again Ted.

 OK the questions are still coming as follows.
 I am using Tomcate3.2.2 and runing of a localhost:
 In the example I am using I have the index.jsp page and in that I have two
 html links, one goes to get registered with the web application and the
 other
 is logon to the web application. If I click on logon this takes me to the
 logon.jsp page. When I client clicks on this as this is a .jsp this does
 not
 go
 to the actionservlet as that is not a .do action 'is that correct'?
instead
 that just calls the viewer of logon.jsp??? or does this go direct to the
 JAVABEAN by passing the ActionServlet to get the logonform.java???

 Now if the client clicks on the registation URL link on the index.jsp it
 comes back with a editregistration.do on the browser bar, in this case, as
 this
 is displaying the .do, does that mean that actually has been to the
 ActionServlet to JAVABEAN and comes back with the registration form
display
 or does
 this just go to the viewer and retreives the registration.jsp form, with
 out
 going to the ActionServlet?? I understand that if the person sends a
 request
 'A' to logon to the web application it needs to be a .do and needs to go
to
 the
 ActionServlet 'B' I think that it goes the same with the registration as
 well. It is when they are asking for the forms to submit is where I don't
 know
 where they are stored or if they need to be retreived from the JSP viewer
 etc.

 Thanks for your time and I hope that can get another good response.
 Many thanks Ted and have a great day.

 Kind Regards
 Rodney Smith

 --
 Sent through GMX FreeMail - http://www.gmx.net


 *Disclaimer*

 This mail and any accompanying documents contain confidential information
 intended for a specific individual and purpose. This information is
private
 and protected by law. If you are not the intended recipient, you are
hereby
 notified that any disclosure, copying or distribution, or the taking of
any
 action based on the contents of this information, is strictly prohibited.

 Please let us know immediately if you have received this by mistake and
 appreciate if you could delete the original message.








RE: A small Favour

2001-08-06 Thread Rohit Dewangan


Thanks


 -Original Message-
From: Pham Thanh Quan [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 4:51 PM
To:  [EMAIL PROTECTED]
Subject:  Re: A small Favour

In particular, in order to remove yourself from struts mailing list, send
an
empty email to the following address
[EMAIL PROTECTED]


- Original Message -
From: Rohit Dewangan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 06, 2001 3:34 PM
Subject: A small Favour



 Hi All,

 Could anybody help me to unsubscribe from your mailing list.

 I have tried atleast 3-4 times from http://jakarta.apache.org/struts but
am
 still getting tons of mail.

 Thanks in advance.

 Regards
 Rohit

  -Original Message-
 From: Rodney Smith [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 06, 2001 4:30 PM
 To:  [EMAIL PROTECTED]
 Subject:  URL links  ActionServlet

 Hallo,

 Firstly I would like to thank Ted Husted for all his help with me getting
a
 better understanding of Struts, as I am a new to this area a lot of the
 information that I have found is great but not detailed enough to
 understand
 some
 of the process as what Ted has mentioned is perfect, thanks again Ted.

 OK the questions are still coming as follows.
 I am using Tomcate3.2.2 and runing of a localhost:
 In the example I am using I have the index.jsp page and in that I have
two
 html links, one goes to get registered with the web application and the
 other
 is logon to the web application. If I click on logon this takes me to the
 logon.jsp page. When I client clicks on this as this is a .jsp this does
 not
 go
 to the actionservlet as that is not a .do action 'is that correct'?
instead
 that just calls the viewer of logon.jsp??? or does this go direct to the
 JAVABEAN by passing the ActionServlet to get the logonform.java???

 Now if the client clicks on the registation URL link on the index.jsp it
 comes back with a editregistration.do on the browser bar, in this case,
as
 this
 is displaying the .do, does that mean that actually has been to the
 ActionServlet to JAVABEAN and comes back with the registration form
display
 or does
 this just go to the viewer and retreives the registration.jsp form, with
 out
 going to the ActionServlet?? I understand that if the person sends a
 request
 'A' to logon to the web application it needs to be a .do and needs to go
to
 the
 ActionServlet 'B' I think that it goes the same with the registration as
 well. It is when they are asking for the forms to submit is where I don't
 know
 where they are stored or if they need to be retreived from the JSP viewer
 etc.

 Thanks for your time and I hope that can get another good response.
 Many thanks Ted and have a great day.

 Kind Regards
 Rodney Smith

 --
 Sent through GMX FreeMail - http://www.gmx.net


 *Disclaimer*

 This mail and any accompanying documents contain confidential information
 intended for a specific individual and purpose. This information is
private
 and protected by law. If you are not the intended recipient, you are
hereby
 notified that any disclosure, copying or distribution, or the taking of
any
 action based on the contents of this information, is strictly prohibited.

 Please let us know immediately if you have received this by mistake and
 appreciate if you could delete the original message.






*Disclaimer*

This mail and any accompanying documents contain confidential information
intended for a specific individual and purpose. This information is private
and protected by law. If you are not the intended recipient, you are hereby
notified that any disclosure, copying or distribution, or the taking of any
action based on the contents of this information, is strictly prohibited.

Please let us know immediately if you have received this by mistake and
appreciate if you could delete the original message.






Staging Pages/Action form question.

2001-08-06 Thread Prior, Simon

Hi Guys,

I have the following scenarios and to design for and wanted to know how you
approached the following problems:

1.  I have a page that will have dynamically generated menus populated with
entries from a database.  My first question is how do you stage the pages? -
can you use the action form to retrieve the information to populate the
menus from the database ?  I was thinking of using the action forms
constructor to call an ejb to ultimately retrieve the information but didn't
know whether this was the best way of approaching the problem.

Do you guys have any suggestions?

2.  I also have a search page where the user enters the search criteria and
then submits the query, at this point I was going to put the search criteria
on the session and have the results page pick up the search criteria, carry
out the search and then display the results.  How do you guys do this?  If I
was to use an action form for this in a manner similar to the above scenario
the constructor would retrieve the search criteria from the session and
execute the query thus 'staging' the page.  Can the action form access the
session?  If not, how do you guys do it?

Any help would be most appreciated.

Thanks in advance,

Simon.
For optimum solutions that save you time, visit www.ds-s.com.



Please help ...canonical path error

2001-08-06 Thread Dudley [EMAIL PROTECTED]

can anyone please help explain why i get this error? (maximize window to see
error)

 java.io.IOException: The filename, directory name, or volume label syntax
is incorrectat java.io.File.getCanonicalPath(File.java:437) at
org.apache.tomcat.util.FileUtil.safePath(FileUtil.java:184) at
org.apache.tomcat.core.Context.getRealPath(Context.java:794)at
org.apache.tomcat.request.StaticInterceptor.requestMap(StaticInterceptor.jav
a:191)  at
org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:820
)   at
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:284)  at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
at
_0002fInstalmentsList_0002ejspInstalmentsList_jsp_6._jspService(_0002fInstal
mentsList_0002ejspInstalmentsList_jsp_6.java:102)   at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177) at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286) at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)  at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl
.java:194)  at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:1758)at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286) at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)  at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)  at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)  at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)  at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**



html:select and html:options

2001-08-06 Thread Stefan Faist

Hello all,
I these two lists:
td
bean:define name=erfassungForm id=names property=allProjektNamen /
html:select property=projektname
html:options collection=names property=value 
labelProperty=label /
/html:select
/td
td
bean:define name=erfassungForm id=aktivitaeten
property=allProjekt_aktivitaeten /
html:select property=aktivitaetname
html:options collection=aktivitaeten property=value
labelProperty=label /
/html:select
/td

I want this:
When I select one element in the list ... id=names ... the then the list
... id=aktivitaeten ... get elements, that are the activities from the
element of the first list. Is there a way to call a action when I select a
element?
I hope you understand what I want.

Is there any way to do this?
Can someone help me?

Best regards,
STEFAN


--
hmi-Informatik GmbH
Zettachring 6 - D-70567 Stuttgart
E-Mail: [EMAIL PROTECTED]
http://www.hmi-informatik.de




RE: Building struts UIs

2001-08-06 Thread Will Spies/Towers Perrin



Kurt,

Thanks for the info. I'll look ito DbForm.

Will



   

   

 To: [EMAIL PROTECTED]

kurt.mccaw@cecc: (bcc: Will Spies/Towers Perrin)   

ndec.com Subject: RE: Building struts UIs  

   

08/02/01   

09:19 AM   

Please 

respond to 

struts-user

   

   




Will:

Joachim Peer has an interesting project on the go called DbForm
(www.dbform.org) that is 'based' on Stuts. You basically give it an XML
file
with table/field and some information regarding the field (size, data type,
etc) and it will generate the JSP forms for you. It has the searching and
sorting build into the generated application. I have only given this a
cursory look as the main emphasis for this for this project was to use
RDBMS
Tables directly. My current project is using EJB's exclusively. There are
suppose to be hooks to make DbForm use EJB's, but I have not looked closely
enough at it. The other item is the project is based on Struts, but it does
not use Struts directly. Integration with Struts is in Mr. Peer's 'To Do'
List.

I have had the same idea, that the generation of the GUI i.e. JSP could be
automated (done when something in the XML metadata had changed), but I have
not come across anything. So I too am looking at generating the GUI
'auto-magically' for a current project that I am working on.

Regards,
Kurt

 -Original Message-
 From: Will Spies/Towers Perrin [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 02, 2001 6:01 AM
 To: [EMAIL PROTECTED]
 Subject: Building struts UIs




 I have a generic question. We use struts. Struts *really*
 doesn't help much
 with rapidly building UIs. I'm sure everyone here realizes
 this. I do not
 want to abandon struts, I've have had great experience with
 it but I also
 would like a way to build a mechanism to rapidly automatic
 the building of
 HTML forms. A brute force way would be to build my own
 meta-XML data and
 combine that with XSLT to generate HTML pages dynamically.
 But, before I go
 off an build anything I wanted to ask around first to see if
 anyone was
 doing the same thing, new of any open source tools, 3rd party
 tools, etc...

 Any info is appreciated and thanks in advance for any help,

 Will










Re: Building struts UIs

2001-08-06 Thread Will Spies/Towers Perrin




Jean,

Thanks for the info. I'll take a look!

Will



   

   

 To: [EMAIL PROTECTED]

Jean-Noel Ribettecc: (bcc: Will Spies/Towers Perrin)   

[EMAIL PROTECTED]Subject: Re: Building struts UIs  

mprove.fr 

   

08/02/01 02:21 PM  

Please respond to  

struts-user

   

   




You might want to have a look at struts-layout
(http://struts.application-servers.com) , a library my company is using for

its struts development. It helps to build UIs very rapidly, especially UIs
with forms and list of items. You still need to write JSPs but you don't
need to write HTML code.

Jean-Noel

At 14:00 02/08/2001, you wrote:


I have a generic question. We use struts. Struts *really* doesn't help
much
with rapidly building UIs. I'm sure everyone here realizes this. I do not
want to abandon struts, I've have had great experience with it but I also
would like a way to build a mechanism to rapidly automatic the building of
HTML forms. A brute force way would be to build my own meta-XML data and
combine that with XSLT to generate HTML pages dynamically. But, before I
go
off an build anything I wanted to ask around first to see if anyone was
doing the same thing, new of any open source tools, 3rd party tools,
etc...

Any info is appreciated and thanks in advance for any help,

Will









RE: struts training

2001-08-06 Thread devon . bowen

 Sign me up for the course!  Where might I read about these
 points: ??
   - preloading form
   - reset() method gotcha
   - special issues
   - cleaning up context variables
   - Back button sorrow
   - indexed properties and iterators

If I knew that, I wouldn't need to design my own course. ;-)

Devon




RE: Re: struts training

2001-08-06 Thread devon . bowen

 If you wanted to slim this down, and your goal is just to
 bring them up to speed on Struts, I'd hazard to say that
 there's much that a Struts developer doesn't ~really~ need
 to know about Web application development.

Not sure I agree with this. My experience with Struts indicates
that it is still not robust enough for this kind of thinking.
I believe that a developer that doesn't have a reasonably deep
understanding will become very frustrated very quickly. I can't
tell you the number of times that I've had to dive into the
source code to answer my questions. When errors occur, a stack
trace is often all the help you get and that requires you to
know the software structure intimately. Then there's the lack
of solid documentation. One can't even buy a book about Struts
yet to help answer questions. And the fact that the people I
am teaching aren't native English speakers doesn't help either.
They would find the volume on this list quite intimidating.

I guess I would agree with you if there were one person in the
group that knew Struts thoroughly and could help the others
when problems arose. At the moment, that would be me. But I am
only contracted here till the end of the year. After that,
these guys need to be able to go it alone. And I think Struts
still expects too much expertise and effort from the developer
to be considered a tool for the average programmer. So my
philosophy is to try to push them to be a bit beyond average.

In any case, thanks for your comments. I will update my outline.

Devon




Action Errors

2001-08-06 Thread Aaron Ravenberg

Hello all,

I did not find an example of the use of this ActionError method.  If someone
could point me to a good example or reply with one I would appreciate it.  I
just wasn't clear how the Object part of the method works.  What object(s)
can you use?  How are they structured so they can replace values.  How are
those values to be replaced identified?

Method:

public ActionError(java.lang.String key,
   java.lang.Object value0)

Construct an action error with the specified replacement values.

Parameters:
key - Message key for this error message
value0 - First replacement value

Thank you,

Aaron




Validation a form

2001-08-06 Thread DUPRAT Alexandre

hi,

How can i validate a form?
I tried : 
public ActionErrors validate(ActionMapping mapping, HttpServletRequest req)
{
ActionErrors errors= new ActionErrors();
if(! getSqlQuery().startsWith(select)){
ActionError error = new ActionError(error.requete);
errors.add(sqlQuery, error);
}
return errors;
}

it works when there is no error but not when i've one
Is there somebody with an idea?

Alexandre Duprat
SOPRA. Direction France Sud. Bordeaux 
[EMAIL PROTECTED]



++
| Ce courrier ainsi que les fichiers joints sont confidentiels.  |
| Si vous avez recu ce courrier par erreur, veuillez en informer |
| l'administrateur du systeme : [EMAIL PROTECTED]   |
|  - |
| Ce message confirme que le courrier a passe le controle|
| antivirus du relais de messagerie Internet avec succes.|
++



RE: NoSuchMethodError with Weblogic 6.0 sp2

2001-08-06 Thread Daniel Steinberg

WebLogic includes a JAXP 1.0 implementation in its weblogic.jar file.  The
startup script puts weblogic.jar in the CLASSPATH ahead of anything in your
WEB-INF/lib directory.  So you will need to modify the startup script to put
a JAXP 1.1 implementation ahead of weblogic.jar.

-Original Message-
From: Irene Hernández [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 03, 2001 4:26 PM
To: struts-user
Subject: NoSuchMethodError with Weblogic 6.0 sp2



Weblogic 6.0 fails when loading servlet action, it throws a
NoSuchMethodError inside Digester.parse

Any ideas?

Irene



logic:iterate / html:option / scriptlet problem

2001-08-06 Thread Tobias . Himstedt

Hi,

the following fragment does not work:

html:form action=addMedication.action
td
html:text property=doseAsInteger size=3/
/td
td
html:select property=dayCategory
logic:iterate id=catEntry name=dayCategorys
html:option value=%=catEntry% key=%= medication.daycategory. + catEntry%/
/logic:iterate
/html:select
/td
/html:form


whereas dayCategorys is a ArrayList containing Integers. The resulting HTML output look like this

form name=medicationForm method=POST action=/HW/addMedication.action?sessionid=O26MPfpCQ2poVw7RkJzDahq8jR2Zg3soZpfx40N3f6g4KVo1qQEc|-786482589992354/168430344/6/7003/7003/7002/7002/7003/-1
td
input type=text name=doseAsInteger size=3 value=0
/td
td
select name=dayCategoryhtml:option value=100024 key=medication.daycategory.100024/

html:option value=100025 key=medication.daycategory.100025/

html:option value=100026 key=medication.daycategory.100026//select
/td

/form

which is correct apart from the fact that there is still a html:option ... rather than a simple option It seems that the html:option is not properly evaluated.

Any hints?

Thanks -- Tobias

Antwort: Validation a form

2001-08-06 Thread Tobias . Himstedt

Did you enable validate=true in struts-config.xml for that action?

Regards -- Tobias







DUPRAT Alexandre [EMAIL PROTECTED]
06.08.2001 15:28
Bitte antworten an struts-user


An:'[EMAIL PROTECTED]' [EMAIL PROTECTED]
Kopie:
Thema:Validation a form

hi,

How can i validate a form?
I tried : 
public ActionErrors validate(ActionMapping mapping, HttpServletRequest req)
{
 ActionErrors errors= new ActionErrors();
 if(! getSqlQuery().startsWith(select)){
 ActionError error = new ActionError(error.requete);
 errors.add(sqlQuery, error);
 }
 return errors;
}

it works when there is no error but not when i've one
Is there somebody with an idea?

Alexandre Duprat
SOPRA. Direction France Sud. Bordeaux 
[EMAIL PROTECTED]



++
| Ce courrier ainsi que les fichiers joints sont confidentiels. |
| Si vous avez recu ce courrier par erreur, veuillez en informer |
| l'administrateur du systeme : [EMAIL PROTECTED]|
| -   |
| Ce message confirme que le courrier a passe le controle|
| antivirus du relais de messagerie Internet avec succes.|
++




RE: Antwort: Validation a form

2001-08-06 Thread DUPRAT Alexandre

i have this int parameter in web.xml for ActionServlet :
init-param
   param-namevalidate/param-name
   param-valuetrue/param-value
 /init-param
 
it seem to work cause i can debug the method in visula age for java.
I enter the method but i've an error 500 as response from my web server.

-Message d'origine-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Date: lundi 6 août 2001 16:14
À: [EMAIL PROTECTED]
Objet: Antwort: Validation a form



Did you enable validate=true in struts-config.xml for that action? 

Regards -- Tobias 




DUPRAT Alexandre [EMAIL PROTECTED] 


06.08.2001 15:28 
Bitte antworten an struts-user 



An:'[EMAIL PROTECTED]'
[EMAIL PROTECTED] 
Kopie: 
Thema:Validation a form


hi,

How can i validate a form?
I tried : 
public ActionErrors validate(ActionMapping mapping, HttpServletRequest req)
{
ActionErrors errors= new ActionErrors();
if(! getSqlQuery().startsWith(select)){
 ActionError error = new
ActionError(error.requete);
 errors.add(sqlQuery, error);
}
return errors;
}

it works when there is no error but not when i've one
Is there somebody with an idea?

Alexandre Duprat
SOPRA. Direction France Sud. Bordeaux 
[EMAIL PROTECTED]



++
| Ce courrier ainsi que les fichiers joints sont confidentiels.  |
| Si vous avez recu ce courrier par erreur, veuillez en informer |
| l'administrateur du systeme : [EMAIL PROTECTED]   |
|  - |
| Ce message confirme que le courrier a passe le controle|
| antivirus du relais de messagerie Internet avec succes.|
++




++
| Ce courrier ainsi que les fichiers joints sont confidentiels. |
| Si vous avez recu ce courrier par erreur, veuillez en informer |
| l'administrateur du systeme : [EMAIL PROTECTED] |
| - |
| Ce message confirme que le courrier a passe le controle |
| antivirus du relais de messagerie Internet avec succes. |
++





Antwort: RE: Antwort: Validation a form

2001-08-06 Thread Tobias . Himstedt

Have a look in the WEB-INF/struts-config.xml. Look for your action element and in particluar for the validate attribute.

Regr

  action  path=/editRegistration
   type=org.apache.struts.webapp.example.EditRegistrationAction
   name=registrationForm
   scope=request
 validate=false
^^
   forward name=success   path=/registration.jsp/
  /action


Hope this helps -- Tobias








DUPRAT Alexandre [EMAIL PROTECTED]
06.08.2001 16:26
Bitte antworten an struts-user


An:'[EMAIL PROTECTED]' [EMAIL PROTECTED]
Kopie:
Thema:RE: Antwort: Validation a form

i have this int parameter in web.xml for ActionServlet :
init-param
  param-namevalidate/param-name
  param-valuetrue/param-value
 /init-param
 
it seem to work cause i can debug the method in visula age for java.
I enter the method but i've an error 500 as response from my web server.

-Message d'origine-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Date: lundi 6 août 2001 16:14
À: [EMAIL PROTECTED]
Objet: Antwort: Validation a form



Did you enable validate=true in struts-config.xml for that action? 

Regards -- Tobias 




 DUPRAT Alexandre [EMAIL PROTECTED] 


06.08.2001 15:28 
Bitte antworten an struts-user 



An:'[EMAIL PROTECTED]'
[EMAIL PROTECTED] 
Kopie: 
Thema:Validation a form


hi,

How can i validate a form?
I tried : 
public ActionErrors validate(ActionMapping mapping, HttpServletRequest req)
{
ActionErrors errors= new ActionErrors();
if(! getSqlQuery().startsWith(select)){
 ActionError error = new
ActionError(error.requete);
 errors.add(sqlQuery, error);
}
return errors;
}

it works when there is no error but not when i've one
Is there somebody with an idea?

Alexandre Duprat
SOPRA. Direction France Sud. Bordeaux 
[EMAIL PROTECTED]



++
| Ce courrier ainsi que les fichiers joints sont confidentiels. |
| Si vous avez recu ce courrier par erreur, veuillez en informer |
| l'administrateur du systeme : [EMAIL PROTECTED]|
| -   |
| Ce message confirme que le courrier a passe le controle|
| antivirus du relais de messagerie Internet avec succes.|
++




++
| Ce courrier ainsi que les fichiers joints sont confidentiels. |
| Si vous avez recu ce courrier par erreur, veuillez en informer |
| l'administrateur du systeme : [EMAIL PROTECTED] |
| - |
| Ce message confirme que le courrier a passe le controle |
| antivirus du relais de messagerie Internet avec succes. |
++






Funny request parameters

2001-08-06 Thread Hardee, Tony

We just upgraded our versions of WebLogic and Struts. 
WebLogic :  6.0 sp 2   ==  6.1.  
Struts: 1.0 nightly build Feb ? 2001 == 1.0
Most things worked without a hitch, however we are experiencing a problem
that I am having difficulty resolving.

We have the following entries defined in struts_config.xml:

!-- update buyer form bean --
form-bean  name=updateBuyerForm
type=net.ps.gui.user.UpdateBuyerForm/

!-- update buyer --
actionpath=/updateBuyer
   type=net.ps.gui.user.UpdateBuyerAction
   name=updateBuyerForm
  scope=request
  input=/pages/updateBuyer.jsp
   validate=false
  forward name=success  path=/pages/updateBuyer.jsp/
  forward name=failure  path=/pages/updateBuyer.jsp/
  forward name=securityErrorpath=/logoff/
/action

The UpdateBuyer form has a step attribute with a getStep() and a setStep()
method.

The update buyer action is first invoked with the url
../cmd/updateBuyer?step=prepare. where /cmd/*  is mapped to the struts
action servlet.  Everything works as expected.  The updateBuyer jsp displays
a form with a hidden property for step where the value is 'commit'

html:form action=/cmd/updateBuyer
  html:hidden property=step value=commit/ 
...

html:submit
  bean:message key=button.submit/
/html:submit
/html:form

When the user fills in the form and pushes the submit button, the
updateBuyer action is invoked and the step parameter in the
HttpServletRequest object has two values 'prepare' and 'commit'.  I would
only expect one value (i.e., 'commit').  This behavior is consistent for all
parameters that are passed in via the original url.

Previously this code worked.  Nowhere in the updateBuyer.jsp can 'prepare'
be found.  It is as if the request state from the previous request is being
maintained across requests.

Does anyone have an idea as to what might be occurring.

Thanks in advance,

Tony





Indexed tags problem

2001-08-06 Thread Andrew Paul Swift

I am using the indexed tags (cheers, made my life a lot easier!) but I am
having a problem.

When submitting a form the data in the form is not updated. I have got
updates working elsewhere, but I can't get this working. 

Is it because I use a nested property in the iterate tag i.e.
getPerson().getPersonFields();


Cheers in advance

Andy

=== JSP
logic:iterate id=personField name=personFormproperty=person.personFields   
 
  td
html:text name=personField property=value indexed=true/
  /td
/logic:iterate

=== HTML produced
  td
  input type=text name=personField[0].value value=1000831
  /td

=== struts-config.xml

form-bean name=personForm type=forms.PersonForm/

!-- Action that retrieves details about a person --
actionpath=/person   type=actions.PersonAction   
name=personForm   scope=session   input=/customerSearch.jsp
forward name=success path=/personDetail.jsp/
/action

!-- Action that stores details about a person --
actionpath=/storePerson   type=actions.StorePersonAction   
name=personForm   scope=session   input=/personDetail.jsp
forward name=cancel  path=/customerSearch.jsp/
forward name=delete  path=/customerSearch.jsp/
forward name=savepath=/personDetail.jsp/
/action

 Log

action: Processing a POST for /storePerson
action:  Looking for ActionForm bean under attribute 'personForm'
action:  Recycling existing ActionForm bean instance of class
'forms.PersonForm'
action:  Populating bean properties from this request
action:  Validating input form properties
action:   No errors detected, accepting input
action:  Looking for Action instance for class actions.StorePersonAction
action:   Double checking for Action instance already there
action:   Creating new Action instance
action:  Saving customer 



-
To send us encrypted mail, please refer to:
http://www.millionhandshakes.com/emailpolicy/pgp.html

Million Handshakes



RE: Re: struts training

2001-08-06 Thread Craig R. McClanahan

I agree with Devon's concerns about this.  Struts assumes a pretty robust
understanding of the general principles of servlet and JSP programming
(including the intricacies of a web application archive file).

The good news for developers is that all of this level of knowledge is
transferrable, because the underlying specs are used by *any* servlet and
JSP environment, and the various app servers and servlet containers
implement them (pretty much, and getting better :-) the same way.  But you
are going to be an unhappy camper if you don't know what load-on-startup
does, or that you have to make session attributes thread safe, or how the
/WEB-INF directory is organized, or ...).

Craig

On Mon, 6 Aug 2001 [EMAIL PROTECTED] wrote:

  If you wanted to slim this down, and your goal is just to
  bring them up to speed on Struts, I'd hazard to say that
  there's much that a Struts developer doesn't ~really~ need
  to know about Web application development.
 
 Not sure I agree with this. My experience with Struts indicates
 that it is still not robust enough for this kind of thinking.
 I believe that a developer that doesn't have a reasonably deep
 understanding will become very frustrated very quickly. I can't
 tell you the number of times that I've had to dive into the
 source code to answer my questions. When errors occur, a stack
 trace is often all the help you get and that requires you to
 know the software structure intimately. Then there's the lack
 of solid documentation. One can't even buy a book about Struts
 yet to help answer questions. And the fact that the people I
 am teaching aren't native English speakers doesn't help either.
 They would find the volume on this list quite intimidating.
 
 I guess I would agree with you if there were one person in the
 group that knew Struts thoroughly and could help the others
 when problems arose. At the moment, that would be me. But I am
 only contracted here till the end of the year. After that,
 these guys need to be able to go it alone. And I think Struts
 still expects too much expertise and effort from the developer
 to be considered a tool for the average programmer. So my
 philosophy is to try to push them to be a bit beyond average.
 
 In any case, thanks for your comments. I will update my outline.
 
 Devon
 
 




Re: A small Favour

2001-08-06 Thread Craig R. McClanahan



On Mon, 6 Aug 2001, Rohit Dewangan wrote:

 
 Hi All,
 
 Could anybody help me to unsubscribe from your mailing list.
 
 I have tried atleast 3-4 times from http://jakarta.apache.org/struts but am
 still getting tons of mail.
 

I'd like to help ... but there's a slight problem.  There is no
subscription to the list under [EMAIL PROTECTED] (or any variation
of this that I can find).  That means one of two things:

* You subscribed under an alternate email address that is being
  forwarded to your same mailbox.  In that case, you'll need to
  follow the directions in the mailing list info to unsubscribe
  from an alternate address.  For instance, if I were to unsubscribe
  that way (I'm subscribed under [EMAIL PROTECTED]), I'd have to send
  mail to:

[EMAIL PROTECTED]

* Someone in your organization has subscribed an internal mailing
  list to STRUTS-USER, and the messages are being forwarded to you.
  If that's what is happening, there is nothing that we can do about
  it at the mailing list end -- you'll have to track it down yourself.

 Thanks in advance.
 
 Regards
 Rohit
 

Craig McClanahan




Re: URL links ActionServlet

2001-08-06 Thread Craig R. McClanahan



On Mon, 6 Aug 2001, Rodney Smith wrote:

 Hallo,
 
 Firstly I would like to thank Ted Husted for all his help with me
 getting a better understanding of Struts, as I am a new to this area a
 lot of the information that I have found is great but not detailed
 enough to understand some of the process as what Ted has mentioned is
 perfect, thanks again Ted.
 
 OK the questions are still coming as follows.
 I am using Tomcate3.2.2 and runing of a localhost:
 In the example I am using

I am assuming you are talking about the struts-example.war example that
is shipped with Struts, right?

 I have the index.jsp page and in that I have two html links, one goes
 to get registered with the web application and the other is logon to
 the web application. If I click on logon this takes me to the
 logon.jsp page. When I client clicks on this as this is a .jsp this
 does not go to the actionservlet as that is not a .do action 'is that
 correct'? instead that just calls the viewer of logon.jsp??? or does
 this go direct to the JAVABEAN by passing the ActionServlet to get the
 logonform.java???
 

You can see when you run the app that the log on link does indeed link
directly to logon.jsp.  It works in this case because there is no setup
necessary to prepopulate the LogonForm bean.  When the html:form tag in
logon.jsp is executed, it will see that the form bean does not exist,
and will create one automatically with default values.

In general, I do recommend going through an action for things like this --
you'll see this technique used later.

 Now if the client clicks on the registation URL link on the index.jsp
 it comes back with a editregistration.do on the browser bar, in this
 case, as this is displaying the .do,

Actually, it is *not* displaying the .do.  Here's what really happens:

* The form submit is dispatched to the LogonAction action.

* Based on whether or not you typed the correct username and password,
  LogonAction selects whether to send you forwards to the main menu,
  or backwards to the logon page again (with an error message).

* This choice is made by selecting which ActionForward instance is
  returned from the perform() method.

* Struts uses the path inside that ActionForward to execute a
  RequestDispatcher.forward() call to the selected page.

* The forward() all happens on the server side, so the browser's location
  bar is not updated.

The bottom line is this - there is almost no relationship between what
shows in the location bar and what page really created the response.


 does that mean that actually has
 been to the ActionServlet to JAVABEAN and comes back with the
 registration form display or does this just go to the viewer and
 retreives the registration.jsp form, with out going to the
 ActionServlet?? I understand that if the person sends a request 'A' to
 logon to the web application it needs to be a .do and needs to go to
 the ActionServlet 'B' I think that it goes the same with the
 registration as well. It is when they are asking for the forms to
 submit is where I don't know where they are stored or if they need to
 be retreived from the JSP viewer etc.
 
 Thanks for your time and I hope that can get another good response.
 Many thanks Ted and have a great day.
 

See above for the details, but you should totally ignore the location bar
when running any web app that uses RequestDispatcher.forward(), not just a
Struts based app.  The location bar only tells you where you *submitted
to*, not where the response came from.

 Kind Regards
 Rodney Smith
 
 -- 
 Sent through GMX FreeMail - http://www.gmx.net
 
 
Craig





Re: html:select and html:options

2001-08-06 Thread Craig R. McClanahan



On Mon, 6 Aug 2001, Stefan Faist wrote:

 Hello all,
 I these two lists:
 td
   bean:define name=erfassungForm id=names property=allProjektNamen /
   html:select property=projektname
   html:options collection=names property=value 
labelProperty=label /
   /html:select
 /td
 td
   bean:define name=erfassungForm id=aktivitaeten
 property=allProjekt_aktivitaeten /
   html:select property=aktivitaetname
   html:options collection=aktivitaeten property=value
 labelProperty=label /
   /html:select
 /td
 
 I want this:
 When I select one element in the list ... id=names ... the then the list
 ... id=aktivitaeten ... get elements, that are the activities from the
 element of the first list. Is there a way to call a action when I select a
 element?
 I hope you understand what I want.
 

There are two possible scenarios, depending on how big the various lists
of options for the second select box is.

* You can use Javascript to detect changes in the first select box,
  and dynamically change the contents of the second box.  This requires
  that the various choices for the second box are small enough to have
  been included in the page -- perhaps as Javascript arrays of strings.

* You can use Javascript to detect changes in the first select box,
  and then submit the form for you.  You'll need to tell the Action that
  receives the form that this is *only* being submitted to repopulate
  the second select box -- perhaps by setting the value of a particular
  hidden variable in the form -- so that it will just redisplay the form
  with the updated values.

None of this is really particular to Struts -- we're stuck with the
capabilities of HTTP and HTML that we are running on top of.

 Is there any way to do this?
 Can someone help me?
 
 Best regards,
 STEFAN
 

Craig McClanahan




Re: Validation a form

2001-08-06 Thread Craig R. McClanahan



On Mon, 6 Aug 2001, DUPRAT Alexandre wrote:

 hi,
 
 How can i validate a form?
 I tried : 
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest req)
 {
   ActionErrors errors= new ActionErrors();
   if(! getSqlQuery().startsWith(select)){
   ActionError error = new ActionError(error.requete);
   errors.add(sqlQuery, error);
   }
   return errors;
 }
 
 it works when there is no error but not when i've one
 Is there somebody with an idea?
 

The above code looks OK -- what about it doesn't work?

Note that you *must* specify an input attribute on your Action, so that
Struts knows where to send the user back to.

 Alexandre Duprat
 SOPRA. Direction France Sud. Bordeaux 
 [EMAIL PROTECTED]
 

Craig McClanahan




servlet.getServletContext() always null...why?

2001-08-06 Thread Jon Crater

i have a base action class in which i declare a variable of type 
ServletContext:

public abstract class BaseAction extends Action
{
   protected ServletContext ctx = servlet.getServletContext();
   ...
}

yet i always get a NullPointerException on this line when struts tries to 
instantiate a subclass of this base class.  why?

2001-08-06 01:13:55 - path=/bc :action: Error creating Action instance for 
path '/Login', class name 'com.gs.bc.action.LoginAction' - 
java.lang.NullPointerException
at com.gs.bc.action.BaseAction.init(BaseAction.java:15)
at com.gs.bc.action.LoginAction.init(LoginAction.java:16)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at 
org.apache.struts.action.ActionServlet.processActionCreate(ActionServlet.java:1631)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1576)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at 
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at 
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




Question: Struts on Weblogic - Urgent please

2001-08-06 Thread Upadhye, Sujit (GEAE, Foreign National)

Hi,

I am using Struts on Weblogic 5.1 with SP9. Initially I developed my app on
Tomcat. Here, I am forwarding control to another action object. So, in my
config.xml, I have:

forward name=next path=/detcontrol.do redirect=true/

I start my app on Tomcat through URL:
http://localhost/wls/cmweb/detrunselect.do. When I submit this page, the new
URL I get is:
http://localhost/wls/cmweb/detcontrol.do.

This is the expected behavior.

However, when I try to run the same on Weblogic, the second URL comes up as:
http://localhost/cmweb/detcontrol.do.

Please note that 'wls' get dropped from the URL. This causes the app to
fail. Can some one tell me how can I still get the 'wls' while using
'redirect = true'?

For my Tomcat, I have an entry in server.xml as:
Context path=/wls/cmweb docBase=apps/cmweb debug=0
reloadable=true/Context
I feel it is this entry that is adding 'wls' to the relative path. Where can
I add this entry for the Weblogic. (Weblogic does not seem to have
server.xml).

Thanks in advance,

Sujit



Re: Unit testing Actions

2001-08-06 Thread Paul Holser

i've had some success unit testing struts actions using cactus.
here's what i did:

0) replicate your approot in the test webapp, including struts-config.xml
1) in the web.xml (or webapp file for websphere test environment), add
struts initialization parameters to the cactus ServletRedirector servlet
2) write a class that extends org.apache.commons.cactus.ServletTestCase.
a skeletal example is below.

i'm interested to hear feedback on this approach.  overkill, not enough?
as it stands, i have to create an ActionServlet and init() it with the config
object i get for free from cactus (which because of step 1 has the config
params that struts needs).  seems kind of wacky.

public class SomeActionTest
extends ServletTestCase
{
  private ActionServlet servlet;
  private Action action;

  public SomeActionTest(String name)
  {
super(name);
  }

  public static Test suite()
  {
return new TestSuite(SomeActionTest.class);
  }

  public static void main(String[] args)
  {
new junit.swingui.TestRunner().run(SomeActionTest.class);
  }

  protected void setUp() throws Exception
  {
super.setUp();

this.servlet = new ActionServlet();
servlet.init(config);

this.action = new SomeAction();
action.setServlet(servlet);
  }

  protected void tearDown() throws Exception
  {
servlet.destroy();

super.tearDown();
  }

  public void testPerform()
  {
try
{
  ActionForward forward =
action.perform(
  servlet.findMapping(/produceAForm),
  null,
  request,
  response);

  assertEquals(success, forward.getName());

  ActionFormBean formBeanDef = servlet.findFormBean(aForm);
  Object obj = request.getAttribute(aForm);
  assertNotNull(obj);
  assertEquals(formBeanDef.getType(), obj.getClass().getName());
}
catch (Exception e)
{
  fail(threw:  + e);
}
  }

}


 [EMAIL PROTECTED] 07/31/01 04:04AM 

Hi John,
If you don't get any answer on the struts-user mailing list please repost on the 
cactus-user list, I know for sure that several persons have done it and would be able 
to give you the code. Basically, there is no helper class for the time being, meaning 
that before calling your action, you'll need to create needed Struts objects. But as 
Struts is very well designed and is using the composition approach (meaning that 
objects are not hard-linked with each other but rather you initialize an object by 
passing it needed domain objects) there is no problem with that and it works fine.

-Vincent
- Original Message - 
From:John Yu
To:[EMAIL PROTECTED] 
Sent: Tuesday, July 31, 2001 8:31 AM
Subject: Unit testing Actions


Is there any sample showing how to do unit testing for Actions? How do I use Cactus to 
do it? 

Thanks.

-- 
John Yu Scioworks Technologies 
e: [EMAIL PROTECTED] w: +(65) 873 5989
w: A href=http://www.scioworks.comnbsp;http://www.scioworks.comA 
href=http://www.scioworks.comnbsp;m: +(65) 9782 9610 




MVC via DOM

2001-08-06 Thread Steven Elliott

I have learned alot about MVC (and M2C) from this list and its authors and
in general agree that the Struts model is a *better* way to do things (in
lieu of the JSP and/or Servlet  and Bean design).

On the otherhand I have been uncomfortable adopting the BEAN|JSP|ACTION
paradigm because of JSP as the main component for expressing views.
Although I also have issues with Lutris and Enhydra, I do think that XMLC
brings a more intuitive and generalized interface to the View component
(especially when you consider that from the XML data you can derive several
views of the same data; cHTML, HTML, WML, et al).

I have no interest in beginning a war of words over the best View or
Presentation technology available but I would like to know of any like
mindedness and if anyone is working on a true open source implementation of
View technology based on DOM (Xerces and Xalan) for Struts.  Although I may
not have the technical where withall of some of the other members of this
list I can carry coffee and would like to help.

Thanks.

//* 
Steven Elliott  [EMAIL PROTECTED]
Head of Technology
VTV Learning Corporation
 Los Angeles  -  Boston  -  Lisbon
www.vtvlearning.com





When session invalidates, template doesn't clear out....

2001-08-06 Thread Becky Moyer

Hi all...
   I have a webapp that uses Struts templates.  I have a place in my 
template where I plug in the current user's username and basic info.  I can 
sucessfully do a session.invalidate(), but then when I link back to my 
loginpage, their info still shows up on the template.  How do they really 
work?  I thought they would get reloaded everytime, but it seems that they 
don't fully reload.  Is this true?

   Thanks,
   Becky


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




Using STRUTS with Servlet Exec

2001-08-06 Thread Vince Davis

I just downloaded STRUTS  and am hoping to use it with the ServletExec
JSP/Servlet server. I noticed in the install file that there is no
reference to Servlet Exec, and am wondering if it's compatible with STRUTS
and if there are any additional steps I need to take in setting it up
(besides simply dragging the WAR file into the 'WebApps' directory). Also,
Is there anything I should watch out for that might save me hours of
needless agonizing? Thanks in advance for any help you can offer me.

Regards,  

 


Vince Davis, Sr. Consultant
Integrated Information Systems, Inc.
p   (480)-317-8746
c   (602)-738-8134
f   (480)-317-8010
e   [EMAIL PROTECTED]
www.iis.com http://www.iis.com
NASDAQ: IISX


__
Integrated Information Systems is an innovative 
technology and business consultancy providing 
extensive experience and insight to create a 
sustainable competitive edge for clients.


__

LEGAL NOTICE - Unless expressly stated otherwise, 
this message is confidential and may be privileged. 
It is intended for the addressee(s) only. If you are 
not an addressee, any disclosure or copying of the 
contents of this e-mail or any action taken (or not 
taken) in reliance on it is unauthorized. If you are 
not an addressee, please inform sender immediately. 







RE: Form processing question

2001-08-06 Thread Marcel Maré

You do know there's a typo in your example, don't you? You're trying to pair
a logic:notPresent with a /logic:present (note the missing not). Maybe
it's only in your email, but it has bitten me IRL.

Marcel

 -Oorspronkelijk bericht-
 Van: Greg Maletic [mailto:[EMAIL PROTECTED]]
 Verzonden: maandag 6 augustus 2001 1:29
 Aan: Martin Cooper; [EMAIL PROTECTED]
 Onderwerp: RE: Form processing question


 That was my idea, too, but it doesn't seem to work.  I'm doing the
 following:

 logic:present parameter=productId %
   html:form action=editProductConfirmed.do
 /logic:present
 logic:notPresent parameter=productId %
   html:form action=addProductConfirmed.do
 /logic:present


 But the parser goes nuts with this.  XML doesn't allow improperly nested
 tags, so it complains that there's no matching /html:form tag inside of
 the logic:present tag.

 Does anyone have any other ideas?

 Thanks.

 -Original Message-
 From: Martin Cooper [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, August 04, 2001 11:27 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: Form processing question


 One way to do this would be to use the Struts conditional tags to
 generate a
 different URL on the page for edit versus add. You could base the decision
 on the presence or absence of your productId parameter.

 --
 Martin Cooper


 - Original Message -
 From: Greg Maletic [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, August 02, 2001 5:09 PM
 Subject: Form processing question


  I have a JSP that is used to edit data on a ActionForm bean.  There are
 two
  ways for users to reach this JSP:  1) if they're adding a new
 object into
 my
  app; 2) if they're editing an existing object in my app.  I'm using two
  mappings in my struts-config.xml file to represent these two types of
  actions (/add and /edit), although they both map to this same JSP.
  (Additionally, the /edit mapping has a parameter called
 productId that
  describes which product to edit, while the /add mapping doesn't have a
  parameter.)
 
  It's the behavior when the JSP's form is submitted that I'm
 having trouble
  with.  If the JSP was reached through the add mapping, I want it to go
 to
  an /addExecute mapping that will actually add the object.  And if the
 JSP
  was reached through the edit mapping, I want the form to go to an
  /editExecute mapping that will actually make the modifications to the
  object.  (As above, the /editExecute mapping needs a productId
 parameter
  specified--passed through from the original /edit mapping--while the
  /addExecute mapping doesn't.)  Unfortunately, I can't figure
 out how to
  conditionally make the form submit to one of two different actions
  (/addExecute or /editExecute).
 
  Is there a way to make this work?  Is this the right technique
 for solving
  this problem?  If not, could someone please let me know how this is
  typically done?
 
  Thanks!
 
  Greg
 
 








Re: servlet.getServletContext() always null...why?

2001-08-06 Thread Craig R. McClanahan



On Mon, 6 Aug 2001, Jon Crater wrote:

 i have a base action class in which i declare a variable of type 
 ServletContext:
 
 public abstract class BaseAction extends Action
 {
protected ServletContext ctx = servlet.getServletContext();
...
 }
 
 yet i always get a NullPointerException on this line when struts tries to 
 instantiate a subclass of this base class.  why?
 

Because instance variable initialization expressions like this are
executed (effectively) when the constructor is called -- so Struts has not
yet had time to initialize the servlet property.

I suggest you override setServlet() instead:

protected ServletContext ctx = null;

public void setServlet(ActionServlet servlet) {
  super(servlet);
  if (servlet != null)
ctx = servlet.getServletContext();
  else
ctx = null;
}


Craig




Re: MVC via DOM

2001-08-06 Thread Craig R. McClanahan

On Mon, 6 Aug 2001, Steven Elliott wrote:

 I have learned alot about MVC (and M2C) from this list and its authors and
 in general agree that the Struts model is a *better* way to do things (in
 lieu of the JSP and/or Servlet  and Bean design).
 
 On the otherhand I have been uncomfortable adopting the BEAN|JSP|ACTION
 paradigm because of JSP as the main component for expressing views.
 Although I also have issues with Lutris and Enhydra, I do think that XMLC
 brings a more intuitive and generalized interface to the View component
 (especially when you consider that from the XML data you can derive several
 views of the same data; cHTML, HTML, WML, et al).
 

Yep ... XMLC is pretty cool.

 I have no interest in beginning a war of words over the best View or
 Presentation technology available but I would like to know of any like
 mindedness and if anyone is working on a true open source implementation of
 View technology based on DOM (Xerces and Xalan) for Struts.  Although I may
 not have the technical where withall of some of the other members of this
 list I can carry coffee and would like to help.
 

For the general use of XML data (and XSLT transformations) in web
applications, I would definitely start by looking at the Cocoon project
http://xml.apache.org.  Some Struts users have used Cocoon as the view
layer for part or all of their applications.

If you are a heavy user of the Struts custom tag libraries, you will find
that this integration is not necessarily easy, because your XSLT
stylesheets have to emulate the kinds of HTML generation that the Struts
tags do.  On the other hand, for view operations that are primarily
display oriented, it should be as simple as setting up your forward
declarations to invoke the Cocoon servlet with the appropriate parameters
to get the output you need.

 Thanks.
 
 //* 
 Steven Elliott  [EMAIL PROTECTED]
 Head of Technology
 VTV Learning Corporation
  Los Angeles  -  Boston  -  Lisbon
 www.vtvlearning.com
 
 
 

Craig McClanahan





RE: Form processing question

2001-08-06 Thread Greg Maletic

Thanks; it's a typo in my e-mail.  The solution that Craig posted
earlier--store the form name in a variable and evaluate it with %= %
tags--works great.


-Original Message-
From: Marcel Maré [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 12:10 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Form processing question


You do know there's a typo in your example, don't you? You're trying to pair
a logic:notPresent with a /logic:present (note the missing not). Maybe
it's only in your email, but it has bitten me IRL.

Marcel

 -Oorspronkelijk bericht-
 Van: Greg Maletic [mailto:[EMAIL PROTECTED]]
 Verzonden: maandag 6 augustus 2001 1:29
 Aan: Martin Cooper; [EMAIL PROTECTED]
 Onderwerp: RE: Form processing question


 That was my idea, too, but it doesn't seem to work.  I'm doing the
 following:

 logic:present parameter=productId %
   html:form action=editProductConfirmed.do
 /logic:present
 logic:notPresent parameter=productId %
   html:form action=addProductConfirmed.do
 /logic:present


 But the parser goes nuts with this.  XML doesn't allow improperly nested
 tags, so it complains that there's no matching /html:form tag inside of
 the logic:present tag.

 Does anyone have any other ideas?

 Thanks.

 -Original Message-
 From: Martin Cooper [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, August 04, 2001 11:27 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: Form processing question


 One way to do this would be to use the Struts conditional tags to
 generate a
 different URL on the page for edit versus add. You could base the decision
 on the presence or absence of your productId parameter.

 --
 Martin Cooper


 - Original Message -
 From: Greg Maletic [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, August 02, 2001 5:09 PM
 Subject: Form processing question


  I have a JSP that is used to edit data on a ActionForm bean.  There are
 two
  ways for users to reach this JSP:  1) if they're adding a new
 object into
 my
  app; 2) if they're editing an existing object in my app.  I'm using two
  mappings in my struts-config.xml file to represent these two types of
  actions (/add and /edit), although they both map to this same JSP.
  (Additionally, the /edit mapping has a parameter called
 productId that
  describes which product to edit, while the /add mapping doesn't have a
  parameter.)
 
  It's the behavior when the JSP's form is submitted that I'm
 having trouble
  with.  If the JSP was reached through the add mapping, I want it to go
 to
  an /addExecute mapping that will actually add the object.  And if the
 JSP
  was reached through the edit mapping, I want the form to go to an
  /editExecute mapping that will actually make the modifications to the
  object.  (As above, the /editExecute mapping needs a productId
 parameter
  specified--passed through from the original /edit mapping--while the
  /addExecute mapping doesn't.)  Unfortunately, I can't figure
 out how to
  conditionally make the form submit to one of two different actions
  (/addExecute or /editExecute).
 
  Is there a way to make this work?  Is this the right technique
 for solving
  this problem?  If not, could someone please let me know how this is
  typically done?
 
  Thanks!
 
  Greg
 
 









Re: TILES template with STRUTS problem

2001-08-06 Thread Cedric Dumoulin


  Which xml parser do you use ?
  Tiles, like Struts1.1-dev use commons.Digester package, which requires Jaxp1.1 to 
run.

Cedric

BinhMinh Nguyen wrote:

 Hi,

 When copied the titles-doc.WAR into Tomcat 's webapps
 and run. The following error-message display.
 Can you spot out the error please.

 Binh Nguyen, a big fan of Component and Tiles

 er('-//Sun Microsystems, Inc.//DTD Web Application
 2.2//EN', 'jar:file:C:\jakarta-tomcat-3.2.3
 ps\tiles-doc\WEB-INF\lib\struts.jar!/org/apache/struts/resources/web-app_2_2.dtd'
 er('-//Sun Microsystems, Inc.//DTD Web Application
 2.3//EN', 'jar:file:C:\jakarta-tomcat-3.2.3
 ps\tiles-doc\WEB-INF\lib\struts.jar!/org/apache/struts/resources/web-app_2_3.dtd'
 er.getParser:
 xml.parsers.ParserConfigurationException: Namespace
 not supported by SAXParser
   at
 com.sun.xml.parser.SAXParserImpl.init(SAXParserImpl.java:60)
   at
 com.sun.xml.parser.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:57)
   at
 org.apache.commons.digester.Digester.getParser(Digester.java:407)
   at
 org.apache.commons.digester.Digester.parse(Digester.java:1088)
   at
 org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java:1272)
   at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:459)
   at
 org.apache.struts.tiles.ActionComponentServlet.init(ActionComponentServlet.java:56)
   at
 javax.servlet.GenericServlet.init(GenericServlet.java:258)
   at
 org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
   at
 org.apache.tomcat.core.Handler.init(Handler.java:215)
   at
 org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
   at
 
org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOnStartupInterceptor.j
 0)
   at
 org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:491)
   at
 org.apache.tomcat.core.ContextManager.init(ContextManager.java:453)
   at
 org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195)
   at
 org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
 ion in thread main java.lang.NoSuchMethodError
   at
 org.apache.commons.digester.Digester.parse(Digester.java:1088)
   at
 org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java:1272)
   at
 org.apache.struts.action.ActionServlet.init(ActionServlet.java:459)
   at
 org.apache.struts.tiles.ActionComponentServlet.init(ActionComponentServlet.java:56)
   at
 javax.servlet.GenericServlet.init(GenericServlet.java:258)
   at
 org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
   at
 org.apache.tomcat.core.Handler.init(Handler.java:215)
   at
 org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
   at
 
org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOnStartupInterceptor.j
 0)
   at
 org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:491)
   at
 org.apache.tomcat.core.ContextManager.init(ContextManager.java:453)
   at
 org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195)
   at
 org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
 arta-tomcat-3.2.3\bin

 __
 Do You Yahoo!?
 Make international calls for as low as $.04/minute with Yahoo! Messenger
 http://phonecard.yahoo.com/






Re: Problem using TILES template with STRUTS

2001-08-06 Thread Cedric Dumoulin


  Tiles tutorial is now merged in tiles-doc, under tiles-doc/tutorial. Also,
Tiles require a Jaxp1.1 compliant XML parser.

 Cedric

BinhMinh Nguyen wrote:

 Hi,
 I am a big fan of your Components, it woks very
 pretty. But since you rename Component to Tiles
 things are not pretty any more:)
 I have hard time switching one Components to Tiles
 , I did every things following your instrcutions, and
 it is  still not working.

 Even when I just copy directly thetiles-doc-war that
 is provided in the tiles.zip file into my webapps
 directory of Tomcat and tried to run it, Tomcat-
 3.2.3,  just cannot load it.
 NeClassDefFoundException: SAV's defaultHAndler cannot
 be found or something.

 I am now waiting for the Tiles tutorials :) right
 now it is not avaialbe yet.

 Can anyone provide more details tutorials or step by
 step config about  using Tiles ,  what is the
 minimal requirements to use Tiles:  what API, what it
 to be in web.xml, strut-config.xml, and
 componentDefintions.xml

 thank you very much

 __
 Do You Yahoo!?
 Make international calls for as low as $.04/minute with Yahoo! Messenger
 http://phonecard.yahoo.com/





RE: Using STRUTS with Servlet Exec

2001-08-06 Thread Robert Taylor

Hello Vince,

I'm currently using Struts 1.0 with ServletExec 4.0 ISAPI for Microsoft IIS
on Win2000 and have not had any problems. It was pretty simple. If you use
.war file, you can do as you mentioned already and put it in the
[SEversion]/webapps/default directory. When SE starts up, then it will
unpack the .war file to ServletExec Data/default/[webapp name]. One gotcha I
ran into was manually creating the directory structure (instead of using a
.war file) and then registering my web app using the SE admin interface.
You need to remember to give your root web app directory the appropriate
permissions or it won't be able to write to the log file.

HTH,

robert
 -Original Message-
 From: Vince Davis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, August 06, 2001 3:06 PM
 To: '[EMAIL PROTECTED]'
 Subject: Using STRUTS with Servlet Exec


 I just downloaded STRUTS  and am hoping to use it with the ServletExec
 JSP/Servlet server. I noticed in the install file that there is no
 reference to Servlet Exec, and am wondering if it's compatible with STRUTS
 and if there are any additional steps I need to take in setting it up
 (besides simply dragging the WAR file into the 'WebApps' directory). Also,
 Is there anything I should watch out for that might save me hours of
 needless agonizing? Thanks in advance for any help you can offer me.

 Regards,




 Vince Davis, Sr. Consultant
 Integrated Information Systems, Inc.
 p (480)-317-8746
 c (602)-738-8134
 f (480)-317-8010
 e [EMAIL PROTECTED]
 www.iis.com http://www.iis.com
 NASDAQ: IISX

 __
 __
 __
 Integrated Information Systems is an innovative
 technology and business consultancy providing
 extensive experience and insight to create a
 sustainable competitive edge for clients.

 __
 __
 __

 LEGAL NOTICE - Unless expressly stated otherwise,
 this message is confidential and may be privileged.
 It is intended for the addressee(s) only. If you are
 not an addressee, any disclosure or copying of the
 contents of this e-mail or any action taken (or not
 taken) in reliance on it is unauthorized. If you are
 not an addressee, please inform sender immediately.










IF statement in struts-config.xml

2001-08-06 Thread Yi-Xiong Zhou

Hi, 

I think it will be very useful if struts can have IF statement in
struts-config.xml to control the foward/ action. 

I am thinking of building a purely configurable system using struts
framework. A system whose actions can be reassembled and chained to make new
functionalities. IF statements are key to chain actions. 

Has any plan to implement the IF function in struts-config.xml underway? 

Yi-Xiong Zhou



RE: IF statement in struts-config.xml

2001-08-06 Thread Assenza, Chris

Hmmm, I'm not sure I see the value in this (at least actually IN the XML
file) - could you explain in more detail what you intend to do? 

Chris

-Original Message-
From: Yi-Xiong Zhou [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 5:02 PM
To: '[EMAIL PROTECTED]'
Subject: IF statement in struts-config.xml


Hi, 

I think it will be very useful if struts can have IF statement in
struts-config.xml to control the foward/ action. 

I am thinking of building a purely configurable system using struts
framework. A system whose actions can be reassembled and chained to make new
functionalities. IF statements are key to chain actions. 

Has any plan to implement the IF function in struts-config.xml underway? 

Yi-Xiong Zhou



RE: processPopulate() call configurable?

2001-08-06 Thread Marcel Mare

Please see comments below


 If you don't want processPopulate() to be called, just omit the form bean
 from your action element.

  The underlying problem is that if I prefill my form, all the values are
  overwritten by the Request objects current parameter values.
 
  I this something that other people have run into? Any work around?
 

 If your case is what I'm thinking it is, you probably want to consider
 using different actions for prepopulating (and then displaying) a form,
 versus accepting (and processing) the form submit.

 Consider in the struts-example application what happens when you select
 the Edit your registration profile option from the main menu:

 * This link goes to the /editRegistration action, which
 * Prepopulates the form bean, and

But it does NOT create the bean and RegistrationForm.Reset() is called
because it is listed as a form bean. To circumvent this (to be able to
create the RegistrationForm oneself) it could be omitted as a form bean, but
then you wouldn't be able to get the attribute name (by calling
mapping.getAttribute())

 * Forwards to the /registration.jsp page to display it with
   values from the database.
 * Then, the form is submitted to the /saveRegistration action,
   which validates the input (returning on any errors) or does
   the appropriate database action.

The form bean's Reset() would *again* be called possibly undoing all
previous manipulations.
So is the only option to not implement a formbean Reset() method?

Why is this seemingly simple task of prepopulating a form so difficult?

Thanks

Marcel




Re: IF statement in struts-config.xml

2001-08-06 Thread Bill Clinton

Hello,
  The mappings that are set up in the struts-config.xml can be 
modified programmatically.  So, if you want to reconfigure a forward, 
you would not need an if statement in the struts config, but I believe 
you can do it in your program that references the forward.

For example:

ActionForward forward = mapping.findForward(success);
forward.setPath(my new path);

disclaimer:
I have not changed actual forwards this way (except by accident).  I 
have modified the paths in a forward, but I have always created a new 
forward object to be returned by my ActionServlet.  I would be worried 
that a modified forward could be garbage collected and set back to its 
original value from the struts-config when called for again.  Maybe 
someone else could comment on whether or not this is a potential problem.

I do it like this to avoid potential problems:

ActionForward forward = mapping.findForward(success); 
ActionForward newForward = new ActionForward(forward.getPath());
//do stuff to modify path
return newForward;

Bill


forward.setPath(my new path);







Yi-Xiong Zhou wrote:

 Hi, 
 
 I think it will be very useful if struts can have IF statement in
 struts-config.xml to control the foward/ action. 
 
 I am thinking of building a purely configurable system using struts
 framework. A system whose actions can be reassembled and chained to make new
 functionalities. IF statements are key to chain actions. 
 
 Has any plan to implement the IF function in struts-config.xml underway? 
 
 Yi-Xiong Zhou




how to create a submit button with my own image

2001-08-06 Thread Long Zhao

for a struts form, html:form action=/html:form,
how to create a submit button with my own image?

I have tried to use javascript to do
onclick=javascript:window.document.form.submit(),
but it did not work, because the struts form do not
have a name for the form.

Thanks

Long

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/



Re: Question: Struts on Weblogic - Urgent please

2001-08-06 Thread Pham Thanh Quan

Try putting it into the file web.xml in Web-inf directory
Quan

- Original Message -
From: Upadhye, Sujit (GEAE, Foreign National) [EMAIL PROTECTED]
To: Craig R. McClanahan [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 12:40 AM
Subject: Question: Struts on Weblogic - Urgent please


 Hi,

 I am using Struts on Weblogic 5.1 with SP9. Initially I developed my app
on
 Tomcat. Here, I am forwarding control to another action object. So, in my
 config.xml, I have:

 forward name=next path=/detcontrol.do redirect=true/

 I start my app on Tomcat through URL:
 http://localhost/wls/cmweb/detrunselect.do. When I submit this page, the
new
 URL I get is:
 http://localhost/wls/cmweb/detcontrol.do.

 This is the expected behavior.

 However, when I try to run the same on Weblogic, the second URL comes up
as:
 http://localhost/cmweb/detcontrol.do.

 Please note that 'wls' get dropped from the URL. This causes the app to
 fail. Can some one tell me how can I still get the 'wls' while using
 'redirect = true'?

 For my Tomcat, I have an entry in server.xml as:
 Context path=/wls/cmweb docBase=apps/cmweb debug=0
 reloadable=true/Context
 I feel it is this entry that is adding 'wls' to the relative path. Where
can
 I add this entry for the Weblogic. (Weblogic does not seem to have
 server.xml).

 Thanks in advance,

 Sujit





Session attributes thread safe

2001-08-06 Thread Michael Mok

Hi all

This may be an off topic discussion. Craig mentioned about the need to make
session attributes thread safe.

What are the factors to look out for in order to make session attributes
thread safe?

Thanks in advance

Regards

Michael Mok


-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 7 August 2001 0:12
To: [EMAIL PROTECTED]
Subject: RE: Re: struts training


I agree with Devon's concerns about this.  Struts assumes a pretty robust
understanding of the general principles of servlet and JSP programming
(including the intricacies of a web application archive file).

The good news for developers is that all of this level of knowledge is
transferrable, because the underlying specs are used by *any* servlet and
JSP environment, and the various app servers and servlet containers
implement them (pretty much, and getting better :-) the same way.  But you
are going to be an unhappy camper if you don't know what load-on-startup
does, or that you have to make session attributes thread safe, or how the
/WEB-INF directory is organized, or ...).

Craig






Re: Session attributes thread safe

2001-08-06 Thread Craig R. McClanahan



On Tue, 7 Aug 2001, Michael Mok wrote:

 Hi all
 
 This may be an off topic discussion. Craig mentioned about the need to make
 session attributes thread safe.
 

Thought that might catch someone's attention ... :-)

 What are the factors to look out for in order to make session attributes
 thread safe?
 

It's worthwhile to first review a couple of reasons why you should care
about this.  Consider the following scenarios:

* Your application uses frames (when you refresh the entire page,
  the browser will often issue multiple simultaneous requests for
  the different frames).

* Your user opens multiple windows to the same application (which will
  be part of the same session in most cases), and is performing requests
  on more than one window at the same time.

* Your user starts a long-running request, presses stop, and then starts
  a different request before the first one has finished.

In each case, you will have multiple requests accessing the same session
(and therefore the same session attributes.  So, how worried should you
be?

The general principle I use is enlightened paranoia -- will your
application give back to the correct results, even if the worst possible
combination of interactions from the multiple requests happpens?

Most of the time, you are concerned about requests that *modify* a session
attribute causing problems for some other request that is either modifying
the same attribute at the same time, or is trying to read stuff from that
attribute while some other request is writing to it.   Let's take the
multiple writes problem first.

If your property is a simple type (a primitive type or a String), you
generally don't need to worry too much.  Whichever assignment happens last
wins.  But there won't be the case that a pointer to the underlying value
is halfway updated so that a simultaneous reader gets a totally bogus
value.  In technical terms, assignments of Strings and primitives can be
considered atomic in Java.  On the other hand, if the underlying
property is complex (such as a linked list), it is clearly possible for
simultaneous writes (or a write that is simultaneous with one or more
reads) to interfere with each other.

Multiple simultaneous read operations are generally not a problem,
because they usually don't cause any change to the internal structure of
the objects being read.

The situation gets more interesting when there are one or more read
operations that are going on simultaneous with a write operation.  Again,
primitives and Strings are not the problem -- but complex data types
are.  Just as an example, consider a property represented as a linked list
that is being modified by one request while being read by another.  It is
very easy to conceive of how the pointers to the next and/or
previous elements could be modified at an inopportune time while the
reading request is trying to process the list.

The general strategy when you have the potential for thread safety
problems is to use the synchronized modifier in your Java
classes.  You don't want to do this universally, because there is a
performance cost -- so you want to be diligent about understanding where
it is needed.  Synchronization can be done at two levels:

* You can add synchronized to the getter and setter methods themselves.
  In effect, you are allowing only a single getter or setter operation
  on the entire object containing these methods.  It works, but sometimes
  it is overkill.  (In technical terms, synchronizing a method is the same
  as creating a block like this:

synchronized (this) {
  ... contents of this method ...
}

  because it locks access to this entire object instance.)

* You can create a synchronized block around access to a particular
  instance variable.  In this sceanrio you will be serializing access to
  a particular instance variable, without impeding access to other
  variables in the same session attribute.  This can improve performance
  over the case where you synchronize the methods themselves, but this
  is only noticeable if multiple simultaneous access really does happen.

Note that, in some cases, the underlying classes you are using take care
of synchronization for you.  For example, java.util.Hashtable guarantees
that any get() or put() operation you execute cannot corrupt other
get or put operations that are happening simultaneously.  On the other
hand, the java.util.HashMap class (with very similar
functionality) makes no such guarantees -- synchronization is up to the
caller.  This can really help performance in single-threaded applications
that (by definition) cannot have multiple threads accessing the same
object at the same time, but it becomes your responsibility to worry about
it.

NOTE:  The servlet API requires that a container guarantee
the thread-safety of calls like session.setAttribute().  Your
application does *not* have to synchronize those calls - it
does need to worry about what happens when two requests call
  

using a Collection from nested attributes for option tag

2001-08-06 Thread Sorenson, Alexander

I have previously been populating my options form elements from
ArrayLists I have stored in the application scope.  I am now
implementing a more robust caching mechanism for this information and am
trying to find the best way to access these collections now.  For
example to get to one of my collections now, I would use the following
call:
ArrayList countries = CacheManager.getMenuCache().getCountries(); 

CacheManager is stored at the application scope, under
Const.CACHE_MANAGER_KEY.  
Is there a way to just use the options tag, with something like: 
html:options collection=%
session.getAttribute(Const.CACHE_MANAGER_KEY).getMenuCache().getCountrie
s() % property=value labelProperty=label/

or do I need to have a jsp:useBean tag to get to the collection?

Thanks,
Alex



New User For Struts

2001-08-06 Thread Prashant Deshmukh



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




Re: how to create a submit button with my own image

2001-08-06 Thread Pham Thanh Quan

The name of the form is in the file struts-config.xml.

action path=...
...
name=this_is_the_form_name_you_want
/action

Quan

- Original Message - 
From: Long Zhao [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 5:21 AM
Subject: how to create a submit button with my own image 


 for a struts form, html:form action=/html:form,
 how to create a submit button with my own image?
 
 I have tried to use javascript to do
 onclick=javascript:window.document.form.submit(),
 but it did not work, because the struts form do not
 have a name for the form.
 
 Thanks
 
 Long
 
 __
 Do You Yahoo!?
 Make international calls for as low as $.04/minute with Yahoo! Messenger
 http://phonecard.yahoo.com/
 




Re: how to create a submit button with my own image

2001-08-06 Thread Pham Thanh Quan

You may use this 

html:form
...
input type=image src=your_image
/html:form

Quan

- Original Message - 
From: Long Zhao [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 5:21 AM
Subject: how to create a submit button with my own image 


 for a struts form, html:form action=/html:form,
 how to create a submit button with my own image?
 
 I have tried to use javascript to do
 onclick=javascript:window.document.form.submit(),
 but it did not work, because the struts form do not
 have a name for the form.
 
 Thanks
 
 Long
 
 __
 Do You Yahoo!?
 Make international calls for as low as $.04/minute with Yahoo! Messenger
 http://phonecard.yahoo.com/