You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Choon Yin Teo <ch...@netlife.com.sg> on 2001/02/22 03:50:35 UTC

Question on checkbox



Hi ,

Have anyone encountered any problem using the following strut checkbox?
<form:checkbox property="command" value="search" />

I encountered a problem trying to retrieve the value. When I view the static
html source, I can't see the value set.
<input type="checkbox" name="command" >

Regards,
Choon Yin



Re: Struts in Websphere, missing resources attribute...

Posted by rb...@oakgrovesoftware.com.
Make sure that you don't put the struts.jar in the admin.config or 
adminserver script classpath. Just put it in the war file at 
WEB-INF/lib.

Have you tried converting the struts-example war ?

Quoting Wayland Chan <in...@yahoo.com>:

> Sorry, I should have mentioned that I'm using Struts
> 0.5 and WAS 3.5.2
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices!
> http://auctions.yahoo.com/
> 

Re: Struts in Websphere, missing resources attribute...

Posted by Ted Husted <ne...@husted.com>.
Were the instructions here 

< http://jakarta.apache.org/struts/installation-was.html >

any help?

Wayland Chan wrote:
> 
> Sorry, I should have mentioned that I'm using Struts
> 0.5 and WAS 3.5.2
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

Re: Struts in Websphere, missing resources attribute...

Posted by Wayland Chan <in...@yahoo.com>.
Sorry, I should have mentioned that I'm using Struts
0.5 and WAS 3.5.2



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

Re: Struts in Websphere, missing resources attribute...

Posted by rb...@oakgrovesoftware.com.
My instructions were for installing struts 0.5. If you are using Struts
1.0 then I understand there are some complications with the change to using
struts-config.xml instead of action.xml. Specifically struts-config.xml now
uses a dtd and the websphere classloader has problems finding the dtd. I 
haven't actually tried struts 1.0 with websphere so I can't tell you definitely
that that is the only problem. I think some other people have worked around this
issue so I would continue to seach through the archives.

On the issue of the convert war tool the reason you don't see the same directory
structure as in the war file is because the convert tool converts to websphere
format which is different. The tool should set up the correct classpaths and
document paths that websphere understands.

FYI WebSphere 4.0 will support wars (ears, ejb-jars etc) natively as it will be
j2ee compliant. Hopefully it will be out in the summer.

Richard

Quoting Wayland Chan <in...@yahoo.com>:

