unit testing with junit + spring + struts2, NullPointerException with HttpServletRequest

2011-05-13 Thread Jake Vang
hi, i am using struts v2.1.8.1 + spring 3.0 + junit 4.0. it should be noted that i am using convention plugin for spring. my action class extends ActionSupport and implements ServletRequestAware and ServletResponseAware. the method i am testing inside my action class never returns a string

Re: unit testing with junit + spring + struts2, NullPointerException with HttpServletRequest

2011-05-13 Thread Jake Vang
(response); String result = action.dummyAction(); Assert.assertNull(result); //should always be null String json = response.getContentAsString(); Assert.assertNotNull(json); //shouldn't be null On Fri, May 13, 2011 at 2:58 PM, Jake Vang vangj...@googlemail.com wrote: hi, i am using struts v2.1.8.1

Re: streaming plain text, json, xml back to the user, IllegalStateException

2011-04-27 Thread Jake Vang
Pawel, you know of anything like this but for the convention plugin? I don't use XML anymore. In fact, I've gotten away a lot with almost a purely annotation based approach. In fact, my struts.xml is 4-5 lines only. 2011/4/26 Paweł Wielgus poulw...@gmail.com: Hi Jake, maybe this aproach would

Re: streaming plain text, json, xml back to the user, IllegalStateException

2011-04-24 Thread Jake Vang
...@gmail.com wrote: My first guess would be to return null so you're not rendering a jsp after the output stream is closed. Dave  On Apr 22, 2011 11:49 PM, Jake Vang vangj...@googlemail.com wrote: what i did to get rid of this message was to add the following line before i do anything

streaming plain text, json, xml back to the user, IllegalStateException

2011-04-22 Thread Jake Vang
i am using struts 2 with the convention plugin. i have a bunch of actions that streams back plain text, json or xml. however, when a user goes to a certain URL, i keep seeing an IllegalStateException : Cannot create a session after the response has been committed. why is this happening? my

Re: streaming plain text, json, xml back to the user, IllegalStateException

2011-04-22 Thread Jake Vang
. if anyone has a better suggestion, please let me know. On Fri, Apr 22, 2011 at 11:22 PM, Jake Vang vangj...@googlemail.com wrote: i am using struts 2 with the convention plugin. i have a bunch of actions that streams back plain text, json or xml. however, when a user goes to a certain URL, i keep

Re: streaming plain text, json, xml back to the user, IllegalStateException

2011-04-22 Thread Jake Vang
you so much. On Sat, Apr 23, 2011 at 12:11 AM, Dave Newton davelnew...@gmail.com wrote: My first guess would be to return null so you're not rendering a jsp after the output stream is closed. Dave  On Apr 22, 2011 11:49 PM, Jake Vang vangj...@googlemail.com wrote: what i did to get rid

how to access spring beans from inside a custom validator

2010-11-01 Thread Jake Vang
i have a custom field validator that extends FieldValidatorSupport. inside this class, i need to access some beans as defined in applicationContext.xml by Spring. how do i access the spring managed beans? any help is appreciated.

Re: how to access spring beans from inside a custom validator

2010-11-01 Thread Jake Vang
org.springframework.web.context.ContextLoaderListener defined in web.xml. Thanks, On Mon, Nov 1, 2010 at 4:17 AM, Eduard Neuwirt eduard.neuw...@googlemail.com wrote: Hello Jake, It is simple. Use struts/spring plug in. Declare your bean within your validator and let spring inject your validator. That's all Regards Eduard P.S.: Do

Re: Struts2 validation

2010-07-13 Thread jake
You can use the fieldexpression validator. See http://struts.apache.org/2.1.8.1/docs/fieldexpression-validator.html for details. On Tue, Jul 13, 2010 at 05:39:52AM -0700, kisja wrote: I have two textfield and I would like to validate that at least one of both have data. How I can do?

Re: validating integer, java.lang.NoSuchMethodException

