Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Mike Cobelmach

Greenhorn
+ Follow
since Jun 17, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Cobelmach

Thank you very much Rene.
11 years ago
Thank you for reply. I have just one question - is possible to have one project with name first (=> first.war) and get directory ROOT after "unpacking"? I followed your post, but if I make directories webapps/first and webapps/public/second I don't know how to get some like this webapps/first/ROOT and webapps/second/ROOT. My projects are unpacking from war to directory only if I place them directly into webapps directory. Not in deeper directory structure.

I think of one solution - unpack war archive somewhere in temp directory and than copy it into correct structure (before Tomcat server starting process). Or do you know about more elegant solution?


Thank you.

MC
11 years ago
Hi guys, I have some problems with running two application on different domain in root context. I'm using Tomcat 5.5 on Debian Linux. See example:

I have two domains first.example.com and second.example.com. Web applications have name first and second. The goal is make these application available through addresses first.example.com and second.example.com. I don't want first.example.com/first and second.example.com/second. It isn't user friendly. My configuration in conf/server.xml:



Next, in conf/Catalina/first/first.xml:


(conf/Catalina/second/second.xml is similar).


When I make directory webapps/ROOT, it works correctly only for one of my applications. It seems stupid when your context depends on name of web application directory. There must be elegant solution for "more root context" (more ROOT directories on same Tomcat server).

Thanks for help!

MC
11 years ago
I have testStreets.jsp:



If I use this code with s:file tag, I get following values in autocompleter: {message, type, number} because of class StreetUrl.java (which generate Map<String, Integer> streets for autocompleter) is not called.

Then I get s:file tag out of testStreets.jsp and values for "street autocompleter" are generated correctly.
11 years ago
Hi friends, I have problem with using tags s:file and sx:autocompleter together in one form. Without s:file tag are sx:autocompleters in same form working correctly. I can post some code here, but I think that it is general problem.

My version of Struts is 2.1.8.1.

Thank's for help.
11 years ago
Hi, migrate from Struts 2.0.14 to 2.1.8.1 and have now problem with autocompleters in my project. See next example:

json.States:



json.CityCodes



struts.xml





and autocompleter.jsp



In action class I have method input, because I want preset value. In complex case, I want do it dynamicly but just this simple example doesn't work.

If I go to url /actionClass_input.action I have preseleced value in state autocompleter which is "Czech republic", but doesnt have key (in this case stateKey = 4). If you look into json.CityCodes.java, you may see setter for stateKey property. But in log I see warning:



But I don't send stateKey with String value, but with Integer. In next autocompleter (with city codes) I have not values for state "Czech republic" (see json.CityCodes and method getCityCodes()) - because stateKey is not set!

Next - on page in autocompleter.jsp I have debug prints - value[...] and key[...]. They print correct values if I get on url /actionClass_input:

value[state]: Czech republic
key[state]: 4


This autocompleter start work properly if I select value manually. But this is not user friendly.

In my previous version (Struts 2.0.14) it works correctly. I use for json "struts2-json-plugin" library with version 2.1.8.1 and "dojo-plugin" with same version.


Thank for your help!
12 years ago
You must have appropriate getter for list arlUserInfo. For access this in JSP use attributes list, listkey and listvalue of select tag.

12 years ago
I am using 2.0.14 version of Struts.
12 years ago
Thank you Dave for your response, but this didn't solve my problem.

This is description of my problem:

I have one class named BaseClass, which has method validate(). Next have another one class named SubClass, which extends BaseClass. There have method validate, too, which overrides inherited method validate from BaseClass:



In class SubClass have two methods - accept and decline. I want apply validation only on method accept. Therefore I made method



I hoped, if I good understand to set variable alwaysInvokeValidate to false, that method validate will be called only if I will not have method validate{MyMethodName}()...

But I set alwaysInvokeValidate to false and validate method is still called when I call method decline.

I use anotation @SkipValidation on method decline, too.
12 years ago
I need to set alwaysInvokeValidate to false globally because I don't want write this to all action separatly.

<interceptor-ref name="workflow">
<param name="alwaysInvokeValidate">false</param>
</interceptor-ref>



In other words - I need set up Struts 2 default configuration to another value.

Thanks.
12 years ago
Don't use any text fomating in property file. It's only for translation, format translated text in your jsp.
12 years ago
Its easy, you can found it on Struts pages.

In package.properties you would have



And your code would look like this



Btw on linked page is misstake in last example - formated value is in single quotes.
12 years ago
For example i have variable numberOfRecords, which indicate number of result on page. I want transfer this variable across more pages.
My first question is In which actions must be getter and setter for these variable? and second How must look struts.xml in basic, working configuration?

I leave the example on Struts pages, but don't understand these formulation

The scope interceptor can be used to pass arbitrary objects from one action ActionA to another other ActionB, provided you have a getter in ActionA and and a similar setter in actionB.



It's not logical - there is written that "pass objects from ActionA ... in ActionA must be getter". I think that must be setter in ActionA because I want here set the value and get it in ActionB - where I would expect getter method.

I am interested in how does it works, description of the principle will be sufficient.
12 years ago
I've problem with understanding Flash Scope principle in web application using Struts 2. Can anyone give me short working example of this? I have read book writen by Ian Roughley but there are only three pages about this and in new book writen by Dave Newton is nothing about Flash Scope problem.

Many Thanks, Michal.
12 years ago