Re: Getting an erro like Exception starting filter struts2

2007-11-15 Thread joey
check whether the xwork2.jar exists in your classpath

On Nov 15, 2007 5:16 PM, vijay vijay <[EMAIL PROTECTED]> wrote:
> Hi
>  i am new to this struts 2.i am getting an error like fallowing can any
> one help me why i am getting  like this.
>
> 15/11/2007 12:51:47 ã org.apache.catalina.core.StandardContext filterStart
> SEVERE: Exception starting filter struts2
> Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory -
> bean -
> jar:file:/C:/Tomcat%206.0/webapps/struts2tutorial/WEB-INF/lib/struts2-
> core-2.0.11.jar!/struts-default.xml:30:72
>  at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(
> XmlConfigurationProvider.java:209)
>  at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(
> StrutsXmlConfigurationProvider.java:101)
>  at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(
> DefaultConfiguration.java:131)
>  at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(
> ConfigurationManager.java:52)
>  at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(
> Dispatcher.java:395)
>  at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
>  at org.apache.struts2.dispatcher.FilterDispatcher.init(
> FilterDispatcher.java:201)
>  at org.apache.catalina.core.ApplicationFilterConfig.getFilter(
> ApplicationFilterConfig.java:275)
>  at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(
> ApplicationFilterConfig.java:397)
>  at org.apache.catalina.core.ApplicationFilterConfig.(
> ApplicationFilterConfig.java:108)
>  at org.apache.catalina.core.StandardContext.filterStart(
> StandardContext.java:3696)
>  at org.apache.catalina.core.StandardContext.start(StandardContext.java
> :4343)
>  at org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java:791)
>  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
>  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
>  at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java
> :920)
>  at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java
> :883)
>  at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
>  at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
>  at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
> :311)
>  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
> LifecycleSupport.java:117)
>  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>  at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
>  at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>  at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>  at org.apache.catalina.core.StandardService.start(StandardService.java:516)
>  at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>  at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>  at java.lang.reflect.Method.invoke(Unknown Source)
>  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the
> name xwork has already been loaded by bean -
> jar:file:/C:/Tomcat%206.0/lib/struts2-
> core-2.0.11.jar!/struts-default.xml:30:72 - bean -
> jar:file:/C:/Tomcat%206.0/webapps/struts2tutorial/WEB-INF/lib/struts2-
> core-2.0.11.jar!/struts-default.xml:30:72
>  at
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(
> XmlConfigurationProvider.java:194)
>  ... 33 more
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JSON and ExtJS

2007-12-20 Thread joey
struts2 json plugin for extjs works good for most time.
but extjs 's grid json structure is a little special,
you could extend json plugin's classes to support it.

ps:In some situations,you could try freemarker type result.
Like global exception,validation errors...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JSON and ExtJS

2007-12-21 Thread joey
ExtJS script submit code is sth like this :
 fs.submit({url:'save.action', waitMsg:'Saving Data...'});

ExtJS form submit action is an xhr request to your form url,You just
handle it in struts2 as
you did in a normal html form.But your response must have the same
format with your extjs form reader.I uses json.so my respone is sth
like this:
{"success":true,"errmsg":"","datas":[]},success property is
required.if it is true,extjs form will call actioncompleted
method,otherwise call actionfailed method.



On Dec 22, 2007 9:08 AM, Frans Thamura <[EMAIL PROTECTED]> wrote:
> just a little another question
>
> i try to use JSON as the communication between S2 and my ExtJS Apps
>
> but I can see we can use Form in ExtJS to replace the Form in HTML
>
> i still dont get how to develop a good JSON based S2, and also the good
> ExtJS apps in the client
>
> esp i am very weak in JSON RPC world,
>
> still dont get how to save S2 - JSON.
>
> in another world I am developng a framework in Swing based, and want to use
> JSON
>
> and since today, I can read the output of S2, but cannot send data and save
> to S2.
>
> any glue guys
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ActionContext.getContext().getSession return null when I test Struts2 action by JUnit.

2008-02-01 Thread Joey
Thanks,  I just checked testing class in Struts2 package,  but I am a
newbie for Struts2. I cannot understant Struts2 very well, so if you
don't mind, pls tell me which testing class I can learn from.

Thanks again

On Feb 1, 2008 4:31 PM, Nils-Helge Garli Hegvik <[EMAIL PROTECTED]> wrote:
> You need to initialize the ActionContext in your unit tests. Take a
> look at the Struts 2 tests how it is solved there.
>
> Nils-H
>
>
> On Feb 1, 2008 9:28 AM, Joey Watson <[EMAIL PROTECTED]> wrote:
> > Hi everybody.
> >
> > I want to test a action class (Struts2) by JUnit. and then method in
> > this action need a value in session, then when I run my JUnit test
> > class,  ActionContext.getContext().getSession return null. (not
> > ActionContext.getContext().getSession().get("XXX") return null).
> > this action class is working fine in browser.
> >
> >
> > thanks for any help
> >
> > Joey
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ActionContext.getContext().getSession return null when I test Struts2 action by JUnit.

2008-02-01 Thread Joey
I found it . like this.

Map param = new HashMap();
ActionContext.getContext().setSession(param);

Thanks for your help

On Feb 1, 2008 4:53 PM, Joey <[EMAIL PROTECTED]> wrote:
> Thanks,  I just checked testing class in Struts2 package,  but I am a
> newbie for Struts2. I cannot understant Struts2 very well, so if you
> don't mind, pls tell me which testing class I can learn from.
>
> Thanks again
>
>
> On Feb 1, 2008 4:31 PM, Nils-Helge Garli Hegvik <[EMAIL PROTECTED]> wrote:
> > You need to initialize the ActionContext in your unit tests. Take a
> > look at the Struts 2 tests how it is solved there.
> >
> > Nils-H
> >
> >
> > On Feb 1, 2008 9:28 AM, Joey Watson <[EMAIL PROTECTED]> wrote:
> > > Hi everybody.
> > >
> > > I want to test a action class (Struts2) by JUnit. and then method in
> > > this action need a value in session, then when I run my JUnit test
> > > class,  ActionContext.getContext().getSession return null. (not
> > > ActionContext.getContext().getSession().get("XXX") return null).
> > > this action class is working fine in browser.
> > >
> > >
> > > thanks for any help
> > >
> > > Joey
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JSONInterceptor doesn't support Long/Short/Double... type.

2007-09-10 Thread joey
if My entity class has a property of type in (Long/Short/Double...),I get a
Exception
JSONExeption Incompatible types for property xxx.
After read the code of JSONInterceptor ,I found it doesn't support these
types which
confused me.


Re: JSONInterceptor doesn't support Long/Short/Double... type.

2007-09-10 Thread joey
ok,i will try it.
another suggestions:about the dateformat,now it was implemented by add json
annotation to the write
method of the property of date type.If no json annotation defined,it use
JSONUtil.RFC3339_FORMAT.
I thought it's great if  the default format could be defined via
configuration files.
there are always some people who prefer configuration file.