2010-07-12 Thread Jake Vang
bean. oh well, you win some, you lose some. if anyone has a better idea, please let me know. thanks. On Mon, Jul 12, 2010 at 11:26 AM, Jake Vang vangj...@googlemail.com wrote: hi, i am trying to validate an integer field (int primitive type) on a POJO (i.e. MyPojo.integer). i have the validation

validating integer, java.lang.NoSuchMethodException

2010-07-12 Thread Jake Vang
hi, i am trying to validate an integer field (int primitive type) on a POJO (i.e. MyPojo.integer). i have the validation defined in ActionClass-alias-validation.xml as follows. ... field name=myPojo.integer field-validator type=required messageInteger is required!/message /field-validator

Re: validation and form display problem

2010-07-11 Thread Jake Vang
beans inside the Prepare method in your action. That when 'input' is needed, your backing beans will be loaded. On 7/10/10, Jake Vang vangj...@googlemail.com wrote: i have a form that i display. but to display that form, i have to fetch some data from the database and then place that data

validation and form display problem

2010-07-10 Thread Jake Vang
i have a form that i display. but to display that form, i have to fetch some data from the database and then place that data on the valuestack (via backing beans). when the form is displayed, it expects that those backing beans should be populated. the form then posts to a save action. i have a

convention plugin requires setting @Result explicitly

