There is no Action mapped for namespace / and action name SERVICOS/.

2010-07-09 Thread Gustavo Felisberto
Hello List,

 

I have a somewhat strange setup where my Struts 2 application is a proxy for
some other system.

In struts.xml I have:

 

 

constant name=struts.action.extension
value=action,,html,htm,css,js,png,gif,jpg,jpeg,flv,swf/

action name=* class=wit.vf.yorn.struts.actions.ProxyAction

/action

 

This action does not have any result because it implements
ServletResponseAware and ServletRequestAware. In my code I will analyze the
requested url and redirect to the proper location.

 

My problem is that if I access the system with a url like
http://server/context/SERVICOS/index.html or
http://server/context/SOME_RANDOM_URL/index.html my code gets called and
everything works ok. But if I use http://server/context/SERVICOS/ I get an
error that: There is no Action mapped for namespace / and action name
SERVICOS/.

 

How can I make it so that the requests with no file will get delivered to my
code?

 

Gustavo

 

-- 

Gustavo Felisberto.

WIT-Software S.A. 

Coimbra, Leiria, Lisboa, Porto (Portugal)

San Jose (California)

Phone: +351239801033

Web:  http://www.wit-software.com http://www.wit-software.com 

 



RE: Creating Sub-Domains from Struts 2 application

2010-06-29 Thread Gustavo Felisberto
Hello Amol,

This does not seem to be 100% struts related. If you want gustavo.domain.com
to exist you either have to create the sub-domain (and how you do that
really depends on the DNS server being used) or you can have a record like:
*.domain.com 192.168.1.1

In this case all requests will be sent to that server and you can have logic
on your application that looks at the request and knows the username.

Gustavo

-Mensagem original-
De: Amol Ghotankar [mailto:ghotankaru...@gmail.com] 
Enviada: terça-feira, 29 de Junho de 2010 05:26
Para: Struts Users Mailing List
Assunto: Creating Sub-Domains from Struts 2 application

Dear List member,

I have a requirement in which when a user registers on the portal developed
using struts 2, a sub-domain should be created for him.

Like say Amol registers on cursivetech.com, then when he logs into his
account it must look like amol.cursivetech.com

How to make such arrangement and create such sub-domains directly from the
application itself.

Regards,

Amol Ghotankar,
cursivetech.com


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: IMPORTANT Call action on application deploy, like servlet with load-on-startup (Struts 2)

2010-06-23 Thread Gustavo Felisberto
Create a servlet that makes a request to the action. 

Gustavo Felisberto

On 23 de Jun de 2010, at 19:03, Oscar oscar.kalde...@gmail.com wrote:

 Hi to all, i have the next situation: I need to call an action on
 application startup like you can call a servlet on application startup
 by setting load-on-startup parameter servlet on web.xml . I can't
 use a servlet because i need to trigger my interceptors that
 initialize JPA EntityManager . Is there a way to achieve this?
 
 Best regards.
 
 -- 
 Oscar Calderón
 SCJP 6
 http://www.javahowto.net/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Action result to go nowhere

2010-04-22 Thread Gustavo Felisberto
Hello.

If you just follow a link a href=SomeActiontest/a the browser will
render the resulting page. You can in your action just return null; and
nothing is sent to the browser.

But that will give you a blank page.

You probably will want to do a javascript XMLHttpRequest that will return
null in the action. That way nothing will happen on the browser side.

Hope it helps.

-Mensagem original-
De: Upasana Sharma [mailto:sharma...@gmail.com] 
Enviada: quinta-feira, 22 de Abril de 2010 10:47
Para: Struts Users Mailing List
Assunto: Re: Action result to go nowhere

*I do not want to go to some result page
*
*On return INPUT**
*
*No result defined for action com.upasana.action.ComAction and result input*
:)


