AW: Struts+Weblogic+WARs

2000-12-07 Thread Andre Wittenburg

Hi Jeff,

 Andre,
 
 I am running into the exact same situation as you described in your
 original
 post, so I was excited to see the solution.  However, when I tried it, I
 get
 a NullPointerException when I startup weblogic.
 
 
[Andre Wittenburg]  

The following 4 lines are important for the precompile process:

weblogic.system.startupClass.myStartup=WebAppStartup
weblogic.system.startupArgs.myStartup=  webAppContext= 

#weblogic.httpd.documentRoot=

weblogic.httpd.defaultWebApp=c:/foo/root/ 
--
If i delete "weblogic.httpd.defaultWebApp", i also get the null
pointer exception.

Hope that's all.

Andre

P.S.: If you have a defautl webApp and a documentRoot the
defautlWebApp overrules the documentRoot. 



RE: design question

2000-12-07 Thread Lacerda, Wellington (AFIS)

If you can identify consistent patterns in your scriptlet usage, yes.
Otherwise it's questionable. Even the division of labor is questionable case
you can't, because page designers will end up having to deal with several
different tags used once or twice among the several pages (which tag for
what in which page ?).

So, the idea is to plan in advance. Heavily.

My 2 cents.

Wellington


-Original Message-
From:   Jim Richards [mailto:[EMAIL PROTECTED]]
Sent:   07 December 2000 02:56
To: [EMAIL PROTECTED]
Subject:design question


As I understand it, is the basic design of struts generally
to avoid
any direct Java code in the .jsp files, and do everything
through tags?

And although we can so things within % % tags, it is not
preferred?

Just wondering before I embark on my project, if it's worth
including the
design of any extra tags, or just doing the things I want in
% % ...


--
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: EJB references

2000-12-07 Thread Alix Jermyn


Pretty much what I was thinking of too - my vague memory is that the Bean
container handles the synchronisation problem, so you can share the single
home references from your cache helper across the application without any
worries.

If you are feeling really confident, you may want to control the
initialisation process through deployment desciptors using the struts
digester...


--Original Message-
-From: Jim Richards [mailto:[EMAIL PROTECTED]]
-
-You probably need to create a helper class that does all this work, 
-keeps the references as public variables and create it as a 
-singleton in
-the init of the servlet, and store it as an application wide variable
-so you can access it easily and have references to all the 
-session beans.
-
-I can't remember the deal though with synchronisation and EJBs, you
-had better check on that as there will be a high possibility of 
-multiple threads (servlets) accessing it at the same time.
-



Re: Article on JavaWorld

2000-12-07 Thread Curtis Cooley
Haven't read it yet but the November issue of The Java Report has a struts article.

Ted Husted wrote:
[EMAIL PROTECTED]">On 12/4/2000 Jean-Baptiste Nizet wrote:
  This shows, once again, that Struts is more andmore used and
recognized in the Java community.On 11/3/2000 Nikolaus Rumm wrote:
but go to http://www.informit.com/, Programming/Java and look for
  Maneesh Sahu's article on struts. I checked the archive for "articles" and "powered" and came up with thereference to an InformIt article (that I couldn't find there). Anyone have other struts article or powered by references?
  
  
  -- 
Curtis R. Cooley
[EMAIL PROTECTED]
  




RE: EJB references

2000-12-07 Thread Wong Kok Wai

Caching of home references will not work in a
clustered environment as the reference will become
invalid if the original server goes down and another
takes over.

--- Alix Jermyn [EMAIL PROTECTED] wrote:
 
 Pretty much what I was thinking of too - my vague
 memory is that the Bean
 container handles the synchronisation problem, so
 you can share the single
 home references from your cache helper across the
 application without any
 worries.
 


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



RE: org.apache.struts.action.MESSAGE exception with orion 1.4

2000-12-07 Thread Wong Kok Wai

I'd similar problem with ServletExec. My solution is
the put all the property and dtd files needed by
Struts in a separate jar and add it to the classpath.

--- Juan Gargiulo [EMAIL PROTECTED] wrote:
 I finally got it working by removing
 struts-config_1_0.dtd from the
 struts.jar file. And locating this file under:
 \WEB-INF\classes\org\apache\struts\resources\
 
 Also, instead of placing the
 ApplicationResources.properties file under
 orion\lib, you can jar it and place it under
 \WEB-INF\lib
 
 hope this helps,
 
 juan
 


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



Re: Sruts Mailing List Archive

2000-12-07 Thread Angus Mezick

Nope, this isn't a frequently asked question.
--Angus

Ted Husted wrote:
 
 http://www.mail-archive.com/struts-user%40jakarta.apache.org/
 
 is also good.
 
 *** REPLY SEPARATOR  ***
 
 On 12/6/2000 at 11:38 AM Evan Vaala wrote:
 
 Is there a Struts Mailing List Archive somewhere?
 
 Thanks!
 
 Evan Vaala



Are this bugs ?

2000-12-07 Thread Mueller, Franz

Hello,

I've noticed the following behaviour:

declaring an Action like:

actionpath="/logon"
   type="action.LogonAction"
   name="logonForm"
 input="/Logon.html"

   scope="request"
   validate="true"
  forward name="success" path="/showShops.do" /
/action

I'm getting a servlet exception and as a result the Logon.html file is
overwritten 
(the file itself is still there but the content is gone).
If I specify (instead of the extension .html) "/Logon.jsp" it works as
expected.


Just wondering:
In the code of ActionServlet I've noticed that the access to the actions
member in the method processActionCreate 
(in the try - block) is not synchronized. 


FM 




DB connection pool

2000-12-07 Thread NESTORS Andris (AC-Creation)

The Struts documentation gives some clear instructions on how to set up a
servlet which will create a DB connection pool (of your choice) on startup.
 
Out of interest, why use this technique rather than make the connection pool
a singleton [GoF] which would initialise itself on the first request for a
connection ?
 
- Nes



java.io.NotSerializableException: Serialization problems running Struts on Weblogic

2000-12-07 Thread Punyansky, Alex

Hi,

We created an application based on struts and are trying to deploy it on
Weblogic 6.0 beta2. Looks like Weblogic doesn't look at distributable / in
web.xml and requires all classes that can be used as context attributes to
be serializable. We tried to make MessageResources and ErrorMessages classes
implement Serializable but we still get the following Exception:

Dec 7, 2000 10:38:51 AM EST Error HTTP mark myserver main
guest  101002 [WebAppServletContext(5383266,trsitev11)] Could not
deserialize context attribute 
java.io.NotSerializableException: java.util.PropertyResourceBundle
at
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
at
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
at
weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:7
1)
at
weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
text.java:207)
at
weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:164)
at
org.apache.struts.taglib.form.ErrorsTag.doStartTag(ErrorsTag.java:180)
at jsp_servlet._login._jspService(_login.java:88)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:149)
at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1210)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1075)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:387)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:149)
at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1210)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1075)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:387)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:1107)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1482)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

Does anyone know of any way to fix this problem?


Thanks

Alex



RE: Submitting forms to alternate actions

2000-12-07 Thread NESTORS Andris (AC-Creation)

Michael

How do you get the values for SUBMIT_xxx.do out of the request ?