2010-06-29 Thread Jake Vang
i have an Action class in the package com.company.web.struts.actions.admin.LoginAction. inside LoginAction, i use Annotation to specify the Action (i.e. @Action(value=/login) on a method. according to the documentation at, http://struts.apache.org/2.1.8.1/docs/convention-plugin.html, this should

Re: convention plugin requires setting @Result explicitly

2010-06-29 Thread Jake Vang
29, 2010 at 7:28 AM, Jake Vang vangj...@googlemail.com wrote: i have an Action class in the package com.company.web.struts.actions.admin.LoginAction. inside LoginAction, i use Annotation to specify the Action (i.e. @Action(value=/login) on a method. according to the documentation at, http

fieldexpression validator not working

2010-06-28 Thread Jake Vang
i have a User class with two fields, password and confirmPassword. on a web form, upon post, i am trying to see if they match using the fieldexpression validator. however, no matter what i try, i keep getting the message that they don't match. in the Tomcat console, i can see this message: Got

Re: fieldexpression validator not working

2010-06-28 Thread Jake Vang
never mind, i removed # from the OGNL expression and i get the correct behavior now. On Tue, Jun 29, 2010 at 12:23 AM, Jake Vang vangj...@googlemail.com wrote: i have a User class with two fields, password and confirmPassword. on a web form, upon post, i am trying to see if they match using

Re: one-to-many persistence, ConstraintViolationException

2010-06-22 Thread Jake Vang
ken, thanks for responding. i got things to work, but i haven't figured out really why it's working (on a conceptual, philosophical level). here's what i did to the code above. 1. for the Company class, i removed the @ForeignKey annotation 2. for the Employee class, i removed the companyId

Re: i need more documentation on applicationContext.xml

2010-06-21 Thread Jake Vang
-0400, Jake Vang vangj...@googlemail.com wrote: hi, i've been reading and studying http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html. i want to know what is actually going on in applicationContext.xml. for example, what do these two lines do? please explain or refer me

Re: i need more documentation on applicationContext.xml

2010-06-21 Thread Jake Vang
: Mon, 21 Jun 2010 10:04:57 -0400 From: stur...@mit.edu On Mon, 21 Jun 2010 00:56:19 -0400, Jake Vang vangj...@googlemail.com wrote: hi, i've been reading and studying http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html. i want to know what is actually going

Re: unit test the service layer (aka data access layer)

2010-06-21 Thread Jake Vang
MyServiceImplTest extends AbstractJUnit4SpringContextTests {   �...@autowired(required = true)    private MyService myService = null; testConfigXML.xml will contain your *test* config.. Then do the do! -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 21 June 2010 05:54

Re: unit test the service layer (aka data access layer)

2010-06-21 Thread Jake Vang
AbstractTransactionalJUnit4SpringContextTests for your unit test and the like Cheers James -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 21 June 2010 17:27 To: Struts Users Mailing List Subject: Re: unit test the service layer (aka data access layer) james

one-to-many persistence, ConstraintViolationException

2010-06-21 Thread Jake Vang
i am following the example at http://struts.apache.org/2.1.8.1/docs/struts-2-spring-2-jpa-ajax.html. in this example, a very simple persistence is given (of which i am thankful). but, what i am trying to do is slightly more complicated with persistence. i need to persist a one-to-many

unit test the service layer (aka data access layer)

2010-06-20 Thread Jake Vang
hi, i've been following this code here at http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html. what i want to know is how to unit test the service layer (or data access object layer). in the case of the link, it would be the PersonServiceImpl class.

i need more documentation on applicationContext.xml

2010-06-20 Thread Jake Vang
hi, i've been reading and studying http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html. i want to know what is actually going on in applicationContext.xml. for example, what do these two lines do? please explain or refer me to better documentation. bean id=transactionManager

spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
i am using struts 2.1.8.1 and the convention plugin. i am also using spring for dependency injections (DI). my question is if it is possible to to use struts2 + convention plugin with spring for DI on my Action classes? i have searched the internet but only seen examples using struts 1 + spring

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
service etc etc But I have started doing: public class MyAction extends ActionSupport { @Autowired private MyInjectedService service I am not sure if that alters the way Struts2/Spring does it. But it does make it a bit clearer to read. -Original Message- From: Jake Vang

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
does it. But it does make it a bit clearer to read. -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 10:23 To: user@struts.apache.org Subject: spring, struts2, convention plugin, how to wire an action class i am using struts 2.1.8.1

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 11:09 To: Struts Users Mailing List Subject: Re: spring, struts2, convention plugin, how to wire an action class well, there's something strange about struts2 (with convention plugin) + spring. if your action has a field

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
). On Thu, May 13, 2010 at 6:20 AM, James Cook james.c...@wecomm.com wrote: Yeah sorry, short on time here, didn't see your question at the bottom. Add the spring jar from the spring project. -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 11:16

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
yes. precisely. On Thu, May 13, 2010 at 6:41 AM, James Cook james.c...@wecomm.com wrote: Oh, did you want your action as a spring managed bean? Ah I think i massively miss read you. You want to inject predefined values etc? -Original Message- From: Jake Vang [mailto:vangj

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
If you want Spring to create your action class (as opposed to Struts creating them) then you need to define your action in the applicationContext.xml file. how do you do that? here's a couple of ways i have tried that do NOT work. 1. (normal, naive way that works for defining services) bean

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
the @Resource anno as well. Can't think off the top of my head. -Original Message- From: Jake Vang [mailto:vangj...@googlemail.com] Sent: 13 May 2010 11:44 To: Struts Users Mailing List Subject: Re: spring, struts2, convention plugin, how to wire an action class yes. precisely

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
be most pleased. thanks. On Thu, May 13, 2010 at 8:24 AM, Denis Cabasson denis.cabas...@gmail.com wrote: Jake, the short answer to your problem is : use the struts-spring plugin ( http://struts.apache.org/2.1.8.1/docs/spring-plugin.html ). Include the jar for that plugin in your classpath, and Struts

Re: spring, struts2, convention plugin, how to wire an action class

2010-05-13 Thread Jake Vang
into the Action class. The third and fourth lines confirm that the String and boolean values are injected into the service class. thanks. On Thu, May 13, 2010 at 9:32 AM, RogerV roger.var...@googlemail.com wrote: Jake Vang wrote: If you want Spring to create your action class (as opposed to Struts

Struts release 2.1.9

2010-05-10 Thread jake
Hi, When will there be a GA release of 2.1.9 or above? Cheers, Jake - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org

Re: how to customize the rendering of a tabbedpanel? struts2, dojo plugin

2010-02-05 Thread Jake Vang
to do programming (Java or JavaScript) right on the page. On Thu, Feb 4, 2010 at 6:10 PM, Stephen Ince stephenpi...@gmail.com wrote: Jake,  The sx: tags are based on the .4 dojo tags. I would just use the dojo tags themselves. The dojo plugin is also being depricated. The new dojo tags are at 1.4

Re: how to customize the rendering of a tabbedpanel? struts2, dojo plugin

2010-02-05 Thread Jake Vang
Ince stephenpi...@gmail.com wrote: Jake,  I actually ran into a lot problems accessing dojo from other servers. They all went away when I installed it locally. I think you get some sandbox security issues with some of the packages. cheers, Steve On Fri, Feb 5, 2010 at 8:44 AM, Jake Vang

how to customize the rendering of a tabbedpanel? struts2, dojo plugin

2010-02-04 Thread Jake Vang
i'm using the sx:tabbedpanel/ in the struts2-dojo-plugin. i have a few questions on controlling the display/rendering of this component. 1. can i make the sx:tabbedpanel/ expand 100% in height? i've tried several things: a) place the sx:tabbedpanel/ inside a table and set the height of the table

Re: struts 2 and servlets, how to exclude servlet url patterns from struts filter

2010-02-01 Thread Jake Vang
On Sun, Jan 31, 2010 at 9:12 AM, Jake Vang vangj...@googlemail.com wrote: i am using servlets (HttpServlet) and struts 2. my mapping in web.xml for the struts filter maps to the url pattern, /*. my servlet maps to something like this, /test. however, when i try to access my servlet, http

struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Jake Vang
i was wondering if it was possible to write a custom tag that is able to access objects in the ActionContext using OGNL? i'm not sure if this is a correct question. my problem is that i have a form. the form is posted to an action. the action has getters/setters for the form fields. i then

Re: interceptor is not being called for all action

2010-02-01 Thread Jake Vang
several times and do not see the connection.  I'm not sure I understand exactly what you did solved the problem, but it is clerarer than the documention --- On Sat, 1/30/10, Jake Vang vangj...@googlemail.com wrote: From: Jake Vang vangj...@googlemail.com Subject: Re: interceptor

Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Jake Vang
i found something helpful here. it works. http://struts.apache.org/2.1.8.1/docs/access-to-valuestack-from-jsps.html On Mon, Feb 1, 2010 at 7:34 AM, Jake Vang vangj...@googlemail.com wrote: i was wondering if it was possible to write a custom tag that is able to access objects

Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Jake Vang
bill, thanks for including the code (especially the import statements so i will know where these objects/classes are coming from). On Mon, Feb 1, 2010 at 11:09 AM, Bill Bohnenberger bill98...@gmail.com wrote: Hi Jake, I have a custom table tag that needs Value Stack access, too. Here's how I

struts 2 and servlets, how to exclude servlet url patterns from struts filter

2010-01-31 Thread Jake Vang
i am using servlets (HttpServlet) and struts 2. my mapping in web.xml for the struts filter maps to the url pattern, /*. my servlet maps to something like this, /test. however, when i try to access my servlet, http://localhost:8080/myapp/test, i get the following message: There is no Action

interceptor is not being called for all action

2010-01-30 Thread Jake Vang
i have written an interceptor implementation, however, it seems i cannot get it to work. i have followed the instructions at http://struts.apache.org/2.x/docs/interceptors.html. i have also followed the instructions at

Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
what does that have to do with my problem? please enlighten. On Sat, Jan 30, 2010 at 4:37 PM, Dave Newton newton.d...@yahoo.com wrote: http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-XWorkpackages - Original Message From: Jake Vang vangj

Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
, Dave Newton newton.d...@yahoo.com wrote: http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-XWorkpackages - Original Message From: Jake Vang vangj...@googlemail.com To: user@struts.apache.org Sent: Sat, January 30, 2010 4:10:31 PM Subject: interceptor

Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
this is such a pain (but then again, i'm not a developer on the struts2 project, so there may be a lot of complexities to get this working elegantly that i'm unaware of). On Sat, Jan 30, 2010 at 4:10 PM, Jake Vang vangj...@googlemail.com wrote: i have written an interceptor implementation, however, it seems i

Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
, you can remove the @ParentPackage and @InterceptorRef from the classes and methods. wow, it was that easy. On Sat, Jan 30, 2010 at 6:14 PM, Jake Vang vangj...@googlemail.com wrote: okay, after fiddling around for 2 hours, with the weak documentation out there, i think i have it figured out

Re: Redirect Action and wildcard methods

2009-10-18 Thread jake
Thanks for the reply, it does work as it should, but I made a silly mistake :( Nothing like wasting a day! Jake On Sat, Oct 17, 2009 at 04:23:05PM -0700, Tommy Pham wrote: From: j...@researchtogether.com j...@researchtogether.com To: user

Redirect Action and wildcard methods

2009-10-17 Thread jake
- is the .! part of the problem here? and also param name=actionNamedisplayCategory/param does the same as the more complete action detailed above. Can anyone provide any insight as to why it isn't working as I expect? Cheers, Jake aka _LisWork

RE: Struts 2 and SSL

2007-12-19 Thread Jake Robb
Have a look at the implementation of the plugin's interceptor: http://struts2-ssl-plugin.googlecode.com/svn/trunk/plugin/src/main/java/ com/googlecode/sslplugin/interceptors/SSLInterceptor.java Just change it so that it looks at something else instead of the annotation. -Jake -Original

RE: s:checkbox preselect

2007-12-12 Thread Jake Robb
What about using s:checkboxlist with a single-item list? -Jake -Original Message- From: bhaarat Sharma [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 12, 2007 4:36 PM To: Struts Users Mailing List Subject: Re: s:checkbox preselect tried it and doesnt work :( this is a real

[S2] Restricting paths?

2007-11-06 Thread Jake Robb
to the action to only the path(s) I want? Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: [S2] Restricting paths?

2007-11-06 Thread Jake Robb
setting of your package? - Gary Jake Robb wrote: I have an action called MainMenu. It's defined as follows: action name=MainMenu class=mainMenuAction result name=success type=tilesmainMenu/result /action (I'm using the Spring plugin - mainMenuAction

[S2] Display Tag? (2.0.11)

2007-11-01 Thread Jake Robb
in 2.0.11. So, how do I accomplish this? I guess I could keep it the old way, but I'd really rather be consistent. -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: property from S2 in S1

2007-10-12 Thread Jake Robb
I think you're looking for bean:write. -Jake -Original Message- From: Pavel Sapozhnikov [mailto:[EMAIL PROTECTED] Sent: Friday, October 12, 2007 1:25 PM To: Struts Users Mailing List Subject: s:property from S2 in S1 Hi I have a question. So in S2 you have s:property which just takes

[S2] s:if test attribute not a runtime expression?

2007-10-10 Thread Jake Robb
is complete in JIRA, what else has to happen before that version becomes GA? Thanks, Jake Robb - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: [S2] s:if test attribute not a runtime expression?

2007-10-10 Thread Jake Robb
On 10/10/07, Jake Robb [EMAIL PROTECTED] wrote: Okay, this might be a question for the dev list, but bear with me for a minute. My application is currently using Struts 2.0.8. I read about some security and bug fixes in 2.0.9 and 2.0.10. According to the Struts JIRA server, 2.0.10 has been

RE: [S2] s:if test attribute not a runtime expression?

2007-10-10 Thread Jake Robb
didn't test it, I'm just guessing) -W On 10/10/07, Jake Robb [EMAIL PROTECTED] wrote: Pardon me for being totally new to OGNL, but what would be the equivalent of ${not empty rules}? -Original Message- From: Wes Wannemacher [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 10, 2007

[S2] Indexed properties

2007-10-10 Thread Jake Robb
that be? It already works to *populate* a form; I just can't submit back to the action and have it fill in my object. Am I the only one that thinks that the current S2 way is a huge pain? -Jake Robb - To unsubscribe, e-mail

List properties in Struts 2

2007-10-09 Thread Jake Robb
in that message. I'm thinking this is a typical greenie mistake, and I'm hoping someone here can set me straight. Thanks, Jake Robb