On Thu, Apr 22, 2010 at 3:13 PM, Rahul Mohan rahul.mo...@tcs.com wrote:

 Try 'return INPUT'.
 - rahul



 From:
 Upasana Sharma sharma...@gmail.com
 To:
 Struts Users Mailing List user@struts.apache.org
 Date:
 22-04-2010 15:08
 Subject:
 Re: Action result to go nowhere



 hi thanks for your response.I tried that
 But my browser goes to some blank page with that respective action name as
 the url.
 It does not stick to the calling page

 --
 Thanks and Regards
 Upasana Sharma


 On Thu, Apr 22, 2010 at 2:53 PM, Miles, Chris 
 chris.mi...@spsa.pnn.police.uk wrote:

  NOT PROTECTIVELY MARKED
 
 
 
  Hi
 
  Do not put any result in the XML and in the Action just return
  Action.NONE
 
  Chris
 
  -Original Message-
  From: Upasana Sharma [mailto:sharma...@gmail.com]
  Sent: 22 April 2010 10:10
  To: Struts Users Mailing List
  Subject: Action result to go nowhere
 
  Hi
 
  I have a link which when clicked invokes some action. I do not want the
  page to redirect or forward to some other jsp or action.
  what should i write in struts.xml result of that action?
 
  --
  Thanks and Regards
  Upasana Sharma
 
  NOT PROTECTIVELY MARKED
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 


 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain
 confidential or privileged information. If you are
 not the intended recipient, any dissemination, use,
 review, distribution, printing or copying of the
 information contained in this e-mail message
 and/or attachments to it are strictly prohibited. If
 you have received this communication in error,
 please notify us by reply e-mail or telephone and
 immediately and permanently delete the message
 and any attachments. Thank you





-- 
Thanks and Regards
Upasana Sharma


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: [Struts 2.1.8] s:url : how to open in a new window ?

2010-03-23 Thread Gustavo Felisberto
Hello,

This is a JS thing. Try:
onclick=javascript:window.open('%{genererRapportPDF}'); return false;

Gustavo

-Mensagem original-
De: Celinio Fernandes [mailto:cel...@yahoo.com] 
Enviada: terça-feira, 23 de Março de 2010 13:03
Para: Struts Users Mailing List
Assunto: [Struts 2.1.8] s:url : how to open in a new window ?

Hi,
I am using Struts 2.1.8.
In a JSP, I have a link which calls an action. I want to open that link in a
new window. The following code works :
 s:url id=genererRapportPDF action=affichePDF windowState= / 
  s:a href=%{genererRapportPDF}
onclick=javascript:window.open('%{genererRapportPDF}');Generation/s:a 
 
  
  
The problem is that it also calls the action / opens the link in the current
window.
How to avoid that ?
Thanks.  
 


  


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: [S2] Error running under Weblogic 10.3.2.0

2010-03-18 Thread Gustavo Felisberto
I have very little experience with Weblogic. Do you know where do I need to 
copy the unpacked WAR?

-Mensagem original-
De: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] 
Enviada: quarta-feira, 17 de Março de 2010 10:40
Para: Struts Users Mailing List
Assunto: Re: [S2] Error running under Weblogic 10.3.2.0

2010/3/17 Gustavo Felisberto gustavo.felisbe...@wit-software.com:
 I did some more testing and this is getting really strange. I'm using
 eclipse and when I export the project as a WAR file and place it inside the
 autodeploy directory of a running weblogic domain it works fine. It just
 gives this error when using the publish feature of eclipse.

 Any ideas?

No, did you try export to war and unpack it inside WebLogic?


Regards
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: SQL Injection

2010-03-18 Thread Gustavo Felisberto
Hello,
As far as I know there is nothing in struts to prevent SQL injection. And
that should be done at the database level, so it is not related to Struts.

Also there is no simple way of making parameters sql injection safe. You
can take a look at
http://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet They
have some code that will take care of inputs depending on the Database used
(they have cleaners for Oracle, Mysql and SQLServer).