I don't see any attribute or parameter in the request with name "name" or
"SUBMIT_xxx.do" 

I think I may have misunderstood 

- Nes

# -Original Message-
# From: Michael Westbay [mailto:[EMAIL PROTECTED]]
# Sent: Tuesday, December 05, 2000 5:55 AM
# To: [EMAIL PROTECTED]
# Subject: Re: Submitting forms to alternate actions
# 
# 
# Richards-san wrote:
# 
#  With JavaScript you can specify the form action, so you'd have 
#  something like:
#  
#  form name="aForm" action="defaultAction.do" 
# onSubmit="return checkSubmit(this);"
#  input type="submit" name="button1" value="use 
# default action"
#  input type="submit" name="button2" value="use 
# other action" onClick="document.aForm.action='otherAction.do';"
#  /form
# 
# I tried that in a web application a long time ago.  Worked great with
# Netscape, the action never changed in IE3.  I'd gotten so fed up with
# IE from that and other projects, that I avoid client-side scripting
# as much as possible.
# 
# However, it shouldn't be hard to write an Action that will handle
# forwarding the action.  Something like:
# 
#   form name="aForm" action="dispatcherAction.do" 
# onSubmit="return checkSubmit(this);"
#   input type="submit" name="SUBMIT_defaultAction.do" 
# value="use default action"
#   input type="submit" name="SUBMIT_otherAction.do" 
# value="use other action"
#   /form
# 
# Then, have dispatcherAction look for which SUBMIT_xxx.do was sent,
# take the suffix, and forward.  There you have a general action 
# dispatcher for all your forms.  Just don't name any fields other
# than submit buttons to anything with a "SUBMIT_" prefix.
# 
# The only problem I can see with this is when one can hit enter instead
# of a button.  Oh, but can't that only happen when there is if 
# ((one and
# only one edit box) and (one and only one submit button))?  Maybe it
# is OK for all cases.
# 
# --
# Michael Westbay
# Work: Beacon-IT http://www.beacon-it.co.jp/
# Home:   http://www.seaple.icc.ne.jp/~westbay
# Commentary: http://www.japanesebaseball.com/
# 



getting Locale strings in a ActionForm

2000-12-07 Thread Johan Compagner

hi,

I want to use a html select with a few options.

Those options are specified in resourcebundles for different locales.

I have a CustomForm class:

class CustomForm 
{
public String[] getOptionValues()
{
return new String[]{"resourcekey1","resourcekey2"}
}

public String[] getOptionLabels()
{
String[] asValues = getOptionValues();
String[] asLabels = new String[_asValues .length];
org.apache.struts.util.MessageResources messages = servlet.getResources();
for (int i = 0; i  asWaarden.length; i++)
{
asLabels[i] = messages.getMessage(asValues [i]);
}
return asLabels;
}
}

i use this in a JSP page:

  struts:select property="optionvalue"
struts:options property="optionValues"   labelProperty="optionLabels"/
  /struts:select

This goes well for the default locale, but if i let the user changes it's locale then
everything changes with it except the options in the select!!

This is because the messages.getMessage(asValues [i]); call the 
message.getMessage(Locale locale ,)
with the locale as a null property.
And when the MessageResources class gets a null locale it uses the default locale of 
the server.
So when the server has a locale nl_NL and the users selects a different one: en_US
everything else that uses struts:message / changes but not the options.

Can i get the handle to the current session object in a ActionForm bean?
Why not set the Session object also so that we have much more power/data at our hands?
So why nog change the protected ActionForm processActionForm into this:

 protected ActionForm processActionForm(ActionMapping mapping, HttpServletRequest 
request) 
{

  // Is there a form bean associated with this mapping?
 String attribute = mapping.getAttribute();
  if (attribute == null)
   return (null);

  // Look up the existing form bean, if any
  if (debug = 1)
   log(" Looking for ActionForm bean under attribute '" +  attribute + "'");
 ActionForm instance = null;
 HttpSession session = null;
  if ("request".equals(mapping.getScope())) {
   instance = (ActionForm) request.getAttribute(attribute);
  } else {
   session = request.getSession();
   instance = (ActionForm) session.getAttribute(attribute);
  }
  if (instance != null)
 {
  instance.setSession(session); //ADDED
   return (instance);
 }

  // Create a new form bean if we need to
  if (debug = 1)
   log(" Creating new ActionForm instance");
  String name = mapping.getName();
  String className = null;
  ActionFormBean formBean = findFormBean(name);
  if (formBean != null)
   className = formBean.getType();
  if (className != null) {
   try {
Class clazz = Class.forName(className);
instance = (ActionForm) clazz.newInstance();
instance.setServlet(this);
   } catch (Throwable t) {
log("Error creating ActionForm instance of class '" +
 className + "'", t);
   }
  }
  if (instance == null)
   return (null);

  // Store the newly created bean in the appropriate scope
  if (debug = 1)
   log(" Storing instance under attribute '" +
attribute + "'");
  if ("request".equals(mapping.getScope()))
   request.setAttribute(attribute, instance);
  else
   session.setAttribute(attribute, instance);

instance.setSession(session); //ADDED

  return (instance);

 }

Johan Compagner















RE: Example for Internationalization

2000-12-07 Thread Aditya Kapur

Hi,
I have attached the changed classes and the jsp files along with the source.
Heres how to use it. Replace the logon.jsp in struts-example subdir with the
file in my distribution. Also replace the class files LogonAction.class and
LogonForm.class
(If you unzip this zip file in your webapps directory it should be enough)

In case any of you need clarification you can contact me.
Thanks,
Aditya

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 06, 2000 12:32 PM
To: [EMAIL PROTECTED]
Subject: Re: Example for Internationalization


Aditya Kapur,

Please do post your example, as least to my email account if you prefer. I
have tried this i18n issue and was stuck somewhere, and regreted that I
don't see an adequate  example to start with.

Thanks,

Deping


- Original Message -
From: "Aditya Kapur" [EMAIL PROTECTED]
To: "Struts-User (E-mail)" [EMAIL PROTECTED]
Sent: Wednesday, December 06, 2000 3:21 PM
Subject: Example for Internationalization


 Hi All,
 I was building some prototype for my company and I have modified the
Struts
 out-of-box example to add a language drop down on the Login page (which
just
 displays English and German) and if the user logs in after selecting the
 language as German all the screens are in German.

 If anybody is interested I can post the modified example and the code.

 Aditya Kapur
 Office (248) 699 3275






 struts-example.zip


Re: How does one get an instance of the GenericDataSource?

2000-12-07 Thread Craig R. McClanahan

"George Henry C. Daswani" wrote:

 Hello,

 I've editted the configuration in my "struts-config.xml" and added
 a data source.  I'm wondering, how does one grab an instance of a generic
 data source so that I get do a getConnection on it..

 By default, is it dumped into the servlet context?  if so, what attribute
 name?

 Is it dumped into the servlet request and tagged via an attribute name?
 if so, what name?


Yes, it is.  The name it's stored under is the public string constant
Action.DATA_SOURCE_KEY (the actual value is
"org.apache.struts.action.DATA_SOURCE").


 I'm trying to access it from an Action:perform method which has input
 parameters of ActionMapping, ActionForm, HttpServletRequest, and
 HttpServletResponse.