> 
> Hello,
> 
> I've been trying to get Struts to work in Websphere
> and am running into problems.
> 
> I've been following Richard Backhouse's instructions
> (http://archive.covalent.net/jakarta/struts-user/2000/10/0392.xml)
> and I'm getting the infamous missing resources
> error....
> 
> Missing resources attribute
> org.apache.struts.action.MESSAGE
> error.
> 
> I've noticed that Websphere's 'Convert a War File'
> task, it doesn't seem to create the webapp as you'd
> expect. ie. I have no WEB-INF/lib or WEB-INF/classes
> directories as I'd expect within the webapp. I can
> assume this is because WAS' doesn't support WAR files.
> 
> One thing I couldn't do according to Richard's
> instructions was changing WAS' classpath in
> admin.config or adminserver.bat/sh. admin.config
> didn't seem to have a general classpath to modify and
> I don't have the adminserver.bat/sh files in my 3.5
> installation. I do have setenv.bat which I've modified
> to add the jaxp.jar, crimson.jar, xalan.jar to the
> classpath.
> 
> Anyone tackle this problem yet?
> 
> Thanks,
> 
> Wayland Chan
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices!
> http://auctions.yahoo.com/
> 

Re: Struts in Websphere, missing resources attribute...

Posted by Wayland Chan <in...@yahoo.com>.
I've found the adminserver.bat and changed the
classpath to include jaxp.jar, crimson.jar, xalan.jar
(and what the hell, struts.jar for the hell of it
too).

I'm noticing in my Admin Console the following error:

2/22/01 12:10 PM : AUDIT [daytona/Default Server]:
SRVE0092I: [Servlet LOG]: "database: Database load
exception": org.xml.sax.SAXNotRecognizedException:
Feature: http://xml.org/sax/features/raw-names

So the missing resources error isn't really valid in
this sense as my struts-example webapp hasn't started properly.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

Struts in Websphere, missing resources attribute...

Posted by Wayland Chan <in...@yahoo.com>.
Hello,

I've been trying to get Struts to work in Websphere
and am running into problems.

I've been following Richard Backhouse's instructions
(http://archive.covalent.net/jakarta/struts-user/2000/10/0392.xml)
and I'm getting the infamous missing resources
error....

Missing resources attribute
org.apache.struts.action.MESSAGE
error.

I've noticed that Websphere's 'Convert a War File'
task, it doesn't seem to create the webapp as you'd
expect. ie. I have no WEB-INF/lib or WEB-INF/classes
directories as I'd expect within the webapp. I can
assume this is because WAS' doesn't support WAR files.

One thing I couldn't do according to Richard's
instructions was changing WAS' classpath in
admin.config or adminserver.bat/sh. admin.config
didn't seem to have a general classpath to modify and
I don't have the adminserver.bat/sh files in my 3.5
installation. I do have setenv.bat which I've modified
to add the jaxp.jar, crimson.jar, xalan.jar to the
classpath.

Anyone tackle this problem yet?

Thanks,

Wayland Chan


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

Re: tag and cancel functionality

Posted by Maya Muchnik <mm...@pumatech.com>.
Thank you for asking this question. I need resolve this too. We use some images to "submit", "cancel" and other option.  Can somebody help with this?

Thanks in advance.

Maya

"Christophe Thiébaud" wrote:

> We are using the <struts-html:image> tag to produce graphical buttons. This tag writes a HTML tag <input type="image" name="aaa">.
>
> the problem with the <input type="image"> tag is that it submits "aaa.x" and "aaa.y" parameters rather than the usual "aaa" parameter.
>
> Thus I cannot use the <struts-html:image> for a cancel function because the
> ActionServlet tests for Constants.CANCEL_PROPERTY, in a request that include only Constants.CANCEL_PROPERTY.x  and Constants.CANCEL_PROPERTY.y parameters.
>
> So I have subclassed the ActionServlet and Action classes as below
>
> ActionServlet (row 1851)
>  if (request.getParameter(Constants.CANCEL_PROPERTY) != null) {
>         ...
> MYActionServlet:
>  if (request.getParameter(Constants.CANCEL_PROPERTY) != null
>     ||
>     request.getParameter(Constants.CANCEL_PROPERTY+".x") != null) {
>          ...
>
> Action (row 457)
>     protected boolean isCancelled(HttpServletRequest request) {
>         return (request.getParameter(Constants.CANCEL_PROPERTY) != null);
>
> MYAction
>     protected boolean isCancelled(HttpServletRequest request) {
>         if (super.isCancelled(request))
>             return true;
>             return (request.getParameter(org.apache.struts.taglib.html.Constants.CANCEL_PROPERTY+".x") != null);
>     }
>
> Isn't there a better way to handle this problem ?
> anybody else using <struts-html:image tag> to handle cancel ?
>
> Christophe


tag and cancel functionality

Posted by Christophe Thi�baud <ct...@stylo.it>.
We are using the <struts-html:image> tag to produce graphical buttons. This tag writes a HTML tag <input type="image" name="aaa">.

the problem with the <input type="image"> tag is that it submits "aaa.x" and "aaa.y" parameters rather than the usual "aaa" parameter.

Thus I cannot use the <struts-html:image> for a cancel function because the
ActionServlet tests for Constants.CANCEL_PROPERTY, in a request that include only Constants.CANCEL_PROPERTY.x  and Constants.CANCEL_PROPERTY.y parameters.

So I have subclassed the ActionServlet and Action classes as below

ActionServlet (row 1851)
 if (request.getParameter(Constants.CANCEL_PROPERTY) != null) {
        ...
MYActionServlet:
 if (request.getParameter(Constants.CANCEL_PROPERTY) != null
    ||
    request.getParameter(Constants.CANCEL_PROPERTY+".x") != null) {
         ...

Action (row 457)
    protected boolean isCancelled(HttpServletRequest request) {
    	return (request.getParameter(Constants.CANCEL_PROPERTY) != null);

MYAction
    protected boolean isCancelled(HttpServletRequest request) {
        if (super.isCancelled(request))
            return true;
	    return (request.getParameter(org.apache.struts.taglib.html.Constants.CANCEL_PROPERTY+".x") != null);
    }

Isn't there a better way to handle this problem ?
anybody else using <struts-html:image tag> to handle cancel ?

Christophe

RE: ActionForm.reset()

Posted by Christian Billen <cb...@mail.com>.
Thanks for your prompt response, I believe it will not work for the
following reason:

My preparation action does thing such as setting collection for html:options
in request attribute.  Imagine that PrepAction initialize a new ActionForm
setting the defaults and overwritting the one created by the controller, we
now forward to the jsp view and all fields are set to their default.  so far
so good.
Next the user enters data, I post that request to the action that
validates...this action makes server call, create some errors and forward
back to preparation handler (because it needs to do so since I have code in
there to build up my collection for the html:options)
Now this prep handler will create a new ActionForm effectively resetting the
one with all the data filled in by the user.  Not the desired effect.

A suggestion would be to configure the defaults value as config parameters
in the struts-config.xml at the Action Mapping level.  Something like
<actionform-default><property>blah</property><value>somedefault</value></act
ionform-default>

Am I making sense of all this?

Thanks,

Christian
> -----Original Message-----
> From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Sent: Wednesday, February 21, 2001 11:13 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: ActionForm.reset()
>
>
> Christian Billen wrote:
>
> > Hi list,
> >
> > Is there a way to prevent the reset() method from being called on the
> > ActionForm when the validate option in struts-config for that
> mapping is set
> > to false?
> >
>
> Doing this would break the recommended approach for dealing with
> checkboxes,
> which rely on reset() being called to reset the corresponding booleans to
> false.  You will want this to occur even if you are not
> validating, so that the
> bean properties correctly reflect what the user last entered.
>
> >
> > My problem is that I have an Action to prepare the data for a
> jsp page and
> > another Action to process the data from that jsp. Both point to the same
> > ActionForm class.
> > In my prep action (/prepare.do), I configured the mapping not
> to validate
> > the form, but still I see that the reset() method is being called, very
> > annoying considering that some properties in my actionform are set to a
> > default in the constructor (like a checkbox set to true) and that I have
> > code in reset of the same form to clear checkboxes.  Shouldn't reset be
> > called by the controller only when validate is true?
> >
>
> The Struts example application faces a similar situation.  In the
> EditSubscriptionAction, it creates a new form bean (initialized
> to defaults in
> the constructor) and *replaces* the one that was created by the controller
> servlet (and on which reset() was called).  You might consider
> using a similar
> technique.
>
> Craig McClanahan
>
>
> >
> > Thanks for your advise,
> >
> > Christian Billen
>
>
>


Re: ActionForm.reset()

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Christian Billen wrote:

> Hi list,
>
> Is there a way to prevent the reset() method from being called on the
> ActionForm when the validate option in struts-config for that mapping is set
> to false?
>

Doing this would break the recommended approach for dealing with checkboxes,
which rely on reset() being called to reset the corresponding booleans to
false.  You will want this to occur even if you are not validating, so that the
bean properties correctly reflect what the user last entered.

>
> My problem is that I have an Action to prepare the data for a jsp page and
> another Action to process the data from that jsp. Both point to the same
> ActionForm class.
> In my prep action (/prepare.do), I configured the mapping not to validate
> the form, but still I see that the reset() method is being called, very
> annoying considering that some properties in my actionform are set to a
> default in the constructor (like a checkbox set to true) and that I have
> code in reset of the same form to clear checkboxes.  Shouldn't reset be
> called by the controller only when validate is true?
>

The Struts example application faces a similar situation.  In the
EditSubscriptionAction, it creates a new form bean (initialized to defaults in
the constructor) and *replaces* the one that was created by the controller
servlet (and on which reset() was called).  You might consider using a similar
technique.

Craig McClanahan


>
> Thanks for your advise,
>
> Christian Billen


ActionForm.reset()

Posted by Christian Billen <cb...@mail.com>.
Hi list,

Is there a way to prevent the reset() method from being called on the
ActionForm when the validate option in struts-config for that mapping is set
to false?

My problem is that I have an Action to prepare the data for a jsp page and
another Action to process the data from that jsp. Both point to the same
ActionForm class.
In my prep action (/prepare.do), I configured the mapping not to validate
the form, but still I see that the reset() method is being called, very
annoying considering that some properties in my actionform are set to a
default in the constructor (like a checkbox set to true) and that I have
code in reset of the same form to clear checkboxes.  Shouldn't reset be
called by the controller only when validate is true?

Thanks for your advise,

Christian Billen


Re: Question on checkbox

Posted by Wong Kok Wai <wo...@yahoo.com>.
The "value" attribute only allows for boolean related
values which currently only recongnise "true", "on"
and "yes".

--- Choon Yin Teo <ch...@netlife.com.sg> wrote:
> 
> 
> 
> Hi ,
> 
> Have anyone encountered any problem using the
> following strut checkbox?
> <form:checkbox property="command" value="search" />
> 
> I encountered a problem trying to retrieve the
> value. When I view the static
> html source, I can't see the value set.
> <input type="checkbox" name="command" >
> 
> Regards,
> Choon Yin
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/