-Mensagem original-
De: abhishek jain [mailto:abhishek.netj...@gmail.com] 
Enviada: quinta-feira, 18 de Março de 2010 10:31
Para: Struts Users Mailing List
Assunto: SQL Injection

Hi,
Do we have any special technique in Struts for preventing sql injection, i
know we can prevent it via parameterized query , but my application design
do not permit so,
So can anyone here help me on this, i need a function whom if i pass a
value, it becomes sql injection safe.,
Pl. help
-- 
Thanks and kind Regards,
Abhishek jain


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: [S2] Error running under Weblogic 10.3.2.0

2010-03-18 Thread Gustavo Felisberto
Hello again,

I have very little experience with Weblogic and maybe you can give me a hand 
with IntelliJ Idea. I'm using version 9.0.2 EAP.

I installed Weblogic 10.3.2 and created a domain. Under Idea I added the 
Application server but I'm having issues with redeploy. How is your setup?

What I would love would be a small tutorial on how to do it properly. I found 
some tutorials but are for older versions of Idea.

Gustavo 

-Mensagem original-
De: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] 
Enviada: quinta-feira, 18 de Março de 2010 13:13
Para: Struts Users Mailing List
Assunto: Re: [S2] Error running under Weblogic 10.3.2.0

2010/3/18 Gustavo Felisberto gustavo.felisbe...@wit-software.com:
 I have very little experience with Weblogic. Do you know where do I need to 
 copy the unpacked WAR?

I don't know, I'm using IntelliJ IDEA to deploy unpack version and it
works perfectly!


Regards
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: [S2] Error running under Weblogic 10.3.2.0

2010-03-17 Thread Gustavo Felisberto
I did some more testing and this is getting really strange. I'm using
eclipse and when I export the project as a WAR file and place it inside the
autodeploy directory of a running weblogic domain it works fine. It just
gives this error when using the publish feature of eclipse.

Any ideas?

Gustavo
 
-Mensagem original-
De: Gustavo Felisberto [mailto:gustavo.felisbe...@wit-software.com] 
Enviada: terça-feira, 16 de Março de 2010 11:45
Para: 'Struts Users Mailing List'
Assunto: [S2] Error running under Weblogic 10.3.2.0

I am trying to run a Struts 2 application (basically the blank app). And I
get an error. Can someone give me a hand?

 

16/Mar/2010 10H52m GMT Info
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
gustavo-PC AdminServer [ACTIVE] ExecuteThread: '9' for queue:
'weblogic.kernel.Default (self-tuning)' anonymous   1268736734488
BEA-00 Parsing configuration file [struts-default.xml] 

16/Mar/2010 10H52m GMT Error
org.apache.struts2.dispatcher.Dispatcher gustavo-PC AdminServer
[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default
(self-tuning)' anonymous   1268736734599 BEA-00 Dispatcher
initialization failed

Unable to load configuration. - bean -
zip:C:/Oracle/Middleware/user_projects/domains/my_domain/servers/AdminServer
/tmp/_WL_user/sampleEAR/jg8z8u/war/WEB-INF/lib/struts2-core-2.1.8.1.jar!/str
uts-default.xml:29:72

at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Configu
rationManager.java:58)

at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatche
r.java:374)

at
org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)

at
org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperation
s.java:69)

at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(S
trutsPrepareAndExecuteFilter.java:51)

at
weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.j
ava:332)

at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:321)

at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)

at
weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:98)

at
weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:59
)

at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServle
tContext.java:1805)

at
weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.ja
va:3045)

at
weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1397)

at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:460)

at
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDrive
r.java:425)

at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.j
ava:83)

at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver
.java:119)

at
weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriv
er.java:200)

at
weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListene
rInvoker.java:247)

at
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDrive
r.java:425)

at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.j
ava:83)

at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver
.java:119)

at
weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlo
w.java:27)

at
weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267
)