DataSource ds = (DataSource)
  servlet.getServletContext().getAttribute(Action.DATA_SOURCE);

Better documentation is on the way!


 George

 --

Craig McClanahan



Re: design question

2000-12-07 Thread Craig R. McClanahan

"Lacerda, Wellington (AFIS)" wrote:

 If you can identify consistent patterns in your scriptlet usage, yes.
 Otherwise it's questionable. Even the division of labor is questionable case
 you can't, because page designers will end up having to deal with several
 different tags used once or twice among the several pages (which tag for
 what in which page ?).

 So, the idea is to plan in advance. Heavily.


One more issue to consider is development tools support.

As we look into the (very) near-term future, we see tools that are starting to
support custom tags in exciting ways, including creating the actual visual
representation by running a servlet container in the background while you are
developing.  Thanks to the TLD, an IDE can create a nice UI for selecting
available custom tags, populating the attributes (including knowing about
required attributes and those that take runtime expressions), and so on.

Pretty much none of this is possible if you are using scriptlets.

To say nothing of the fact that you now need Java developers to maintain your
pages ...


 My 2 cents.

 Wellington


Craig McClanahan





Re: Rewriting the URL in a form:form action

2000-12-07 Thread Erik Horstkotte

Westbay-san wrote:

 Please try something like:
 
 form:form action="%= request.getContextPath() %/x"
 
 While I'm still learning the Struts' tag libraries, I believe that
 this is the way to do it.  I belive that scriplets parse before
 taglibs, so the result of %= request.getContextPath() % will be put
 into the action attribute before the form:form is parsed.  (Please,
 somebody correct me if I'm wrong on that point.)

Unfortunately, it appears that scriptlets parse *after* taglibs. When
I use this, the generated html is:

action="lt;%= request.getContextPath() %gt;/x"

G.

It seems that I may be writing my own taglib sooner than I thought!

-- Erik





Re: Are this bugs ?

2000-12-07 Thread Craig R. McClanahan

"Mueller, Franz" wrote:

 Hello,

 I've noticed the following behaviour:

 declaring an Action like:

 actionpath="/logon"
type="action.LogonAction"
name="logonForm"
  input="/Logon.html"
 
scope="request"
validate="true"
   forward name="success" path="/showShops.do" /
 /action

 I'm getting a servlet exception and as a result the Logon.html file is
 overwritten
 (the file itself is still there but the content is gone).
 If I specify (instead of the extension .html) "/Logon.jsp" it works as
 expected.


What servlet container (aned version) are you using?  It may be that there are
problems doing a RequestDispatcher.forward() to a static resource.  Could you
also post the stack trace that you get?


 Just wondering:
 In the code of ActionServlet I've noticed that the access to the actions
 member in the method processActionCreate
 (in the try - block) is not synchronized.


Currently, "actions" is implemented as a Hashtable, which guarantees thread safe
behavior for you without having to synchronize at the application level.

This would be safe even if a HashMap were used, as long as no thread was
modifying the underlying collection while the ActionServlet was running.



 FM

Craig





Re: war files, and form action question

2000-12-07 Thread Craig R. McClanahan

See intermixed.

Jim Richards wrote:

 I've got two questions,

 this is more to do with my tomcat configuration, but I can't get the
 documentation and exmaples to load as .war files, currently I have
 in tomcat.xml (renamed form server.xml)

 Context path="/struts-documentation"
  docBase="/cyber4/projects/devel/endonet/htdocs/struts-documentation"
  debug="0"
  reloadable="true" 
 /Context

 this is also inside a host .../host tag. It works if I expand the
 .war file out under htdocs/struts-documentation, but otherwise not. How do
 I change the this to make it work?

Tomcat only knows how to auto-expand WAR files if you store them in the webapps 
directory
-- not if they are elsewhere in your filesystem.


 The other question is I had a test application that was working,
 but the the 6-Dec-2000 build it doesn't seem to call the
 form validate method anymore. Have there been any changes
 since the middle of November that missed by me on the configuration
 file or Action class? My struts-config.xml looks like (the important
 bits anyway)


Yes there has, compared to Struts 0.5 ... the validate() method now takes arguments.  
I'm
going to add a deprecated validate() method to ActionForm.java so you will at least get
warned about this.

Note also that the parameters to the perform() method are different in 1.0 versus 0.5 
as
well.  I just added a deprecated perform() method to warn people about this one.

Craig





Re: DB connection pool

2000-12-07 Thread Craig R. McClanahan

"NESTORS Andris (AC-Creation)" wrote:

 The Struts documentation gives some clear instructions on how to set up a
 servlet which will create a DB connection pool (of your choice) on startup.

 Out of interest, why use this technique rather than make the connection pool
 a singleton [GoF] which would initialise itself on the first request for a
 connection ?


Several reasons.

(1) Personal bias :-).  I'm a long-time code hacker, and I've seen *tons* of
people get themselves in trouble with global variables being modified from all
over the place (remember COMMON blocks in Fortran?).  I much prefer a coding
style that says "if you need a reference to a particular object, you should be
handed that reference, or a way to get it."  (By the way, this is why you see
very very few singleton designs in Struts, and I'd like to get rid of some of
the remaining ones.)

(2) Usage flexibility.  Using attribute lookups (or factory methods in general)
lets you make run-time choices of the particular implementation to be returned.
It's not used in this particular case, but I generally prefer the factory
pattern.

(3) Usage in JSP pages.  Having the connection pool as an application-scope
object enables the creation of custom tags that can use it conveniently.

(4) Consistency with J2EE guidelines.  In a J2EE environment, the recommended
approach is to acquire a reference ot your connection pool via JNDI on each
request.  Using an application scope bean simulates that approach in non-J2EE
environments where JNDI might not be available.



 - Nes

Craig





Re: Struts License Model?

2000-12-07 Thread Craig R. McClanahan

"McKisson, Shawn" wrote:



 What is the licensing model for struts?

 The FAQ off of the Jakarta site is broken and I could not find any sort of
 archive.

 Thanks.

 --shawn

Struts, like all projects on the Jakarta site, is licensed under the Apache
Software License http://www.apache.org/LICENSE.  This license is very similar
to the BSD license, and lets you use Struts pretty much any way you like.  See
the license file referenced above for the details.

Craig McClanahan





Re: Example for Internationalization

2000-12-07 Thread Craig R. McClanahan

Aditya,

I'd like to see your changes also ... this sounds like something that would be a
nice addition to the standard Struts example.

Craig McClanahan


Aditya Kapur wrote:

 Hi All,
 I was building some prototype for my company and I have modified the Struts
 out-of-box example to add a language drop down on the Login page (which just
 displays English and German) and if the user logs in after selecting the
 language as German all the screens are in German.

 If anybody is interested I can post the modified example and the code.

 Aditya Kapur
 Office (248) 699 3275



Re: java.io.NotSerializableException: Serialization problems running Struts on Weblogic

2000-12-07 Thread Craig R. McClanahan