On 9/10/07, James Holmes <[EMAIL PROTECTED]> wrote:
>
> If you feel these should be supported, you can open a JIRA ticket for the
> issue.
> The ticket will be more likely to get attention if you supply a patch to
> implement the desired behavior.
>
> https://issues.apache.org/struts/browse/WW
>
> James
>
>
> On Mon Sep 10  6:00 , joey <[EMAIL PROTECTED]> sent:
>
> >if My entity class has a property of type in (Long/Short/Double...),I get
> a
> >
> >Exception
> >
> >JSONExeption Incompatible types for property xxx.
> >
> >After read the code of JSONInterceptor ,I found it doesn't support these
> >
> >types which
> >
> >confused me.
> >
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: [s2] Possibility to hide input fields if not empty?

2007-03-20 Thread joey

Just use condition tag to hide your fields,like this:
   
   
   


On 3/20/07, Piero Sartini <[EMAIL PROTECTED]> wrote:


Just wondering how you guys would make something like this:
When a Field in a form is null or empty it should be displayed, if it is
already filled it should disappear.

Is there an easy way to do this with s2? Use-Case is to ask the user
missing
information after login.

Piero.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




A suggestion for struts.xml!

2007-03-20 Thread joey

 I think if struts.xml 's element 'include' support wildcard,it will be
better.
For example  I have ten file to be included in struts.xml,now I have to
write
 ten times.But if it has supported
wildcard,
I would only need write once like this .
 is it possible to support wildcard next version?I think I can deploy my
struts application
easier if so.


A suggestion for struts.xml!

2007-03-20 Thread joey

 I think if struts.xml 's element 'include' support wildcard,it will be
better.
For example  I have ten file to be included in struts.xml,now I have to
write
 ten times.But if it has supported
wildcard,
I would only need write once like this .
 is it possible to support wildcard next version?I think I can deploy my
struts application
easier if so.


Re: A suggestion for struts.xml!

2007-03-20 Thread joey

 Thank your reply!
 I only want more choices.I think wildcard style would be more easier in
developing stage,
and the current style would be more suitable in deploying stage.

On 3/20/07, Harring Figueiredo <[EMAIL PROTECTED]> wrote:


Even though I would like to have something like this for CLASSPATH in say,
ant scripts,  I would not want something like this in configuration file
for
2 reasons:

- Sercuty issues

- When it comes to error messages, struts does not really provide good
messages (I take that this is because the XML parser errors is not
filtered
and interpreted ). I would hate to have a member of the development team
drop a .xml file in the config dir and break the deployment for "no"
aparent
reason.

Harring

On 3/20/07, joey <[EMAIL PROTECTED]> wrote:
>
>   I think if struts.xml 's element 'include' support wildcard,it will be
> better.
> For example  I have ten file to be included in struts.xml,now I have to
> write
>  ten times.But if it has
> supported
> wildcard,
> I would only need write once like this .
>   is it possible to support wildcard next version?I think I can deploy
my
> struts application
> easier if so.
>



--
Sincerely,

Harring Figueiredo
Sr. Software Engineer
Email: [EMAIL PROTECTED]
Telephone: 941-256-0600

"We never become truly spiritual by sitting down and wishing to become so.
You must undertake something so great that you cannot accomplish it
unaided."



A Problem in Json plugin!

2007-03-25 Thread joey

I just tried to generate json result by using Json plugin.
But I found that the result is cutted,not a well-formed json result.
After debugging ,I found the reason,one of my string property of the
struts action isn't a  iso-8859-1 encoding string.
In the method "execute" of class JSONResult,you could find :
response.setContentLength(json.length);
response.setContentType("application/json;charset=" + getEncoding());
When the json.length is smller than json.getBytes(encoding).length,
the result will be cut.
So I thought maybe it's better to change json.length to
json.getBytes(encoding).length.
Moreover,I thought it's better if I could set which property to be
serialized in the struts.xml.It could be more flexible than the annotation.
For example:

name,email



Re: A Problem in Json plugin!

2007-03-26 Thread joey

The test action:
public class ExampleSupport extends ActionSupport {

 public String getName() {
   //a string of chinese
return "测试";
 }
}
 This action should get a json like this : {"name":"测试"},