at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.j
ava:83)

at
weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:40
9)

at
weblogic.application.internal.EarDeployment.activate(EarDeployment.java:54)

at
weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStat
eChecker.java:161)

at
weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContai
nerInvoker.java:79)

at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(
AbstractOperation.java:569)

at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateD
eployment(ActivateOperation.java:150)

at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(
ActivateOperation.java:116)

at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(Ab
stractOperation.java:323

[S2] Error running under Weblogic 10.3.2.0

2010-03-16 Thread Gustavo Felisberto
(ModuleStateDrive
r.java:425)

at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.j
ava:83)

at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver
.java:119)

at
weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriv
er.java:200)

at
weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListene
rInvoker.java:247)

at
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDrive
r.java:425)

at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.j
ava:83)

at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver
.java:119)

at
weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlo
w.java:27)

at
weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267
)

at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.j
ava:83)

at
weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:40
9)

at
weblogic.application.internal.EarDeployment.activate(EarDeployment.java:54)

at
weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStat
eChecker.java:161)

at
weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContai
nerInvoker.java:79)

at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(
AbstractOperation.java:569)

at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateD
eployment(ActivateOperation.java:150)

at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(
ActivateOperation.java:116)

at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(Ab
stractOperation.java:323)

at
weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentComm
it(DeploymentManager.java:844)

at
weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentLi
st(DeploymentManager.java:1253)

at
weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(Deploym
entManager.java:440)

at
weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(Dep
loymentServiceDispatcher.java:163)

at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeli
verer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)

at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeli
verer.access$100(DeploymentReceiverCallbackDeliverer.java:12)

at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeli
verer$2.run(DeploymentReceiverCallbackDeliverer.java:67)

at
weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkMa
nagerImpl.java:516)

at
weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)

at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

 