"Punyansky, Alex" wrote:

 Hi,

 We created an application based on struts and are trying to deploy it on
 Weblogic 6.0 beta2. Looks like Weblogic doesn't look at distributable / in
 web.xml and requires all classes that can be used as context attributes to
 be serializable. We tried to make MessageResources and ErrorMessages classes
 implement Serializable but we still get the following Exception:


Also, the Serializable restriction when you specify distributable/ relates to
*session* attributes, not *context* attributes.  Requiring context attributes to
be serializable is a platform-specific restriction that WebLogic is imposing.  I
will look into the issues for the Struts-related classes, but it looks to me
like the JDK's ResourceBundle class is not Serializable :-(.

NOTE:  The current design of the Struts example application means it would not
work correctly in a real distributable environment anyway, because the
pseudo-database is stored in memory as a servlet context attribute.

Craig McClanahan





Re: Recommended way of using form:options

2000-12-07 Thread Craig R. McClanahan

Wong Kok Wai wrote:

 What's the recommended usage of form:options? The
 problem I see from the example source is I need to
 ensure the list of values need to be synchronised in
 both the JSP and the action form instance.


One approach that works well when the list of available options is static would
be a strategy like this:
* In the init() method of a startup servlet, load up two
  arrays of the labels and values for a particular combo box.

* Store the two lists as application scope attributes under
  "well known" bean names.  (Struts uses string constants
  defined in the Action class to make sure that all Java components
  are using the same keys).

public static final String FOO_LABELS = "foo.labels";
public static final String FOO_VALUES = "foo.values";

String labels[] = ...
String values[] = ...

getServletContext().setAttribute(MyClass.FOO_LABELS, labels);
getServletContext().setAttribute(MyClass.FOO_VALUES, values);

* In your ActionForm instances (Struts 1.0 version) you can
  get access to these application scope beans like this:

String values[] = (String[])
  servlet.getServletContext().getAttribute(MyClass.FOO_VALUES);

* In your JSP pages, you can reference them like this:

form:select ...
form:options name="foo.values" labelName="foo.labels"/
/form:select

Craig McClanahan



Re: 1.0 readiness?

2000-12-07 Thread Craig R. McClanahan

Laird Nelson wrote:

 Does anyone (Craig) know when 1.0 will be released?  Craig, are you
 holding off for bugfixes or some other piece of functionality?


Well, indirectly it's for functionality that has already been promised, but it's
really been an issue of time :-(.

My original plan was to release a 1.0 beta by the end of November.  That didn't
happen, primarily because I had to go clean up the mess on Tomcat 3.2 and
actually get a release out.  Now that that is done, and the next milestone of
Tomcat 4.0 will happen this week, I *finally* get to focus on Struts in depth
for a couple of weeks.

That being said, I'm going to implement many (but not all) of the requested
features, and get a 1.0 release out as soon as I can -- then proceed immediately
on working on features for 1.1 (which will include remaining things not done in
1.0 plus a bunch of cool new things :-).  Thus, I'm going to focus on things
that need to be in 1.0 to avoid backwards compatibility problems later.


 I'm trying to plan some architectural stuff and want to know whether I
 should base my efforts off the head of the trunk or the 0.5 release.


I would really suggest working off the most recent nightly distributions, rather
than 0.5.  I currently believe that all the changes that might break user code
(like switching ActionForm to be a class) have already been completed --
remaining things added to 1.0 *should not* break user code.


 Thanks in advance.

 Cheers,
 Laird


Craig



Use struts with Weblogic

2000-12-07 Thread Hua Wu
Title: Use struts with Weblogic





Anybody has experience in using struts with Weblogic? I can't get Weblogic find resource file. Any thought? Struts works great with Tomcat.

Hua


Hua Wu
Clarify eBusiness Applications, Nortel Networks
5501 Dillard Drive, Suite 100, Cary NC 27511
Voice: (919) 861-4018 FAX:(919) 861-4122
Email:hwu@nortelnetworks.com
Web Page: http://www.clarify.com







RE: Struts+Weblogic=Problems. Changes to struts?

2000-12-07 Thread Punyansky, Alex

Thanks Matt,

Does it mean that I need to modify Struts by removing support for
internationalization ( removing/replacing PropertiesResourceBundle from
MessageResources )? 

Craig, are you planning to change Struts so that it complies with Servlet
2.3 ( making all attributes Serializable )? 

Alex

-Original Message-
From: Matthew Heaton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 07, 2000 2:14 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Struts+Weblogic=Problems


I posted my concerns on BEA's message board about Weblogic not allowing non
Serialized objects to be placed inside the PageContext are two of the
responses is below.  I was basically told that the servlet 2.3 spec disallow
non serialized objects in the PageContext so built this into the current
release of Weblogic.

-Matt





Matt, 

In order for the reload-on-modify to work correctly, we have to assume that
any objects that go into servlet request, servlet context and HTTP session
are serializable. Otherwise, it's quite easy to get yourself into
ClassCastException situation. 

WLS comes with reload-on-modify turned on out of the box. You can turn it
off by setting reload periods to -1 (never check). There are two separate
params for JSP and servlets. The one for JSPs is set in weblogic.xml
descriptor, the one for servlets is set in the console. 

Thanks, -ruslan 

Matt Heaton wrote: 


 After many unsuccessful attempts at getting Struts to work on Weblogic
5.1, I decided with give it a try on Weblogic 6.0 Beta 2 
 
 Everything seems to be deploying correct except for I get the following
error (which of course breaks everything): 
 
 Nov 30, 2000 1:19:37 PM PST Error HTTP
[WebAppServletContext(6802820,struts-example)] Cou 
 ld not deserialize context attribute 
 java.io.NotSerializableException: java.util.PropertyResourceBundle 
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148) 
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366) 
 at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841) 
 at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480) 
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214) 
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366) 
 at
weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:7
1) 
 at
weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
text.java 
 :207) 
 at
weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:164) 
 at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:230) 
 at jsp_servlet._index._jspService(_index.java:105) 
 at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) 
 at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208) 
 at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:244) 
 at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.jav 
 a:1107) 
 at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1482) 
 at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) 
 at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) 
  
 
 It appears that Weblogic requires any object that you use as a context
attribute on a JSP page must be serializable. I went through some of the
Struts source and it's trying to use objects which aren't serializable as
JSP page context attributes. This looks like it may be a shortcoming in the
JSP spec because it makes sense that to support to failover of sessions you
would need to be able to serialize the attributes since a the attributes of
a PageContext may have the scope of an entire session.   -Matt 


-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 30, 2000 4:54 PM
To: [EMAIL PROTECTED]
Subject: Re: Struts+Weblogic=Problems but this time it looks like it's
Struts


Matthew Heaton wrote:

 The example application itself doesn't put non Serializable objects into
the
 Http session but all throughout the struts code non Serializable objects
are
 placed in the PageContext with a scopes of Application, Page, or Request.
 It appears that Weblogic 6.0 beta may be handling these as if they were
 placed with a Session context and disallowing non serializable objects.
 Whatever is going on it also appears WL is enforcing this rule in non when
 distributable is not set.


Yep.  Looking more closely at the error message, it is complaining about a
non-Serializable *context* attribute, not a *session* attribute.  I, like
others, jumped to the wrong conclusion there.