the name property's length is 4,but json.length is 2.
So the last 2 character is cutted,and I
get like this:{"name":"测试,After I replace
the code with "json.getBytes(getEncoding()).length",
it works fine.


currentUser is a ognl expression.
On 3/26/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:


Hi Joey

Could you send me a testcase for the problem you are having, like a sample
action that will break the json generation? I thought about adding
parameters a while back, the problem is that the parameters work for the
action, but if you have an object returned by one of the getter methods in
the action, then there would be no way to control the json generation for
that object.

regards
musachy

On 3/25/07, joey <[EMAIL PROTECTED]> wrote:
>
> I just tried to generate json result by using Json plugin.
> But I found that the result is cutted,not a well-formed json result.
> After debugging ,I found the reason,one of my string property of the
> struts action isn't a  iso-8859-1 encoding string.
> In the method "execute" of class JSONResult,you could find :
> response.setContentLength(json.length);
> response.setContentType("application/json;charset=" + getEncoding());
> When the json.length is smller than json.getBytes(encoding).length,
> the result will be cut.
> So I thought maybe it's better to change json.length to
> json.getBytes(encoding).length.
> Moreover,I thought it's better if I could set which property to be
> serialized in the struts.xml.It could be more flexible than the
> annotation.
> For example:
> 
> name,email
> 
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd



Re: A Problem in Json plugin!

2007-03-26 Thread joey

 About adding parameters,I thought maybe it's easy to
specify the root object of the json result while you
use the action object as default.for example:

currentUser


currentUser is a ognl expression.
I could get more flexible json format than now,
and I thought it's very easy to do that.

 I just tried a ajax framework named "ext" which grid componet is
very cool.I think maybe you could try to support it in struts2,even
as a plugin.Ext is more powerful than dojo.Though dojo is easy but
poor function.Struts2 is a very flexible framework.It could be more
popular if it support very cool ui.
ps.ext website:http://www.extjs.com/
On 3/26/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:


Hi Joey

Could you send me a testcase for the problem you are having, like a sample
action that will break the json generation? I thought about adding
parameters a while back, the problem is that the parameters work for the
action, but if you have an object returned by one of the getter methods in
the action, then there would be no way to control the json generation for
that object.

regards
musachy

On 3/25/07, joey <[EMAIL PROTECTED]> wrote:
>
> I just tried to generate json result by using Json plugin.
> But I found that the result is cutted,not a well-formed json result.
> After debugging ,I found the reason,one of my string property of the
> struts action isn't a  iso-8859-1 encoding string.
> In the method "execute" of class JSONResult,you could find :
> response.setContentLength(json.length);
> response.setContentType("application/json;charset=" + getEncoding());
> When the json.length is smller than json.getBytes(encoding).length,
> the result will be cut.
> So I thought maybe it's better to change json.length to
> json.getBytes(encoding).length.
> Moreover,I thought it's better if I could set which property to be
> serialized in the struts.xml.It could be more flexible than the
> annotation.
> For example:
> 
> name,email
> 
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd



Re: S2: What do you forward to after a response writer?

2007-03-26 Thread joey

you can just register a custom result which
implement com.opensymphony.xwork2.Result.

Find detail in struts2 document.


On 3/26/07, Scott Nesbitt <[EMAIL PROTECTED]> wrote:



I am moving an app from S1 to S2 that has a
third-party grid component.  In S1 it looked like
this:

public ActionForward perform(
  ActionMapping   mapping,
  ActionForm  form,
  HttpServletRequest  req,
  HttpServletResponse resp)
{
  try
  {
 GetHandler myGetHandler = new GetHandler(resp,
null);
.
.
.
 myGetHandler.writeToClient("ISO-8859-1",
resp.getWriter());
  }

  return mapping.findForward("success");
}

In S2 I am doing the following:


public class PopulateGridAction extends ActionSupport
implements ParameterAware, ServletResponseAware
{

public String execute() throws Exception
{
 HttpServletResponse resp = getServletResponse();
 GetHandler myGetHandler = new GetHandler(resp,
null);
.
.
.
 myGetHandler.writeToClient("ISO-8859-1",
resp.getWriter());

  return SUCCESS;
}

In S1 it populated the grid fine, but in S2 it does
not send back the XML to the grid like it should.  I
guess I do not know what I should specify in the S2
struts.xml file for the SUCCESS forward.  I do not
want it to be the JSP that invoked the above code
because that reloads the grid, and I cannot specify
null.

Thanks for any tips or pointers,

Scott





No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: S2: What do you forward to after a response writer?

2007-03-26 Thread joey

You should define your custom result in a separate class,and you must
register your result
in your struts.xml,like this:
   
   
   
and you can use it :
   
I really thought you should read the document and source of "result".
you can download it from struts2 website.
regards
joey
On 3/26/07, Scott Nesbitt <[EMAIL PROTECTED]> wrote:



Hmm, when I have this class

public class PopulateGridAction extends ActionSupport
implements ParameterAware, Result

With this method:

public void execute(ActionInvocation invocation)
throws Exception

It never gets called.  Do I have to do something
special in my struts.xml?  My logfiles says:

11:06:34,342 [[ACTIVE] ExecuteThread: '2' for queue:
'weblogic.kernel.Default (self-tuning)'] DEBUG
xwork2.DefaultActionInvocation  - Executing action
method = null

I did not see any examples or documentation other than
the API pages.

Thanks,

Scott

--- joey <[EMAIL PROTECTED]> wrote:

> you can just register a custom result which
> implement com.opensymphony.xwork2.Result.
>
> Find detail in struts2 document.
>
>
> On 3/26/07, Scott Nesbitt <[EMAIL PROTECTED]>
> wrote:
> >
> >
> > I am moving an app from S1 to S2 that has a
> > third-party grid component.  In S1 it looked like
> > this:
> >
> > public ActionForward perform(
> >   ActionMapping   mapping,
> >   ActionForm  form,
> >   HttpServletRequest  req,
> >   HttpServletResponse resp)
> > {
> >   try
> >   {
> >  GetHandler myGetHandler = new
> GetHandler(resp,
> > null);
> > .
> > .
> > .
> >  myGetHandler.writeToClient("ISO-8859-1",
> > resp.getWriter());
> >   }
> >
> >   return mapping.findForward("success");
> > }
> >
> > In S2 I am doing the following:
> >
> >
> > public class PopulateGridAction extends
> ActionSupport
> > implements ParameterAware, ServletResponseAware
> > {
> >
> > public String execute() throws Exception
> > {
> >  HttpServletResponse resp =
> getServletResponse();
> >  GetHandler myGetHandler = new
> GetHandler(resp,
> > null);
> > .
> > .
> > .
> >  myGetHandler.writeToClient("ISO-8859-1",
> > resp.getWriter());
> >
> >   return SUCCESS;
> > }
> >
> > In S1 it populated the grid fine, but in S2 it
> does
> > not send back the XML to the grid like it should.
> I
> > guess I do not know what I should specify in the
> S2
> > struts.xml file for the SUCCESS forward.  I do not
> > want it to be the JSP that invoked the above code
> > because that reloads the grid, and I cannot
> specify
> > null.
> >
> > Thanks for any tips or pointers,
> >
> > Scott
> >
> >
> >
> >
> >
>


> > No need to miss a message. Get email on-the-go
> > with Yahoo! Mail for Mobile. Get started.
> > http://mobile.yahoo.com/mail
> >
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
>






Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: if tag doesn't seem to work(Struts 2)

2007-03-26 Thread joey

 I thought it may be like this:
Hello World or
Hello World

On 3/27/07, Darren Salomons <[EMAIL PROTECTED]> wrote:



I don't know if this is a bug or if I'm doing something wrong but the if
tag
in Struts 2 always returns false for the first run and then if I hit
refresh
it gets the correct value.


In my action class I have a method like this:

getStatement() {
return true;
}


And then in my jsp I do something like:

Hello World

Hello World is only printed after I hit reload.  I cleared my cache,
opened
my browser and tried again and the same thing happens.

Any ideas?  Darren
--
View this message in context:
http://www.nabble.com/if-tag-doesn%27t-seem-to-work%28Struts-2%29-tf3471295.html#a9687189
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Suggestion about Type Conversion Error Handling!!!

2007-03-28 Thread joey

 I hate the default type conversion error report message which is Invalid
field value for field {1}.
after I read the document,I find there is two ways  to override it:
1.define the generic i18n key xwork.default.invalid.fieldvalue in your
global i18n resource bundle.
2.adding an i18n key associated with just your action (Action.properties)
using the pattern invalid.fieldvalue.xxx, where xxx is the field name.
 The first method is a global method which is more easier,but in the
default text I can't use ognl because it's loaded by ResourceBundle
and  formated with field name.I thought the error message  only with field
name is not enough.I always define an i18n key using the pattern field name.
 I thought it would be more flexible the text of the
xwork.default.invalid.fieldvalue key loaded by an ognl expression.


Re: Struts ui components inside in a single line.

2007-03-29 Thread joey

web page designers should like your method.You also can achieve it by
overriding the template file which genernate the html codes.

regarding

joey
On 3/30/07, Felipe Rodrigues <[EMAIL PROTECTED]> wrote:



Hi guys,

I found the solution to my case. I got the rendered html and put it direct
on my jsp page.
But I've thinking. Could anyone figure out how to create an attribute like
autoLayout="true" to the forms tags?
Anyway, I will study the code when I get some time, and if nobody say
anything against it, I will create a
Jira issue and if I can, implement it.
I know the ajax theme is migrating to outside struts at version 2.1.x, so
maybe it is an oportunity to that.

Regards and thanks to not block me... ;-)

Felipe


Felipe Rodrigues wrote:
>
> Hi guys,
>
> Does somebody have an example about how make a form using the struts
tags,
> with  all of components in a single line?
>
> I tried this, but did not worked:
>
> 
>   
> some text
> other text
> 
> 
> 
>   
> 
>
> Thanks,
>
> Felipe
>

--
View this message in context:
http://www.nabble.com/Struts-ui-components-inside-%3Ctable%3E-in-a-single-line.-tf3489297.html#a9745728
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [S2] action mapping best practice

2007-04-02 Thread joey

Which version of struts2 are you talking about?
I just found  in configuration files.
You just confused me.
On 4/3/07, Jae K <[EMAIL PROTECTED]> wrote:


I have a comment about the MailReader tutorial.

This is the action declaration for the Login action:

...
...

To invoke this action, the user agent would first GET request Login_input,
and then POST to Login to submit the form or Login_cancel to cancel, etc.

IMHO this is a *bad* way to declare your actions. Here are the reasons:
1. There is a duplication of URLs. There are at least two URL resources
with
the login form: /Login_input and /Login (/Login will display the form if
there was a field error)
2. There is a duplication of action declarations. In this example there
are
two declarations, one for Login_* and Login.
3. There are needlessly many methods in the action class.
4. It's not a restful interface

The source of the problem is with the ValidationInterceptor class (and its
subclasses). Whether or not validation occurs should not depend solely on
the method name (input, submit, etc), but also the HTTP verb (GET/POST). A
more intelligent ValidationInterceptor subclass would solve all of these
problems.

Solution:
1. I created a PostMethodValidationInterceptor that extends
ValidationInterceptor to validate only on POST requests.
2. My action support superclass has two methods: isInvalid() and
isFormPosted().

Now I only need one action mapping, and only one method in my action class
as follows:

public class Input extends MySupport {
...
   public String execute() throws Exception{
 if(!isValid() || !isFormPosted)
   return "input";
 //continue with input logic
...
}

The isValid and isFormPosted methods are very easy to implement. Let me
know
if anybody wants any of my source files.

- Jae



Re: [S2] action mapping best practice

2007-04-03 Thread joey

In the latest struts2 version 2.0.6,I only found .There was no ...
So you confused me.
Regards
joey

On 4/3/07, Jae K <[EMAIL PROTECTED]> wrote:


I'm talking about struts2. My post was a reaction to that config file. I
was
just pointing out what my thoughts were on the best practices. I'm not a
developer on the struts team :)

- Jae

On 4/2/07, joey <[EMAIL PROTECTED]> wrote:
>
> Which version of struts2 are you talking about?
> I just found  in configuration files.
> You just confused me.
> On 4/3/07, Jae K <[EMAIL PROTECTED]> wrote:
> >
> > I have a comment about the MailReader tutorial.
> >
> > This is the action declaration for the Login action:
> >
> > ...
> > ...
> >
> > To invoke this action, the user agent would first GET request
> Login_input,
> > and then POST to Login to submit the form or Login_cancel to cancel,
> etc.
> >
> > IMHO this is a *bad* way to declare your actions. Here are the
reasons:
> > 1. There is a duplication of URLs. There are at least two URL
resources
> > with
> > the login form: /Login_input and /Login (/Login will display the form
if
> > there was a field error)
> > 2. There is a duplication of action declarations. In this example
there
> > are
> > two declarations, one for Login_* and Login.
> > 3. There are needlessly many methods in the action class.
> > 4. It's not a restful interface
> >
> > The source of the problem is with the ValidationInterceptor class (and
> its
> > subclasses). Whether or not validation occurs should not depend solely
> on
> > the method name (input, submit, etc), but also the HTTP verb
(GET/POST).
> A
> > more intelligent ValidationInterceptor subclass would solve all of
these
> > problems.
> >
> > Solution:
> > 1. I created a PostMethodValidationInterceptor that extends
> > ValidationInterceptor to validate only on POST requests.
> > 2. My action support superclass has two methods: isInvalid() and
> > isFormPosted().
> >
> > Now I only need one action mapping, and only one method in my action
> class
> > as follows:
> >
> > public class Input extends MySupport {
> > ...
> >public String execute() throws Exception{
> >  if(!isValid() || !isFormPosted)
> >return "input";
> >  //continue with input logic
> > ...
> > }
> >
> > The isValid and isFormPosted methods are very easy to implement. Let
me
> > know
> > if anybody wants any of my source files.
> >
> > - Jae
> >
>



Re: S2 life cycle

2007-04-04 Thread joey

I prefer to achieve it by writing some java code than xml snippet.
Maybe migrating from struts1.x would do this.
If I just wanted to share more than one form within some actions,I must
declared more than one
interceptor.If I achieve it by only java code,I only need write a base
action and extend it.I can write
any get or set shared property methods in the desired scope.

On 4/4/07, tom tom <[EMAIL PROTECTED]> wrote:


Thanks,

Any samples or documenation around for me to refer.

I followed this

http://struts.apache.org/2.x/docs/scoped-model-driven-interceptor.html


but didnt work.

Thanks

--- Dave Newton <[EMAIL PROTECTED]> wrote:

> --- tom tom <[EMAIL PROTECTED]> wrote:
> > How can I have a reference to the form class
> inside
> > the action class. I did the following
> >
> > 1) Wrote a action class which implements
> > ScopedModelDriven interface, the argo is not null
> > inside setModel(Object arg0)method in the action
> > class but I cant cast into test.TestForm (pojo)
>
> At the very least I believe you should implement
> ScopedModelDriven, not just ScopedModelDriven,
> and
> provide typed accessors:
>
>

http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/ModelDriven.html
>

http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/ScopedModelDriven.html
>
> d.
>
>
>
>
>


> Don't get soaked.  Take a quick peek at the forecast
> with the Yahoo! Search weather shortcut.
> http://tools.search.yahoo.com/shortcuts/#loc_weather
>
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>






Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Struts 2 exception problem

2007-04-04 Thread joey

Are you sure you catch the HibernateException?


On 4/4/07, oguzhan tortop <[EMAIL PROTECTED]> wrote:



hi all,
i am using struts2 with hibernate i have a basic form which inputs the
given
data via hibernate. I get the hibernate session from my custom hibernate
interceptor and from that interceptor i call the action which creates the
hibernate transaction with data from its form and after that i return the
success case from action but there is a finally statement in my hibernate
interceptor which commits the transaction that's data filled in my action
class. But for ex. if the data is exist in db before which means duplicate
then it gives an error and when i get this error i return and ACTION.ERROR
from my hibernate interceptor but what i see on the page is the SUCCESS
result from the action class. What could be the problem  ? :) Any help
will
be usefull thanks for your support
Here is my default stack and action conf.
 
   
   
   
   
   
   
   
   



   
   /admin/createService.jsp
   
   
   /admin/viewService.jsp
   
   
   
   
   
Here is my interceptor class :

public String intercept(ActionInvocation invocation) throws Exception {
   Action action = (Action)invocation.getAction();
   if ( !(action instanceof BaseActionSupport) ) return
invocation.invoke();
   if (null == factoryName || null == packageName)
   throw new IllegalArgumentException("factoryName and
packageName
parameters should be given \n" +
   "check parameters in xml file
 \n" +
   "and \n");

   // adds factory to cache if not available
   HibernateSessionFactory.addFactory(factoryName,
packageName,
extConfigFilePath);

   HibernateSession hs = new HibernateSession();
   hs.setFactoryName(factoryName);
   ((BaseActionSupport)action).setHibernateSession(hs);

   try {
   result = invocation.invoke();//calls the action
here it creates
transaction data
   }

   // Note that all the cleanup is done
   // after the view is rendered, so we
   // have an open session in the view

   catch (Exception e) {
   hs.setRollBackOnly(true);
   if (e instanceof HibernateException) {
   LOG.error("HibernateException in
execute()", e);
   return Action.ERROR;
   }
   else {
   LOG.error("Exception in execute()", e);
   throw e;
   }
   }

   finally {
   try {
   hs.disposeSession();//commits transaction ,
and closes hibernate session
   return result;//expected result when an
exception occurs with hibernate
operations
   }
   catch (HibernateException e) {
   LOG.error("HibernateException in
dispose()", e);
   return Action.ERROR;
   }
   }
   }

-Action
Class--
public class CreateServiceAction extends BaseActionSupport {

   private Service service;

   public CreateServiceAction() {
   service = new Service();
   }

   public String execute() throws Exception {
   ServiceManager.getInstance().createService(getSession(),
service);//gets
the hibernate session and sends it to the serviceManager object which
creates transaction
   set("service", service);
   return SUCCESS;
   }

   public Service getService() {
   return service;
   }
}

*

--
View this message in context:
http://www.nabble.com/Struts-2-exception-problem-tf3525255.html#a9835135
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: S2: Better passing of fields by link

2007-04-05 Thread joey

I think you want the a tag having the ajax function like the autocompleter
tag.
You can just use ajax lib javascript like dojo to achieve it.
There is the snippet:
   function dojoForm(form) {
   var kw = {
   mimetype: "text/plain",
   encoding: 'utf-8',
   formNode: form,
   load: function(type, data, evt) {//callback function

   },
   error: function(t, e) {
   alert("Error!... " + e.message);
   }
   };
   dojo.io.bind(kw);
   return false;
   }

Edit
Lineup
For details,you can see the showcase app or dojo documentation.


On 4/6/07, Scott Nesbitt <[EMAIL PROTECTED]> wrote:



I have a link that calls an action and I would like
the action class to have some field values from my
page.  Currently I do this:


Edit
Lineup

In rewriteLink() I manually create a list of parameter
key/values.  Is there a better way?  In my
autocompleter tag I can just do formId="dataForm" and
have a small form  with hidden fields that get
automatically serialized and sent to the action class,
but that does not seem to work with the a tag, despite
what the documentation says about ajax.

Any ideas?  Perhaps I am going about this wrong but do
not see any good examples of how to do this.

Thank you,

Scott





No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: S2: Better passing of fields by link

2007-04-05 Thread joey

Yes,your method is easier,I just missed your reply.
regards
joey
On 4/6/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:


I think it is easier just to use the anchor tag from the ajax theme, which
already does this.

regards
musachy

On 4/5/07, joey <[EMAIL PROTECTED]> wrote:
>
> I think you want the a tag having the ajax function like the
autocompleter
> tag.
> You can just use ajax lib javascript like dojo to achieve it.
> There is the snippet:
> function dojoForm(form) {
> var kw = {
> mimetype: "text/plain",
> encoding: 'utf-8',
> formNode: form,
> load: function(type, data, evt) {//callback function
>
> },
> error: function(t, e) {
> alert("Error!... " + e.message);
> }
> };
> dojo.io.bind(kw);
> return false;
> }
>  onsubmit="try{dojoForm(this)}catch(E){};return false;">
>  onclick="this.form.submit()">Edit
> Lineup
> For details,you can see the showcase app or dojo documentation.
>
>
> On 4/6/07, Scott Nesbitt <[EMAIL PROTECTED]> wrote:
> >
> >
> > I have a link that calls an action and I would like
> > the action class to have some field values from my
> > page.  Currently I do this:
> >
> >  > includeParams="all"/>
> >  > onclick="this.href=rewriteLink(this.href)">Edit
> > Lineup
> >
> > In rewriteLink() I manually create a list of parameter
> > key/values.  Is there a better way?  In my
> > autocompleter tag I can just do formId="dataForm" and
> > have a small form  with hidden fields that get
> > automatically serialized and sent to the action class,
> > but that does not seem to work with the a tag, despite
> > what the documentation says about ajax.
> >
> > Any ideas?  Perhaps I am going about this wrong but do
> > not see any good examples of how to do this.
> >
> > Thank you,
> >
> > Scott
> >
> >
> >
> >
> >
>

> > No need to miss a message. Get email on-the-go
> > with Yahoo! Mail for Mobile. Get started.
> > http://mobile.yahoo.com/mail
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd



Re: S2: Design Input suggestion

2007-04-05 Thread joey

I don't think you should turn on validation in "edit" mode or "create" mode.
Validation is only needed in "save" mode.
"edit" mode or "create" mode is just to show field data,no submit.
You can set validation only work for "save" mode like this:
Add
   edit,create
   
in edit or create mode configuration file.
Btw.edit and create could be done in one method.It's more compact.
You can refer to the crud example in the showcase app.

On 4/6/07, Harring Figueiredo <[EMAIL PROTECTED]> wrote:


Folks:


I have a form that is rendered by calling an action from a get or a put.

In  "edit" mode, the fields are pre-populated from the POJO (param to get
the POJO is passed on the URL GET).
In "create" mode, the fields are, of course, empty.

The design issue I am having has to do with the Validation.
If I turn on validation, then when the Action is called for the create
mode,
the the validators intercept an reders the form with
the errors (i.e. "Missing Field Blah")

What is the best way you guys handle this situation?

Thanks in advance.

hff



Re: [S2] redirect-action to different namespace

2007-04-06 Thread joey

Package 's name is the key to for other packages to reference like extend.
Namespace could be different  to name.

On 4/6/07, Manu Mahajan < [EMAIL PROTECTED]> wrote:


Manu Mahajan wrote:
> 1. How can I redirect a result from an action to an action in another
> namespace?
> I have separate configuration files for each namespace.
>
> 2. What is the significance of packages? Should the package name
> always be the same as the namespace?
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
Ok. I just found out the answer to the first question in the docs...

Did something like this...

menu
/project


But I'm still not sure how package and namespace are related. Please help.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [S2] redirect-action to different namespace

2007-04-06 Thread joey

only interceptors,results will be inherited from parent package.


On 4/6/07, Manu Mahajan <[EMAIL PROTECTED]> wrote:


Ok. So what happens when I extend a package? Do i inherit its
namespaces, interceptors and actionmappings in the sub package?


joey wrote:
> Package 's name is the key to for other packages to reference like
> extend.
> Namespace could be different  to name.
>
> On 4/6/07, Manu Mahajan < [EMAIL PROTECTED]> wrote:
>>
>> Manu Mahajan wrote:
>> > 1. How can I redirect a result from an action to an action in another
>> > namespace?
>> > I have separate configuration files for each namespace.
>> >
>> > 2. What is the significance of packages? Should the package name
>> > always be the same as the namespace?
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>> >
>> Ok. I just found out the answer to the first question in the docs...
>>
>> Did something like this...
>> 
>> menu
>> /project
>> 
>>
>> But I'm still not sure how package and namespace are related. Please
>> help.
>>
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> 
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.26/748 - Release Date:
4/5/2007 3:33 PM
>




Re: Accesssing a bean from a jsp without struts tags

2007-04-06 Thread joey

add request.setAttribute("invoices",accountBean.getInvoices()) in your
action execute method.
On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


OK, let me include more details, may be someone will understand what I
am talking about.
I have a list that belongs to  a Bean that's wet in an action class.

public AccountBean getAccountBean() {
return accountBean;
}

AccountBean has an ArrayList  calles invoices.

now im my jsp, I need to display this in a datagrid, I am doing this,
but it's not working:












that's the error  I am getting:

According to TLD or attribute directive in tag file, attribute items does
not accept any expressions
org.apache.struts2.dispatcher.Dispatcher.serviceAction(
Dispatcher.java:518)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(
FilterDispatcher.java:421)


Any Idea ??




[EMAIL PROTECTED] wrote:
> I have a bean that is set in an action class. I can access it using
> struts tag, but what do I do if I need to access it from somewhere else
?
>
> for example, if I need to access it from a list iterator.
>
> Thanks.
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: caching and reload

2007-04-06 Thread joey

do you have this?




On 4/7/07, Laurie Harper <[EMAIL PROTECTED]> wrote:


Chris Pat wrote:
> Hello
> Is/how it possible to clear the cache on an action?
> My action works perfectly, however when the user hits reload
> the previous values are repeated.

I'm not sure what cache you're talking about, but isn't this behaviour
as you would expect? If I refresh a page, I expect to see the same
response as I got when I loaded it the first time.

> I have coded a reset with ="" and still it uses the old values.
> What am I missing?  I will trap the null or "" values in the
> action(I know I should do it in validation, but it is a case of
> jgid, grin).  I really need to truly reset the values either fed
> to the action class or somewhere cached by the framework for the
> action class.  tia.

Coded a reset where? I think you need to post some code and
configuration samples to illustrate exactly what you are doing, and
describe in more detail how the resulting behaviour differs from what
you expect.

L.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Accesssing a bean from a jsp without struts tags

2007-04-07 Thread joey

just implement interface "ServletRequestAware" and
ensure you has config "servlet-config" interceptor in
your action mapper.

regards
joey




On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


[EMAIL PROTECTED] wrote:
> joey wrote:
>> add request.setAttribute("invoices",accountBean.getInvoices()) in your
>> action execute method.

How do I do this is struts 2. I couldn't find any way to get my hand on
the Request object.

>> On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>
>
> I thought that was set automatically by struts through the getters !
>
>
>>> OK, let me include more details, may be someone will understand what I
>>> am talking about.
>>> I have a list that belongs to  a Bean that's wet in an action class.
>>>
>>> public AccountBean getAccountBean() {
>>> return accountBean;
>>> }
>>>
>>> AccountBean has an ArrayList  calles invoices.
>>>
>>> now im my jsp, I need to display this in a datagrid, I am doing this,
>>> but it's not working:
>>>
>>>
>>>
>>> >> name="datagrid1" >
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>>
>>> that's the error  I am getting:
>>>
>>> According to TLD or attribute directive in tag file, attribute items
>>> does
>>> not accept any expressions
>>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(
>>> Dispatcher.java:518)
>>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(
>>> FilterDispatcher.java:421)
>>>
>>>
>>> Any Idea ??
>>>
>>>
>>>
>>>
>>> [EMAIL PROTECTED] wrote:
>>> > I have a bean that is set in an action class. I can access it using
>>> > struts tag, but what do I do if I need to access it from somewhere
>>> else
>>> ?
>>> >
>>> > for example, if I need to access it from a list iterator.
>>> >
>>> > Thanks.
>>> >
>>> >
>>> >
>>> >
-
>>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> > For additional commands, e-mail: [EMAIL PROTECTED]
>>> >
>>> >
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Accesssing a bean from a jsp without struts tags

2007-04-07 Thread joey

struts set action object in valuestack,so you can't refere to it in your
tag.
I just manually set it in request scope.
btw.Maybe someone know better method.:)

On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


joey wrote:
> add request.setAttribute("invoices",accountBean.getInvoices()) in your
> action execute method.
> On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>

I thought that was set automatically by struts through the getters !


>> OK, let me include more details, may be someone will understand what I
>> am talking about.
>> I have a list that belongs to  a Bean that's wet in an action class.
>>
>> public AccountBean getAccountBean() {
>> return accountBean;
>> }
>>
>> AccountBean has an ArrayList  calles invoices.
>>
>> now im my jsp, I need to display this in a datagrid, I am doing this,
>> but it's not working:
>>
>>
>>
>> > name="datagrid1" >
>> 
>> 
>> 
>> 
>> 
>> 
>>
>>
>> that's the error  I am getting:
>>
>> According to TLD or attribute directive in tag file, attribute items
>> does
>> not accept any expressions
>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(
>> Dispatcher.java:518)
>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(
>> FilterDispatcher.java:421)
>>
>>
>> Any Idea ??
>>
>>
>>
>>
>> [EMAIL PROTECTED] wrote:
>> > I have a bean that is set in an action class. I can access it using
>> > struts tag, but what do I do if I need to access it from somewhere
>> else
>> ?
>> >
>> > for example, if I need to access it from a list iterator.
>> >
>> > Thanks.
>> >
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: struts.action.extension question

2007-04-11 Thread joey

keep struts.action.extension default.and create a filter to make sure
it's before the struts filter.like this:
   
   yourfilter
   movie/*
   
   
   struts2
   /*
   
u can foward or redirect to the url movie.action?movieTitle=* or something
else in your
filter.

regards
joey
On 4/11/07, meeboo <[EMAIL PROTECTED]> wrote:



No takers on this?


meeboo wrote:
>
> Hey all
>
> I have a mapping pattern which looks like this
>
> 
> {1}
> /movie.jsp
> 
>
> The wildcard is for backwards compability since our original JSP/Servlet
> web-layer mapped movie titles like
> http:localhost:8080/movie/movieTitle
>
> This works fine if I set struts.action.extension to "", this way I
> preserve compatibility since the movie title is the actual action name.
> The problem is that S2 will also interpret everything else as being
> actions - even CSS names making the pages not render correctly. Is there
a
> way around this?
>

--
View this message in context:
http://www.nabble.com/struts.action.extension-question-tf3548145.html#a9934814
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [s2] s:url escaping '&' between params

2007-04-12 Thread joey

I tried your code,but it worked fine!

On 4/12/07, Manu Mahajan <[EMAIL PROTECTED]> wrote:


Hi

I'm facing a very annoying problem with s:url. For some reason it is
encoding the '&' between the params to &

Here's my code








The above code outputs the url with parameters and '&' encoded

What could be the reason?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




How to use "Autocompleter" like GMail style.

2008-04-10 Thread Joey
Hi Everybody.

Just want to know how to can I use "Autocompleter" as GMail style,
I mean, in GMail website, When I  type more than 1 recipient name in
"To:" text box, the text box can complete with each recipient name.

I have checked Antocompleter document in Struts2 website, but didn't
find any useful information.

Thanks

Joey

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to get all sessions in one web application

2008-06-26 Thread Joey
Hi,

Just want to know how to get all sessions.
now, I used a listener to add ActionContext.getContext().getSession()
to a list by myself, I just wondering maybe there is a struts API can
get all sessions.

Thanks.

Joey

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to get all sessions in one web application

2008-06-26 Thread Joey
for example, in a application,  a admin user maybe want to check all
sessions on this application, just for this
as I wrote in my first email, I am using  a listener to add each
session when a session created, but I am lazy', so just wondering
maybe there is a better and easier way to get all sessions.

On Thu, Jun 26, 2008 at 7:08 PM, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> On Thu, Jun 26, 2008 at 3:53 AM, Joey <[EMAIL PROTECTED]> wrote:
>
>> Just want to know how to get all sessions.
>> now, I used a listener to add ActionContext.getContext().getSession()
>> to a list by myself, I just wondering maybe there is a struts API can
>> get all sessions.
>
> AFAIK there is no 'getSessions' method anywhere in the Servlet spec.
> (You should be able to see the session you are in, but not the
> others.)
>
> What problem are you trying to solve by doing this?
>
> --
> Wendy
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to use checkbox in struts.

2006-02-06 Thread Joey Watson
Hello everybody.

I think this is a old question. but I can not find a good and complete
example in Google.
My question is :

I have a Jsp page which will list some datas for user. user can choose(by
click the checkbox) some of those data and click a botton for delete or some
others operator. So I think my Action class , ActionForm , data class and
JSP will like this.
--
Row {
private String isSelect;
public getIsSelect() {
}
public setIsSelect() {
}
}

ActionForm {

private ArrayList rows; //dynamic

public get
public set...
}
-
Action {
...
  for (int i = 0; i < ActionForm.rows.size; i++){
   Row row = ActionForm.rows.get(i);
   if ( row.isSelect =="check" ) {
 //Do some thing here.
   }
  }
}

JSP page.

I have to use  or  for data list.
datas quantity is not fix.
can not use 

and I need use a botton commit data to Action.

my problem is :

1. In Row class. If define isSelect as a String , is it ok, or boolean is
better?
2. I don't know how to write  or  to
make a checkbox, and make action can know whick is be selected.

Thanks for any help.

Joey


Re: How to use checkbox in struts.

2006-02-08 Thread Joey Watson
Thanks everybody, I followed the method that Vidya told me. it can work
well.
and Robert , you can send Vidya's letter to the programer , if still
unsuccessful
you can tell me. I will make a demo for you.

Thanks again.

Joey.


looking for struts,ejb,jboss,ant demo

2006-02-09 Thread Joey Watson
Hello everyone.

I am looking for a demo using struts,ejb,jboss, ant. I searched by google.
but only found struts,ejb,jboss demo by eclipse. but I don't depend on IDE
tools. I want to learn more. So hope anybody can help me find a demo using
struts,ejb,jboss with ant.

Thanks so much.

Joey


Re: [other] Borland want to sell its IDE products.....

2006-02-09 Thread Joey Watson
Borland, a great company is gone.  I can not forget Delphi,  best IDE tool I
have used. to be honesty, I like Delphi more than Eclipse. haa, but it's
life...

On 2/9/06, Legolas Woodland <[EMAIL PROTECTED]> wrote:
>
> Hi
> just look at
> http://blogs.borland.com/davidi/archive/2006/02/08/23013.aspx
>
> it say that borland is going to sell its IDEs , what will happen next ?
> who will buy jdeveloper ?
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: looking for struts,ejb,jboss,ant demo

2006-02-09 Thread Joey Watson
Thanks everybody. It's seems I need to study it by myself...np..
thanks

Joey

On 2/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> Or use the struts,ejb,jboss,eclipse demo and then learn how to set up
> the ant build.  I use eclipse for day-to-day work and ant for the
> reference builds.
>
> - George
>
> Nick Sophinos wrote:
> >
> > An alternative would be to find an EJB example that you are
> > comfortable with and then find a Struts example that you
> > could lay over it.  There are plenty of each out there, but
> > not so much all together.  Maybe JBoss's site?
> >
> > - Nick
> >
> > On 2/9/06, Joey Watson <[EMAIL PROTECTED]> wrote:
> > > Hello everyone.
> > >
> > > I am looking for a demo using struts,ejb,jboss, ant. I searched by
> > > google. but only found struts,ejb,jboss demo by eclipse.
> > but I don't
> > > depend on IDE tools. I want to learn more. So hope anybody
> > can help me
> > > find a demo using struts,ejb,jboss with ant.
> > >
> > > Thanks so much.
> > >
> > > Joey
> > >
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Problem about first page.

2006-02-20 Thread Joey Watson
Hi everybody.

I want to write a login module.
login.jsp-display userId , userName, password, company
infomation (a drop down box)
 LoginAction.java check login information
 LoginForm.java  --
some command class.  one of them will load company information from db.

When user open web site. the login page will be displayed. user need
to fill name, id, password and select a company from a drop down box.
So I need to load company list from before login page displayed. I
want to do this in Action class (it will call a command class). but my
problem is login.jsp is defined as in web.xml .
So before it is been created . onliy ActionForm would be create, the
Action Class doesn't be created. and I don't want to do the load
comany actions in ActionForm. So my question is how could I can make
Action class to be create and do load actions before the login.jsp be
displayed.

Thanks..
Joey

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem about first page.

2006-02-20 Thread Joey Watson
yes. I think it is a good idea. but I don't know to do it. I can make
a jsp page as welcome page, but how could I make it can forward to
Login.jsp automatically. user don't need to click a link or a button.

On 2/21/06, Bryan LaPlante <[EMAIL PROTECTED]> wrote:
> Could you make you welcome page different than login.jsp and have it forward
> to login.jsp? If login is your front door, maybe all of your welcome pages
> could forward to it.
>
> - Original Message -
> From: "Joey Watson" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" 
> Sent: Monday, February 20, 2006 12:14 PM
> Subject: Problem about first page.
>
>
> > Hi everybody.
> >
> > I want to write a login module.
> > login.jsp-display userId , userName, password, company
> > infomation (a drop down box)
> >  LoginAction.java check login information
> >  LoginForm.java  --
> > some command class.  one of them will load company information from
> db.
> >
> > When user open web site. the login page will be displayed. user need
> > to fill name, id, password and select a company from a drop down box.
> > So I need to load company list from before login page displayed. I
> > want to do this in Action class (it will call a command class). but my
> > problem is login.jsp is defined as in web.xml .
> > So before it is been created . onliy ActionForm would be create, the
> > Action Class doesn't be created. and I don't want to do the load
> > comany actions in ActionForm. So my question is how could I can make
> > Action class to be create and do load actions before the login.jsp be
> > displayed.
> >
> > Thanks..
> > Joey
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem about first page.

2006-02-20 Thread Joey Watson
Or I think maybe many project would meet this kind of quesition. Just
want to know how to deal with it when you need to display some
information loaded from db in you first page.


On 2/21/06, Joey Watson <[EMAIL PROTECTED]> wrote:
> yes. I think it is a good idea. but I don't know to do it. I can make
> a jsp page as welcome page, but how could I make it can forward to
> Login.jsp automatically. user don't need to click a link or a button.
>
> On 2/21/06, Bryan LaPlante <[EMAIL PROTECTED]> wrote:
> > Could you make you welcome page different than login.jsp and have it forward
> > to login.jsp? If login is your front door, maybe all of your welcome pages
> > could forward to it.
> >
> > - Original Message -
> > From: "Joey Watson" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" 
> > Sent: Monday, February 20, 2006 12:14 PM
> > Subject: Problem about first page.
> >
> >
> > > Hi everybody.
> > >
> > > I want to write a login module.
> > > login.jsp-display userId , userName, password, company
> > > infomation (a drop down box)
> > >  LoginAction.java check login information
> > >  LoginForm.java  --
> > > some command class.  one of them will load company information from
> > db.
> > >
> > > When user open web site. the login page will be displayed. user need
> > > to fill name, id, password and select a company from a drop down box.
> > > So I need to load company list from before login page displayed. I
> > > want to do this in Action class (it will call a command class). but my
> > > problem is login.jsp is defined as in web.xml .
> > > So before it is been created . onliy ActionForm would be create, the
> > > Action Class doesn't be created. and I don't want to do the load
> > > comany actions in ActionForm. So my question is how could I can make
> > > Action class to be create and do load actions before the login.jsp be
> > > displayed.
> > >
> > > Thanks..
> > > Joey
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem about first page.

2006-02-20 Thread Joey Watson
Thanks  Bryan and Michael. I have solved this problem.
Thanks you very much.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to use

2006-05-02 Thread Joey Watson

Hi All.

I got a problem when I was using . I used to use 
before. like





<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

those codes can work well. but now I want to use . but
the code  '<%=ApplicationAction.ACCSUBJ_CHANGE%>', and '<%=index%>'
value can not be get.
the value  passd to the doSubmitWithIndex function is 
<%=ApplicationAction.ACCSUBJ_CHANGE%>  and <%=index%> , not

accsubj_change and 0,1,2.

Thanks.

Joey

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to use

2006-05-03 Thread Joey Watson

u meant using  tag or what? I tried to use the
, but it doesn't work.
I think the reason is. struts is not allow use java or tag for the
paramater's value. like






<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

the result html is







<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
struts does not translate the '<%=ApplicationAction.ACCSUBJ_CHANGE%>'
to its value 'accsubj_change'.

even I use the . it does be translated.





On 5/3/06, Shshank Jain <[EMAIL PROTECTED]> wrote:

try using bean tags to write the specific values.

On 5/2/06, Joey Watson <[EMAIL PROTECTED]> wrote:
>
> Hi All.
>
> I got a problem when I was using . I used to use 
> before. like
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>name="applicationItem" indexed="true"
>   onchange="doSubmitWithIndex(this.form,
>  '<%=ApplicationAction.ACCSUBJ_CHANGE%>',
>  '<%=index%>')" >
> 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> those codes can work well. but now I want to use . but
> the code  '<%=ApplicationAction.ACCSUBJ_CHANGE%>', and '<%=index%>'
> value can not be get.
> the value  passd to the doSubmitWithIndex function is
> <%=ApplicationAction.ACCSUBJ_CHANGE%>  and <%=index%> , not
> accsubj_change and 0,1,2.
>
> Thanks.
>
> Joey
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to use

2006-05-04 Thread Joey Watson

Thanks Kjersti. ur code works. but I am just thinking. is it a best
way? coz it seems little bit hard to read.





On 5/4/06, Kjersti Berg <[EMAIL PROTECTED]> wrote:

Try making the entire onchange one scriptlet like this:



Kjersti

On 03/05/06, Joey Watson <[EMAIL PROTECTED]> wrote:
>
> u meant using  tag or what? I tried to use the
> , but it doesn't work.
> I think the reason is. struts is not allow use java or tag for the
> paramater's value. like
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>   name="applicationItem" indexed="true"
>  onchange="doSubmitWithIndex(this.form,
> '<%=ApplicationAction.ACCSUBJ_CHANGE%>',
> '<%=index%>')" >
> 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> the result html is
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> onchange="doSubmitWithIndex(this.form,
>  '<%=ApplicationAction.ACCSUBJ_CHANGE%>',
>  '<%=index%>')">
> 
> 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> struts does not translate the '<%=ApplicationAction.ACCSUBJ_CHANGE%>'
> to its value 'accsubj_change'.
>
> even I use the . it does be translated.
>
>
>
>
>
> On 5/3/06, Shshank Jain <[EMAIL PROTECTED]> wrote:
> > try using bean tags to write the specific values.
> >
> > On 5/2/06, Joey Watson <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi All.
> > >
> > > I got a problem when I was using . I used to use 
> > > before. like
> > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> > >  > >   name="applicationItem" indexed="true"
> > >   onchange="doSubmitWithIndex(this.form,
> > >  '<%=ApplicationAction.ACCSUBJ_CHANGE%>',
> > >  '<%=index%>')" >
> > > 
> > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > >
> > > those codes can work well. but now I want to use . but
> > > the code  '<%=ApplicationAction.ACCSUBJ_CHANGE%>', and '<%=index%>'
> > > value can not be get.
> > > the value  passd to the doSubmitWithIndex function is
> > > <%=ApplicationAction.ACCSUBJ_CHANGE%>  and <%=index%> , not
> > > accsubj_change and 0,1,2.
> > >
> > > Thanks.
> > >
> > > Joey
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to avoid lots of "if else" in Action class.

2006-05-04 Thread Joey Watson

hello everybody.

 When I was working a big project. I always met this problem. coz the
sometimes there are a lot of event need to be handled in a single jsp
page. so programer need to use lots of "if - else" to deal with
different event  in Action.execute method. of cause. I think those
codes is not hard to be understant,  but sometimes it make the action
class too big.  Any suggestion?

Thanks.

Joey.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid lots of "if else" in Action class.

2006-05-04 Thread Joey Watson

Thanks Michael. I will study it.

On 5/5/06, Michael Jouravlev <[EMAIL PROTECTED]> wrote:

Dispatching action. Do not use old and crusty DispatchAction.
See these links:

http://wiki.apache.org/struts/EventActionDispatcher
http://wiki.apache.org/struts/DataEntryForm

Michael.

On 5/4/06, Joey Watson <[EMAIL PROTECTED]> wrote:
> hello everybody.
>
>   When I was working a big project. I always met this problem. coz the
> sometimes there are a lot of event need to be handled in a single jsp
> page. so programer need to use lots of "if - else" to deal with
> different event  in Action.execute method. of cause. I think those
> codes is not hard to be understant,  but sometimes it make the action
> class too big.  Any suggestion?
>
> Thanks.
>
> Joey.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ActionContext.getContext().getSession return null when I test Struts2 action by JUnit.

2008-02-01 Thread Joey Watson
Hi everybody.

I want to test a action class (Struts2) by JUnit. and then method in
this action need a value in session, then when I run my JUnit test
class,  ActionContext.getContext().getSession return null. (not
ActionContext.getContext().getSession().get("XXX") return null).
this action class is working fine in browser.


thanks for any help

Joey

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Pls help me to find Struts 1.0.2 binary, library and source

2007-09-02 Thread Joey Watson
Hi everybody.

I have to find Struts 1.0.2 Binary Distribution, Struts 1.0.2 Library
Distribution and
Struts 1.0.2 Source Code Distribution for a project, but I didn't find
it on apache website(http://archive.apache.org/dist/jakarta/struts/binaries/),
only 1.1 can be found, so anybody know where I can download 1.0.2
binary, library and source.

Many thanks.

Joey

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pls help me to find Struts 1.0.2 binary, library and source

2007-09-02 Thread Joey Watson
Wendy , Thank you very much.

On 9/3/07, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> On 9/2/07, Joey Watson <[EMAIL PROTECTED]> wrote:
>
> > I have to find Struts 1.0.2 Binary Distribution, Struts 1.0.2 Library
> > Distribution and
> > Struts 1.0.2 Source Code Distribution for a project, but I didn't find
> > it on apache 
> > website(http://archive.apache.org/dist/jakarta/struts/binaries/),
> > only 1.1 can be found, so anybody know where I can download 1.0.2
> > binary, library and source.
>
> It's here:  http://archive.apache.org/dist/struts/struts-1.0.2/
>
> --
> Wendy
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JSP Compile error

2006-07-02 Thread Joey Watson

Hello everybody.

I got a strange problem, I use the code :
'
/>

it can work if I add onchange to JSP directly in Jboss tmp folder, but
when I try to compile this JSP , got a compiling error,

[jasperc] 2006-07-03 09:39:35 - error-the file
'\jsp\com\xxx\xxx\xxx\User.jsp' generated the followi
ng parse exception: org.apache.jasper.compiler.ParseException:
\jsp\com\xxx\xxx\xxx\User.jsp(90,39) Attribute  has no value

Strut 1.1
Jboss 4.


Any idea? thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]