16/Mar/2010 10H52m GMT Info Deployer gustavo-PC AdminServer
[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default
(self-tuning)' WLS Kernel   1268736735510 BEA-149059 Module
META-INF/communities-config.xml of application sampleEAR is transitioning
from STATE_ADMIN to STATE_ACTIVE on server AdminServer.

 

-- 

Gustavo Felisberto.

WIT-Software S.A.

Coimbra (Portugal), San Jose (California)

Phone: +351239801030

Web:  http://www.wit-software.com http://www.wit-software.com 

 



Re: How to remove layout of tags in form

2010-01-24 Thread Gustavo Felisberto

Add theme=simple to the s:form tag.

Sent from my iPhone

On 2010/01/24, at 07:14, Vu Hong Thuan thua...@gmail.com wrote:


Hi all.
I want to custom the layout of my form which use struts tags.
I insertet html tags into form as the following code. But when I  
view the result final. All html tags is pulled out of the form.

How i can insert html code inside a struts form?
Thanks.

s:form action=loadgraph
div
div
s:text name=xinchao id=abx /s:text
s:textfield id=formuleExp0 label=Expression 1  
name=formuleExp0/

s:div id=formuleColor0 cssClass=colorselects:hidden
   id=formuleColorHid0/ 
s:hidden/s:div

div
   xin chao
/div
s:textfield id=formuleExp1 label=Expression 2  
name=formuleExp1/

s:textfield id=width label=Width name=width/
s:textfield id=height label=Height name=height/
s:submit/
/s:form

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



[S2] Iterate over sessions

2010-01-12 Thread Gustavo Felisberto
Hello All,

 

I have a Web application where I handle the logged in status with some
variable in the session. I have some actions for the Administrator where we
can control if a particular user account is locked or not. My problem is
that if a user loges in and after that the admin locks the account the user
can continue to use the application until he logs out and tries to login
again.

 

I did not want to have to go to the database each time the user performs an
action. So when the Admin locks a user I would like to iterate over all
sessions to see if that user is logged in and force a logout.

 

So my question is how can I access all created sessions?

 

-- 

Gustavo Felisberto.

WIT-Software S.A.

Coimbra (Portugal), San Jose (California)

Phone: +351239801030

Web:  http://www.wit-software.com http://www.wit-software.com 

 



Questions about struts dev mode.

2009-12-14 Thread Gustavo Felisberto
I have added devmode to my struts.xml:

 

struts

constant name=struts.devMode value=true/

.

/struts

 

If I go to a action that is not maped I get a very detailed error message.
But that is about it.

For example in a jsp I have:

 

s:form action=ActsAdd theme=simple

s:actionerror/

s:actionmessage/

s:radio list=denunceOtherId name=denunceOtheIdTypes/

s:textfield name=name/

/s:form

 

But the action does not have any getter for the list. If I run the code in
the debugger I see some sort of error being generated, but nothing in the
page.

 

The other thing is that there is also no setName(String name) in the action.
And I get no information about the missing setter.

 

Am I missing something?

 

-- 

Gustavo Felisberto.

WIT-Software, Lda

Coimbra (Portugal), San Jose (California)

Phone: +351239801030

Web:  http://www.wit-software.com http://www.wit-software.com 

 



RE: Catching: Unable to instantiate Action

2009-11-12 Thread Gustavo Felisberto
My toughts also. But in any case I tested and it did not help.

If you find a solution please drop it here.

Gustavo

-Mensagem original-
De: Roger [mailto:roger.var...@googlemail.com] 
Enviada: quarta-feira, 11 de Novembro de 2009 21:02
Para: Struts Users Mailing List
Assunto: Re: Catching: Unable to instantiate Action

On Wednesday 11 November 2009 17:34:49 Oscar wrote:
 Maybe using a exception mapping for java.lang.ClassNotFoundException
 

This sounds like the same problem that I'm having, Why would mapping 
ClssNotFoundException help? It's a sub-class of java.lang.Exception and 
mapping that should catch everything - yes?

Regards


 2009/11/11 Gustavo Felisberto gustavo.felisbe...@wit-software.com
 
  I have a Project were we have in struts.xml:
 
 
 
  action name=/*_* class=packge.to.actions.{1} method={2}
 
 result name=success/WEB-INF/plugins/{1}/{2}.jsp/result
 
  /action
 
 
 
  global-exception-mappings
 
   exception-mapping exception=java.lang.Exception result=error
/
 
  /global-exception-mappings
 
 
 
  global-results
 
   result name=error/WEB-INF/Error.jsp/result
 
  /global-results
 
 
 
  If any exception is thrown in my actions the global maping catches it
and
  sends to correct JSP. If user enters some Url where the Class exists but
  the
  method does not the exception mapping works ok. Problem is if the Class
  does
  not exist. In that case I get a struts error page (if debug mod is on)
or
  a tomcat error page. Any way to catch this exception?
 
 
 
  --
 
  Gustavo Felisberto.
 
  WIT-Software, Lda
 
  Coimbra (Portugal), San Jose (California)
 
  Phone: +351239801030
 
  Web:  http://www.wit-software.com http://www.wit-software.com
 

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Catching: Unable to instantiate Action

2009-11-11 Thread Gustavo Felisberto
I have a Project were we have in struts.xml:

 

action name=/*_* class=packge.to.actions.{1} method={2}

result name=success/WEB-INF/plugins/{1}/{2}.jsp/result

/action

 

global-exception-mappings

  exception-mapping exception=java.lang.Exception result=error /

/global-exception-mappings

 

global-results

  result name=error/WEB-INF/Error.jsp/result 

/global-results

 

If any exception is thrown in my actions the global maping catches it and
sends to correct JSP. If user enters some Url where the Class exists but the
method does not the exception mapping works ok. Problem is if the Class does
not exist. In that case I get a struts error page (if debug mod is on) or a
tomcat error page. Any way to catch this exception?

 

-- 

Gustavo Felisberto.

WIT-Software, Lda

Coimbra (Portugal), San Jose (California)

Phone: +351239801030

Web:  http://www.wit-software.com http://www.wit-software.com 

 



Re: How to get subclass objects in an arraylist?

2009-04-22 Thread Gustavo Felisberto
I guess the problem IS the fact that the type on elements in the list
not being the correct type.

public class Parent {
private String parent = parent;

public String getParent() {
return parent;
}
public void setParent(String parent) {
this.parent = parent;
}
}

public class Child extends Parent{
private String childName = child;
public String getChildName() {
return childName;
}
public void setChildName(String childName) {
this.childName = childName;
}
}

If you do:

ListParent list = new ArrayListParent();
list.add(new Child());
list.get(0).getChildName();

It will not build, you have to cast the Object to the correct type:
((Child)list.get(0)).getChildName();


Same thing for jsp files.

-- 
Gustavo Felisberto.
WIT-Software, Lda
Coimbra (Portugal), San Jose (California)
Phone: +351239801030
Web: http://www.wit-software.com 




signature.asc
Description: OpenPGP digital signature


Re: How to get subclass objects in an arraylist?

2009-04-22 Thread Gustavo Felisberto
Hello Sunil,

It is not pretty but you can:


Object o = list.get(0);

if (o instanceof Child) {
((Child)(o)).childMethod();
} else if (o instanceof Parent) {
 ((Parent)(o)).parentMethod();  
}


Or you can have a Enum in the parent that will store the type and in
that case you can just switch over it.

sunil kumar wrote:
 Hi Gustavo,

 Thank you for your reply.
 My problem is that, I have different subclasses of the Class Question. and 
 since the form is dynamic, there is no way for me to know which Question 
 objects are going to come through...
 I thought the only way is to have an interceptor or i just read about type 
 converters.. using which i can determine the correct class before the objects 
 reach my action class..

 --- On Wed, 22/4/09, Gustavo Felisberto gustavo.felisbe...@wit-software.com 
 wrote:

 From: Gustavo Felisberto gustavo.felisbe...@wit-software.com
 Subject: Re: How to get subclass objects in an arraylist?
 To: Struts Users Mailing List user@struts.apache.org
 Date: Wednesday, 22 April, 2009, 2:25 PM

 I guess the problem IS the fact that the type on elements in the list
 not being the correct type.

 public class Parent {
 private String parent = parent;

 public String getParent() {
 return parent;
 }
 public void setParent(String parent) {
 this.parent = parent;
 }
 }

 public class Child extends Parent{
 private String childName = child;
 public String getChildName() {
 return childName;
 }
 public void setChildName(String childName) {
 this.childName = childName;
 }
 }

 If you do:

 ListParent list = new ArrayListParent();
 list.add(new Child());
 list.get(0).getChildName();

 It will not build, you have to cast the Object to the correct type:
 ((Child)list.get(0)).getChildName();


 Same thing for jsp files.

   


-- 
Gustavo Felisberto.
WIT-Software, Lda
Coimbra (Portugal), San Jose (California)
Phone: +351239801030
Web: http://www.wit-software.com 




signature.asc
Description: OpenPGP digital signature


Re: compatibility between struts and java versions

2008-12-11 Thread Gustavo Felisberto
Acording to SUN even the 1.3.1_24 is no longer supported on most
platforms. Only on solaris 8 there may be support

http://java.sun.com/j2se/1.3/download.html

If you'll use tomcat it will have to be a very old unsupported 5.0 version.
You are going to have lots of problems running anything on such an old
system and help will probably be hard to find.

pierre betz escreveu:
 Hi everybody,
 I'm new to the struts community, and today I've a project to develop using
 struts.

 As I have to use the jave *jre 1.3.1_02* ,

 I would like to know if the version* 1.3.8 * of struts is working with this
 version of java ?
 And, if not, which struts version should I use ?
 Thanks for the answers !


 Pierre BETZ

   


-- 
Gustavo Felisberto.
WIT-Software, Lda
Coimbra (Portugal), San Jose (California)
Phone: +351239801030
Web: http://www.wit-software.com 




signature.asc
Description: OpenPGP digital signature


Re: File download problem in IE7 (struts 2) [SOLVED]

2008-06-05 Thread Gustavo Felisberto

In the documentation[1] for the Stream result type we have a:

param name=contentDispositionfilename=contacts.xls/param

This was causing the problem. A simple change to:

param name=contentDispositionattachment;filename=contacts.xls/param

solved the issue.

Hope this may help someone out there

Gustavo
[1] http://struts.apache.org/2.0.11.1/docs/stream-result.html
Gustavo Felisberto escreveu:

Hello ALL,

I'm generating an Excel file in runtime and sending it to the 
client.I'm using struts 2.0.11.

In struts.xml I have:

action name=ExportExcelFile class=my.Class
 result name=success type=stream
   param name=contentTypeapplication/vnd.ms-excel/param
   param name=inputNameexcelInputStream/param
   param name=contentDispositionfilename=contacts.xls/param
   param name=bufferSize4096/param
 /result
/action

In the class I have:
public InputStream getExcelInputStream() {
   return new ByteArrayInputStream(exportExcelFile().toByteArray());
   }
private ByteArrayOutputStream exportExcelFile() {
   ByteArrayOutputStream bos = new ByteArrayOutputStream();
   try {
   WritableWorkbook workbook = Workbook.createWorkbook(bos);
   WritableSheet sheet = workbook.createSheet(Contactos, 0);
   WritableCellFormat textFormat = new 
WritableCellFormat(NumberFormats.TEXT);


//ADD STUFF TO SHEET

   workbook.write();
   workbook.close();
   } catch (RowsExceededException e) {
   } catch (WriteException e) {
   } catch (IOException e) {
   }
   return bos;
   }

If I use IE7 and I choose to save the file to disk and then open it 
with Excel 2007 all works ok. If I choose to open the file instead of 
saving it I get:
1 - an error in Tomcat:  ERROR [http-8080-Processor21] 
(CommonsLogger.java:24) - Can not find a java.io.InputStream with the 
name [excelInputStream] in the invocation stack. Check the param 
name=inputName tag specified for this action.


2- A message from excel saying that the file I'm trying to open 
ExportExcelFile (and not the real name of the file) is in a diferent 
format than the extension. If i choose to open it the file is ok


3- IE7 hard locks until I say yes/no in excel to open the file

I'm accessing tomcat via HTTP

Any help will be much appreciated.




--
Gustavo Felisberto.
WIT-Software, Lda
Coimbra (Portugal), San Jose (California)
Phone: +351239801030
Web: http://www.wit-software.com 





signature.asc
Description: OpenPGP digital signature


Using closable div in tabbedpanel

2008-04-10 Thread Gustavo Felisberto
I'm running struts 2.0.11.1 and trying to use some AJAX things with the 
provided dojo.


s:tabbedpanel id=contacts_list_container
   s:url id=cListUrl action=SimpleListContacts/
   s:div id=contacts_list href=%{cListUrl} theme=ajax 
listenTopics=show_contacts formId=msg_form/

/s:tabbedpanel

This is working, but if I add a closable=true to the s:div / this 
will crash as there is not such thing.

How can I make this work?

This mail serves this purpose and another that is more of a complain on 
the lack and confusion of user documentation on struts2. For example:

why does:
http://struts.apache.org/2.0.11.1/docs/ajax-and-javascript-recipes.html
Contains: This documentation refers to version *2.1* which has not been 
released yet.


--
Gustavo Felisberto.
WIT-Software, Lda
Coimbra (Portugal), San Jose (California)
Phone: +351239801030
Web: http://www.wit-software.com 





signature.asc
Description: OpenPGP digital signature