The spec provides no prohibitions on this -- only a warning that you cannot
use
a context attribute to share information globally in your application (the
way
that the example app does with its pseudo-database) in a 

Re[2]: Are this bugs ?

2000-12-07 Thread Matthias Kerkhoff

 Just wondering:
 In the code of ActionServlet I've noticed that the access to the actions
 member in the method processActionCreate
 (in the try - block) is not synchronized.


 Currently, "actions" is implemented as a Hashtable, which guarantees thread safe
 behavior for you without having to synchronize at the application level.

Craig,

this is not generally correct. I've posted some thoughts on actions, thread
safety, and the map a few weeks ago to STRUTS_DEV. I had the impression that
you did acknowledge in your answer, that there are (many) potential problems
with the thread safety of ActionMappings, _even if_ a HashTable is used.
So...

 This would be safe even if a HashMap were used, as long as no thread was
 modifying the underlying collection while the ActionServlet was running.

... you probably meant

Actions are safe, as long as no two threads do concurrently modify the
underlying collection while the ActionServlet is running.

-- 
Matthias(mailto:[EMAIL PROTECTED])





RE: Use struts with Weblogic

2000-12-07 Thread Lori M Olson
Title: Use struts with Weblogic




http://archive.covalent.net/
Search 
the archive for information. There's lots there.

  -Original Message-From: Hua Wu 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, December 07, 2000 
  1:09 PMTo: '[EMAIL PROTECTED]'Subject: Use 
  struts with Weblogic
  Anybody has experience in using struts with 
  Weblogic? I can't get Weblogic find resource file. Any thought? Struts works 
  great with Tomcat.
  Hua 
  Hua Wu Clarify eBusiness Applications, Nortel Networks 5501 Dillard Drive, Suite 100, Cary NC 27511 
  Voice: (919) 861-4018 FAX:(919) 861-4122 Email:hwu@nortelnetworks.com Web 
  Page: http://www.clarify.com 



Struts examples,docs for 1.0

2000-12-07 Thread Pearce, Bill
Title: Struts examples,docs for 1.0





Hi All, 


Great job on Struts!


We have been playing with 0.5 but now that we are going to start development we are going to download the latest 1.0 beta, and we are aware of some deprecations, changes etc etc. Are there any real traps to look out for? Will the current example code work or has it been updated in the latest build.

cheers,


Bill Pearce


-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 07, 2000 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: EJB references



Boulatian, Misak wrote:


 Hi Jim and Alex,

 I think both of you understood me wrong. I am not planning to access EJBs
 from JSP pages at all. I will have a lot of session EJBs to manipulate
 Entity EJBs. But, the suggested approach accessing them from servlets was:
 - Declare EJB references as private member variables
 - in init() of servlet: initialize enterprise naming context, use that
 context to call lookup to obtain reference, use reference to call portable
 remote object's narrow method (see an example below)



There is one problem with your suggested coding approach that makes it
essentially unusable :-(


Instance variables in a servlet (whether private, protected, or public makes no
difference) are shared among all the requests that are simultaneously accessing
your servlet. The same thing would happen if you use an instance variable to
store an EJB reference in an Action class.


This conflicts with the EJB requirement that a session bean be used by only one
thread at a time. As soon as two simultaneous requests occur, you will have two
threads trying to use m_home at the same time.



 BEGIN EXAMPLE
 public class myservlet extends HttpServlet throws ... {
 private CustomerHome m_home;

 public void init() ... {
 try {
 Properties p = new Properties();
 // ... specify some JNDI properties specific to the vendor
 Context jndicontext = new javax.naming.InitialContext (p);
 Object ref = jndicontext.lookup(CustomerHome);
 m_home = (CustomerHome) PortableRemoteObject.narrow(ref,
 CustomerHome.class);
 
 } catch ... {
 }
 END EXAMPLE

 Then you hold on to m_home reference and reuse it in each thread that
 accesses your servlet. So, my question was, since I am going to have many
 m_home(s) like this what should I do? If I put those in each action class
 then every single time I am going to do above procedure (very resource
 consuming). Or, should I create private member variables in action classes
 and hold on to those home references? As Craig recommended, to create a
 startup servlet and initialize those in there. But, how am I going to make
 all of those availbe to action classes (If this is very simple, pardon my
 knowledge. I am new to using EJBs)?

 If you can give me some more ideas I really appreciated it.


The code part of your init() is pretty close to the recommended procedure. The
big difference is that you should do the lookup for each request, and store the
reference that gets returned in a *local* variable, not an instance variable.
The J2EE Specification, and the Blueprints manual (both available via
http://java.sun.com/j2ee both go into more depth on the recommended idioms for
accessing EJBs and other resources from web applications. These practices work
just fine in a Struts environment as well.



 Thanks,
 Misak



Craig McClanahan





Re: Submitting forms to alternate actions

2000-12-07 Thread Michael Westbay

Andris-san wrote:

 How do you get the values for SUBMIT_xxx.do out of the request ?
 
 I don't see any attribute or parameter in the request with name "name" or
 "SUBMIT_xxx.do" 

The "xxx" is the variable part.

Take the following page and load it in your browser:

  --- begin test.html ---
  html
  body
  form name="aForm" action="test.html"
input type="submit" name="SUBMIT_defaultAction.do" value="use default action"
input type="submit" name="SUBMIT_otherAction.do" value="use other action"
  /form 
  /body
  /html
  --- end test.html ---

Now, click on "use default action".  What is the resulting URL?  I get:

  file:/home/westbay/test.html?SUBMIT_defaultAction.do=use+default+action

By giving a submit button a name, that name and value will be passed with
the form.  This allows you a variable for what action to take on the server
side.

I'm more accustomed to servlets than JSP still, so I may be missing
something here, but one can Enumerate the passed parameters, correct?  Go
through the list of passed parameters until you come across:

  if (key.startsWith("SUBMIT_")) {
  doAction(key.substring(7));
  }

The value of the submit button ("use+default+action") can be discarded.

This method also works with image submit buttons, except you want to trim
off the ".x" and/or ".y" at the end of the key, and ignore one of ".x" or
".y".

I hope that this helps to clarify it.

--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:   http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/



Re: Rewriting the URL in a form:form action

2000-12-07 Thread Michael Westbay

McClanahan-san wrote:

 This approach definitely works ... but it would seem to make sense for the
 form:form tag to assume a path starting with "/" should be interpreted as
 context relative.  Let me think about it a little more -- if there are no
 gotchas, I will make the tag smarter about this.

The only "gotchas" I can think of is when you WANT to go to a different
context.  Several people have expressed that they want to break up development
into several contexts for each subproject, but they should all act as a whole
in the end.  Therefore, it wouldn't be unusual to post to a different context.

Of course, that would most likely be the exception to most circumstances, so
a flag to override action.startsWith("/") would probably allow for both types
to live together.

--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:   http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/



RE: Struts+Weblogic=Problems. Changes to struts?

2000-12-07 Thread Matthew Heaton

They told me that the spec will disallow it but I have no idea if that is
factual or not.  It could just be their interpretation of the spec, from the
snipets I've seen it definetly says you shouldn't put Non Serializable
objects into the session but isn't very clear about putting them into the
PageContext under different scopes.

-Matt

-Original Message-
From: Punyansky, Alex [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 07, 2000 2:17 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Struts+Weblogic=Problems. Changes to struts?


Thanks Matt,

Does it mean that I need to modify Struts by removing support for
internationalization ( removing/replacing PropertiesResourceBundle from
MessageResources )? 

Craig, are you planning to change Struts so that it complies with Servlet
2.3 ( making all attributes Serializable )? 

Alex

-Original Message-
From: Matthew Heaton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 07, 2000 2:14 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Struts+Weblogic=Problems


I posted my concerns on BEA's message board about Weblogic not allowing non
Serialized objects to be placed inside the PageContext are two of the
responses is below.  I was basically told that the servlet 2.3 spec disallow
non serialized objects in the PageContext so built this into the current
release of Weblogic.

-Matt





Matt, 

In order for the reload-on-modify to work correctly, we have to assume that
any objects that go into servlet request, servlet context and HTTP session
are serializable. Otherwise, it's quite easy to get yourself into
ClassCastException situation. 

WLS comes with reload-on-modify turned on out of the box. You can turn it
off by setting reload periods to -1 (never check). There are two separate
params for JSP and servlets. The one for JSPs is set in weblogic.xml
descriptor, the one for servlets is set in the console. 

Thanks, -ruslan 

Matt Heaton wrote: 


 After many unsuccessful attempts at getting Struts to work on Weblogic
5.1, I decided with give it a try on Weblogic 6.0 Beta 2 
 
 Everything seems to be deploying correct except for I get the following
error (which of course breaks everything): 
 
 Nov 30, 2000 1:19:37 PM PST Error HTTP
[WebAppServletContext(6802820,struts-example)] Cou 
 ld not deserialize context attribute 
 java.io.NotSerializableException: java.util.PropertyResourceBundle 
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148) 
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366) 
 at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841) 
 at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480) 
 at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214) 
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366) 
 at
weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:7
1) 
 at
weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
text.java 
 :207) 
 at
weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:164) 
 at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:230) 
 at jsp_servlet._index._jspService(_index.java:105) 
 at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) 
 at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208) 
 at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:244) 
 at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.jav 
 a:1107) 
 at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1482) 
 at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) 
 at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) 
  
 
 It appears that Weblogic requires any object that you use as a context
attribute on a JSP page must be serializable. I went through some of the
Struts source and it's trying to use objects which aren't serializable as
JSP page context attributes. This looks like it may be a shortcoming in the
JSP spec because it makes sense that to support to failover of sessions you
would need to be able to serialize the attributes since a the attributes of
a PageContext may have the scope of an entire session.   -Matt 


-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 30, 2000 4:54 PM
To: [EMAIL PROTECTED]
Subject: Re: Struts+Weblogic=Problems but this time it looks like it's
Struts


Matthew Heaton wrote:

 The example application itself doesn't put non Serializable objects into
the
 Http session but all throughout the struts code non Serializable objects
are
 placed in the PageContext with a scopes of Application, Page, or Request.
 It appears that Weblogic 6.0 beta may be handling these as if they were
 placed with a Session context and disallowing 

Re: Struts+Weblogic=Problems. Changes to struts?

2000-12-07 Thread Craig R. McClanahan

"Punyansky, Alex" wrote:

 Thanks Matt,

 Does it mean that I need to modify Struts by removing support for
 internationalization ( removing/replacing PropertiesResourceBundle from
 MessageResources )?

 Craig, are you planning to change Struts so that it complies with Servlet
 2.3 ( making all attributes Serializable )?


I'm afraid that I see no such requirement in the servlet 2.3 spec (and I'm on
the expert group that came up with it :-).  The only restrictions on
Serializable attributes in the spec itself relate to *session* attributes, not
*context* attributes.  And that restriction only applies when you mark your app
as distributable/.

Note also that the WebLogic response quoted in the message from Ruslan gave an
entirely different reasoning (their application server requires all attributes
to be Serializable if you use the "reload on modify" feature).  That's an
entirely reasonable restriction for WebLogic to place, based on their
container's internal architecture.  It's not, however, a spec compliance issue.

That all being said, I'm looking at ways to make MessageResources a Serializable
object.  Unfortunately, java.util.ResourceBundle (which it relies on) is *not*
Serializable, so a different solution to that is going to be required.

The pseudo-database in the Struts example application (which has nothing to do
with the framework itself) is not Serializable, and will *not* operate correctly
in a distributed environment.  I'm not planning on changing that in the short
term, because it's only there to give you a quick "proof of concept" that Struts
is working, plus some examples of some Struts-related development techniques.


 Alex


Craig



 -Original Message-
 From: Matthew Heaton [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 07, 2000 2:14 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Struts+Weblogic=Problems

 I posted my concerns on BEA's message board about Weblogic not allowing non
 Serialized objects to be placed inside the PageContext are two of the
 responses is below.  I was basically told that the servlet 2.3 spec disallow
 non serialized objects in the PageContext so built this into the current
 release of Weblogic.

 -Matt

 
 

 Matt,

 In order for the reload-on-modify to work correctly, we have to assume that
 any objects that go into servlet request, servlet context and HTTP session
 are serializable. Otherwise, it's quite easy to get yourself into
 ClassCastException situation.

 WLS comes with reload-on-modify turned on out of the box. You can turn it
 off by setting reload periods to -1 (never check). There are two separate
 params for JSP and servlets. The one for JSPs is set in weblogic.xml
 descriptor, the one for servlets is set in the console.

 Thanks, -ruslan

 Matt Heaton wrote:

  After many unsuccessful attempts at getting Struts to work on Weblogic
 5.1, I decided with give it a try on Weblogic 6.0 Beta 2
 
  Everything seems to be deploying correct except for I get the following
 error (which of course breaks everything):
 
  Nov 30, 2000 1:19:37 PM PST Error HTTP
 [WebAppServletContext(6802820,struts-example)] Cou
  ld not deserialize context attribute
  java.io.NotSerializableException: java.util.PropertyResourceBundle
  at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
  at
 java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
  at
 java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
  at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
  at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
  at
 weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:7
 1)
  at
 weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
 text.java
  :207)
  at
 weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:164)
  at
 org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:230)
  at jsp_servlet._index._jspService(_index.java:105)
  at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
  at
 weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
 :208)
  at
 weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
 :244)
  at
 weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
 ntext.jav
  a:1107)
  at
 weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
 :1482)
  at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
  at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
  
 
  It appears that Weblogic requires any object that you use as a context
 attribute on a JSP page must be serializable. I went through some of the
 Struts source and it's trying to use objects which aren't serializable as
 JSP page 

RE: A form with valiable number of beans

2000-12-07 Thread Oliphant, Geoff
Title: RE: A form with valiable number of beans





Joe,


Struts actually gets the bean from either the request or the session.


In your action class or actionservlet create any object that you want and
add it to the request or the session. Struts will perform a findAttribute
to get the object with the same name out of the request or session


What we do is make sure that the object that we add to the session has an
ArrayList of other objects. It is this ArrayList that we are iterating through.


Struts doesn't care what object is in the ArrayList, as long as it has get and
set methods.


So you should be able to create your Order Object in your java class, add an
ArrayList of OrderLines and then add the whole Order object to the request
or session.


Hope this helps.


Geoff


-Original Message-
From: Joe Peer [mailto:[EMAIL PROTECTED]]
Sent: Friday, 8 December 2000 3:27
To: [EMAIL PROTECTED]
Cc: Oliphant, Geoff
Subject: RE: A form with valiable number of beans



hi!


i've got another question regarding the valiable number of beans - problem


 i am using a similar workaround as Geoff explained.


my question acutally is: Goeff, gets your ActionForm - Bean populated 
automatically by struts or do you have to set the dynamic properties (the 
order items) by hand (this is how i am doing that) ?


thanks,
joe



At 01:00 07.12.00, you wrote:


Lars,

I assume you're trying to generate unique text names for each object of your
bean that you are iterating through.

We haven't used the struts:text tags because of this, we use the normal html
input tag but use the struts htmlProperty tag to get the data out:

struts:iterate id=order name=currentOrderBean property=orderLines
input type=text
 name=TXTstruts:htmlProperty name=order property=orderNumber/
 maxlength=6
 size=6
 value=struts:htmlProperty name=order property=orderValue/

/struts:iterate

This will replace the values of the orderNumber and orderValue in the
JSP when it is generated and voila - uniquely named text boxes.

If you submit the form then you just have to get the parameters out of
the request that start with TXT and you've got your primary keys.

Hope this helps.

Geoff

-Original Message-
From: Lars [mailto:[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 6 December 2000 17:55
To: [EMAIL PROTECTED]
Subject: A form with valiable number of beans

I am trying to use Struts to create a page where I am editing an Entity
(e.g. an order) and a variable number of sub-entities (e.g. order lines). I
have corresponding beans in my session (an Order bean with a vector holding
a number of OrderLine beans).

I would like to have certain properties of all sub-entities open for editing
and the page being recreated with all the values if it is submitted and the
displayed again.

How could I use the ActionForm and the tag-library to be able to use the
automatic population of the properties of the form bean?

I have tried to use the logic:iterate tag to build the list of order lines
but stumbled on the naming of each text field. For example, the quantities
field would have to be named quantity1, quantity2, etc. If I use the
form:text tag I can specify the bean and the property, but this gives me an
identical name for all quantity fields. Even if I manage to uniquely name
the fields, how can I create an ActionForm with corresponding properties to
be set by the framework.

Maybe I have to do this manually? Any suggestions how?

If this has been discussed before, please point me to an approximate time
frame.

Regards,
Lars Andersson





IMPORTANT INFORMATION

This message and any files transmitted with it are confidential and should 
be read only by those
persons to whom it is addressed.
If you have received this message in error, please notify us immediately 
by way of reply. Please
also destroy and delete the message from your computer. Any unauthorised 
form of reproduction
of this message is strictly prohibited.

It is the duty of the recipient to virus scan and otherwise test the 
information provided before
loading onto any computer system.
SEALCORP does not warrant that the information is free of a virus or any 
other defect or error.

SEALCORP is not liable for the proper and complete transmission of the 
information contained in
this communication, nor for any delay in its receipt.

Any views expressed in this message are those of the individual sender, 
except where the sender
specifically states them to be the views of SEALCORP.







 IMPORTANT INFORMATION

This message and any files transmitted with it are confidential and should be read only by those
persons to whom it is addressed.   
If you have 

Re: Struts examples,docs for 1.0

2000-12-07 Thread Craig R. McClanahan


"Pearce, Bill" wrote:

Hi All,
Great job on Struts!
We have been playing with 0.5 but now that we are going
to start development we are going to download the latest 1.0 beta, and
we are aware of some deprecations, changes etc etc. Are there any
real traps to look out for? Will the current example code work or has it
been updated in the latest build.

Hi Bill. The example has indeed been changed to keep up with changes
in the underlying APIs. The best single-page summary of the changes
is the "Release Notes" document that is part of the Strruts Documentation
application, and also on the web site (current as of a couple days ago)
at http://jakarta.apache.org/struts>.
In my judgement, all the changes that might break user code have already
been made -- but no guarantees until 1.0 is actually complete :-).

cheers,
Bill Pearce

Craig



Re: java.io.NotSerializableException: Serialization problems running Struts on Weblogic

2000-12-07 Thread Craig R. McClanahan

Ray Power wrote:

  Also, the Serializable restriction when you specify
  distributable/ relates to
  *session* attributes, not *context* attributes.  Requiring
  context attributes to
  be serializable is a platform-specific restriction that WebLogic

 Craig,

 Just to clarify; when you mention " *context* attributes ", you are refering
 to application wide attributes?


Yes.  To be specific, by "context attributes" I mean servlet context attributes
that are accessed from a servlet like this:

getServletContext().getAttribute("foo", myObject);

or from a JSP page like this:

jsp:useBean id="xxx" class="yyy" scope="application" ... /

This contrasts with session attributes -- those you attach to your HttpSession.


 Ray

Craig





FormBean problem

2000-12-07 Thread Boulatian, Misak

Hi all,

I cannot seem to make form beans working. It seems like the instance of the
form bean never gets created. Here are my web.xml, struts-config.xml, and
action classes. I can never get user id and password to print from the
action class. If someone can tell me where my mistake is I would really
appreciate that.

Thanks very much,
Misak Boulatian
Vantra Group, Inc.
 login.jsp  web.xml  struts-config.xml  LoginAction.java  
LoginForm.java 

 login.jsp
 web.xml
 struts-config.xml
 LoginAction.java
 LoginForm.java


Re: 1.0 readiness?

2000-12-07 Thread Wong Kok Wai

Hi Craig,

I'm hoping for a Christmas present in the form of
Struts 1.0 :-)

 
 My original plan was to release a 1.0 beta by the
 end of November.  That didn't
 happen, primarily because I had to go clean up the
 mess on Tomcat 3.2 and
 actually get a release out.  Now that that is done,
 and the next milestone of
 Tomcat 4.0 will happen this week, I *finally* get to
 focus on Struts in depth
 for a couple of weeks.
 
 Craig


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



Re: Rewriting the URL in a form:form action

2000-12-07 Thread Erik Horstkotte

Craig R. McClanahan wrote:

 Michael Westbay wrote:
 
  Please try something like:
 
  form:form action="%= request.getContextPath() %/x"
 
 
 This won't work (invalid tag attribute syntax), but the following
 will:
 
 form:form action='%= request.getContextPath() + "/x" %'

Thanks! That works fine.

-- Erik





Re: Struts+Weblogic=Problems. Changes to struts?

2000-12-07 Thread Craig R. McClanahan

Matthew Heaton wrote:

 They told me that the spec will disallow it but I have no idea if that is
 factual or not.  It could just be their interpretation of the spec, from the
 snipets I've seen it definetly says you shouldn't put Non Serializable
 objects into the session but isn't very clear about putting them into the
 PageContext under different scopes.


Do you have an email address at WebLogic that I can follow up with?


 -Matt


Craig





FW: FormBean problem

2000-12-07 Thread Boulatian, Misak

Hi Craig and all,

After giving some thought I've tried to step through ActionServlet. The
problem was found in
 processPopulate method in the lines market with '' below. I've included my
jsp, config and java programs for you to correct me if I am wrong. If I am
doing something wrong then why those marked lines never come back (I thought
that multipartClass is only for file uploads which I am not doing now).
Please let me know if this is a bug or a configuration problem on my side?

I appreciate the response.
Thanks,
Misak
BEGIN EXAMPLE
protected void processPopulate(ActionForm formInstance,
   ActionMapping mapping,
   HttpServletRequest request)
throws ServletException {

if (formInstance == null)
return;
//set the servlet of the ActionForm
formInstance.setServlet(this);

// Populate the bean properties of this ActionForm instance
if (debug = 1)
log(" Populating bean properties from this request");
formInstance.reset(mapping, request);
//place the mapping's multipart request handler class
//into the request to be read by the BeanUtils.populate
//method in the event of a multipart request

request.setAttribute("org.apache.struts.action.mapping.multipartclass",
mapping.getMultipartClass());
//also pass the mapping through the request
System.out.println("processPopulate() 6");
request.setAttribute("org.apache.struts.action.mapping.instance",
mapping);
System.out.println("processPopulate() 7");
BeanUtils.populate(formInstance, mapping.getPrefix(),
   mapping.getSuffix(), request);

}
END EXAMPLE

-Original Message-
From: Boulatian, Misak [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 07, 2000 5:46 PM
To: [EMAIL PROTECTED]
Subject: FormBean problem


Hi all,

I cannot seem to make form beans working. It seems like the instance of the
form bean never gets created. Here are my web.xml, struts-config.xml, and
action classes. I can never get user id and password to print from the
action class. If someone can tell me where my mistake is I would really
appreciate that.

Thanks very much,
Misak Boulatian
Vantra Group, Inc.
 login.jsp  web.xml  struts-config.xml  LoginAction.java  
LoginForm.java 


 login.jsp
 web.xml
 struts-config.xml
 LoginAction.java
 LoginForm.java


RE: Struts+Weblogic=Problems. Changes to struts?

2000-12-07 Thread Ray Power

Craig,

This is a copy of the thread on weblogic.developer.interest.60beta.servlet
 " Re: Yet another problem with struts and Weblogic 6.0 beta "





Mark Spotswood [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 This looks similar to an issue that came up on the JSP newsgroup recently.
Below is the
 response I wrote there. Hope it helps.
 --
 mark


 In order to support reloading of jsps/classes in a webapp, we need to
 create a new classloader.  All stateful objects loaded from the old
 classloader (such as things put into the session) need to be reloaded
 in the new classloader.  We try to preserve the state of the objects
 using serialization.  If the object isn't serializable, you are out of
 luck, and the object is lost.  The only other alternative in the case
 where we're trying to support reloading is to allow a
 classcastexception to occur.

 The only alternative in the current product is to turn off reloading,
 setting jsp pageCheckSecs=-1 and ServletReloadCheckSecs=-1.

 There is a thread on the servlet 2.3 mailing list where it looks like
 the servlet 2.3 spec will have words to the effect that things put
 into the session should be serializable if you want class reloading to
 work in the container.

 We suspect that this will be a fairly common problem, so we are
 trying to find ways to avoid this in our implementation such as
 using a classloader per jsp and handling this specific exception.
 Unfortunately, this will probably not make it before GA.

 The following is from the servlet 2.3 spec
 ---
 "In order to allow sessions to persist across class reloading within
 the container, it is highly advised that you should implement the
 Serializable interface. Otherwise, you risk the strong chance that the
 objects within your session will not exist after the classloader has
 been reloaded."
 

 I've entered CR039368 to track this issue.

 --
 mark



 Matt Heaton wrote:

  After many unsuccessful attempts at getting Struts to work on Weblogic
5.1, I decided with give it a try on Weblogic 6.0 Beta 2
 
  Everything seems to be deploying correct except for I get the following
error (which of course breaks everything):
 
  Nov 30, 2000 1:19:37 PM PST Error HTTP
[WebAppServletContext(6802820,struts-example)] Cou
  ld not deserialize context attribute
  java.io.NotSerializableException: java.util.PropertyResourceBundle
  at
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1148)
  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
  at
java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1841)
  at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:480)
  at
java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1214)
  at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:366)
  at
weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:7
1)
  at
weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
text.java
  :207)
  at
weblogic.servlet.jsp.PageContextImpl.getAttribute(PageContextImpl.java:164)
  at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:230)
  at jsp_servlet._index._jspService(_index.java:105)
  at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
  at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:208)
  at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:244)
  at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.jav
  a:1107)
  at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1482)
  at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
  at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
  
 
  It appears that Weblogic requires any object that you use as a context
attribute on a JSP page must be serializable.  I went through some of the
Struts source and it's trying to use objects which aren't serializable as
JSP page context attributes.  This looks like it may be a shortcoming in the
JSP spec because it makes sense that to support to failover of sessions you
would need to be able to serialize the attributes since a the attributes of
a PageContext may have the scope of an entire session.
 
  -Matt



==





 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 08, 2000 2:39 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Struts+Weblogic=Problems. Changes to struts?


 Matthew Heaton wrote:

  They told me that 

RE: Are this bugs ?

2000-12-07 Thread Mueller, Franz


Hello,

I'm using tomcat4/milestone 4 (Struts nightly build from 06-Dec)


the exception I'm getting:

A Servlet Exception Has Occurred
Exception Report:
javax.servlet.ServletException: Servlet.service() for servlet default threw
exception
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:537)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:292)
at
org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java:17
69)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1321)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:517)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:292)
at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1468)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1334)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:180)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:255)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:165)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:1876)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161
)
at
org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:343)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:159)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
785)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:902)
at java.lang.Thread.run(Thread.java:484)
Root Cause:
java.lang.NullPointerException
at
org.apache.catalina.resources.FileResources.setResource(FileResources.java:5
86)
at
org.apache.catalina.servlets.DefaultServlet.doPut(DefaultServlet.java:401)
at
org.apache.catalina.servlets.DefaultServlet.doPost(DefaultServlet.java:365)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:517)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:292)
at
org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java:17
69)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1321)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:517)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:292)
at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1468)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1334)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:180)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:255)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:165)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:1876)
at

Slow execution time using struts

2000-12-07 Thread shankar

Hi,
We are developing an app using struts and find the execution time is
agonizingly slow. We are using Struts 0.5 and tomcat 3.2. M/cs are 64 mb.
The initialization seems to take forever(sometimes more than 1-2 minutes)
and is highly frustrating. One of my co-developers was using an older ver of
Tomcat and the app seemed to be much much faster on his m/c. He recently
shifted to tomcat 3.2 and that brought down his execution speeds  and has
been cursing everyone who forced him to do the shift eversince.
Is this a Tomcat prob or is it struts in general? Anybody have the same
prob? Would shifting to Resin bring about any drastic improvement? Does
tomcat have any features that give an edge over Resin or vice-versa? Is
there any other good combination out there? Any sugg/help would be highly
appreciated.

Thanks everybody,
Shankar.