Author Login
Post Reply
user Digest 20 Dec 2009 07:35:57 -0000 Issue 8965
Topics (messages 204340 through 204356):
Feasibility of Programming in GWT
204340 by: Saeed Iqbal
204353 by: Alex Siman
JBoss 5.1.0 GA, Struts 2.0 and EJB 3.0 : SecurityClientFactory
204341 by: Fernandes Celinio
Re: JavaScript / AJAX + Struts 2?
204342 by: Jim Collings
204344 by: Brian Thompson
Re: Test fails when building XWork
204343 by: Gabriel Belingueres
204351 by: Lukasz Lenart
204352 by: Gabriel Belingueres
204354 by: Lukasz Lenart
204355 by: Gabriel Belingueres
Problem with value attribute in select tag
204345 by: Philipp Leusmann
204346 by: Gabriel Belingueres
204347 by: Philipp Leusmann
204348 by: Brian Thompson
204349 by: Bill Bohnenberger
204350 by: Philipp Leusmann
Struts2 drop down box
204356 by: Vineith Kaul
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_204340.ezm (zipped)I know we are talking about another framework but I can get honest replies
here compared to the GWT user group.
I have been reading about GWT being a single page programming where
refreshes are not appropriate and reading more like here
http://www.onthoo.com/blog/programming/2008/02/why-i-dumped-gwt.html
Is GWT good to also program in? I know Struts 2 is the king
--
Saeed Iqbal
Independant Consultant
J2EE - Application Architect / Developer

Attachment:
user_204353.ezm (zipped)
I have programmed in GWT in past.
The advantage over Struts 2 is GWT's component model. It allows to reuse
code and leverage your favorite safe refactoring tools (say Eclipse). JSP
sucks on refactoring.
The main GWT disadvantage is Java-to-JavaScript compilation. It has no
incremental compilation. As project gets bigger - the compilation gets more
time. After compilation you have no access to GWT's JavaScript. If you want
to make little changes for running application and to see immediate changes
- then you need to recompile a GWT module.
Sometimes, just to compose some simple widget with couple of divs, I have
finished up running GWT app in Firefox with Firebug plugin. With GWT I often
reinvented the wheels. Let's take validation. Such as GWT is mostly client
side thing (JS) you cannot relay on JS validation. Definitely you should
perform validation on server. Then you need to populate all validation
messages to corresponding widgets (inputs). GWT does not have buit in
valadation. And you cannot simply add validation messages to widgets. So you
probably need to wrap standard widgets. And so on...
But there are many GWT libraries. And maybe all my problems can be covered.
And with a new version of GWT 2.0, it got many improvements like:
- development mode;
- code splitting;
- declarative UI with UiBinder.
You can read about new stuff here:
http://googlewebtoolkit.blogspot.com/2009/12/introducing-google-web-toolkit-20-now.html
So I do not know... There is no silver bullet. And for now I am using Struts
2.
P.S. If you have thought about a new web framework, then you definitely
should checkout Lift (in Scala).
http://liftweb.net/ It also has demo page: http://demo.liftweb.net/
Lift features:
- you can use all your Java code (Spring, JPA, ...);
- Scala's syntax sugar e.g. multiple inheritance - helpful thing in big
apps;;
- built-in XML support (by Scala) - really cool thing, you can reuse it in
method calls;
- it is a component framework like GWT, again - refactoring, reusing...;
- you are not bind to one action per request, but you can have as many
"actions" per request as you want due to component nature of Lift;
- and much more.
Saeed Iqbal-2 wrote:
>
> I know we are talking about another framework but I can get honest replies
> here compared to the GWT user group.
>
> I have been reading about GWT being a single page programming where
> refreshes are not appropriate and reading more like here
> http://www.onthoo.com/blog/programming/2008/02/why-i-dumped-gwt.html
>
> Is GWT good to also program in? I know Struts 2 is the king
>
> --
> Saeed Iqbal
> Independant Consultant
> J2EE - Application Architect / Developer
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_204341.ezm (zipped)Hi,
I have developped a stateful session bean where access to methods are
restricted :
@SecurityDomain("myDomainBlabla")
@RolesAllowed({"xxx", "yyy"})
@Stateful
public class BlablaBean implements BlablaRemote {
@RolesAllowed({"xxx"})
public void doSomething(User user) {
...
}
...
}
Authentication and authorization worls well from a JUnit test case.
Inside my JUnit class, I perform a connection :
SecurityClient securityClient =
SecurityClientFactory.getSecurityClient();
securityClient.setSimple("user1", "pwd1");
securityClient.login();
No problem. The user with role xxx gets access to the method
doSomething(User user)
according to the files myApp-users.properties and myApp-roles.properties
I am now trying to authenticate the user in a Struts 2 action
(LoginAction) and propagate the role, using the same code :
SecurityClient securityClient =
SecurityClientFactory.getSecurityClient();
securityClient.setSimple("user1", "pwd1");
securityClient.login();
It does not work, i get an error when i try to access the method
doSomething(User user) :
11:22:44,456 ERROR [STDERR]
javax.ejb.EJBAccessException: Invalid User
What is wrong ? I am guessing i need to propagate the role to the entire
app, how do i do that ?
Thanks for helping

Attachment:
user_204342.ezm (zipped)Here is the answer that I was provided & used:
1. You can use the ${somethingFromTheValueStack} notation like so:
onclick="onjavaScriptMethod('${value}');"
I tried this but missed the ' marks because it's been so long since I
did any JavaScript. I haven't tried this trick in an actual embedded
script or script file. Just jsp's. Would be nice if it worked. Does
anyone know if it does?
2. If you map the action to a jsp fragment, it can be placed in a div like so:
//First you need to get the request & handle some platform crap.
var request = false;
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = false;
}
}
}
if (!request)
alert("Error initializing XMLHttpRequest!");
//***************************************************************
//Functions.
//***************************************************************
//Execute the action
function checkSomething(string) {
var url = string + "/context/DoSomething.action";
request.open("GET", url, true);
request.onreadystatechange = updatePage();
request.send(null);
}
//Update the page.
//Put the results in the div & display.
//Note there are two div tags. One is for results and the other for
processing messages like "Loading...".
function updatePage() {
var d = document.getElementById("divResults");
d.innerHTML = 'Loading...';
var d1 = document.getElementById("divProcessing");
d1.style.display="block";
if (request.readyState == 4)
d.innerHTML = request.responseText ;
d1.style.display="none";
}
On Thu, Dec 17, 2009 at 5:11 AM, Jim Collings <jlistnews@(protected):
> So I have two actions and one jsp. The idea is that one is for the
> entire page and another is for putting into a <div> via a JavaScript
> method.
>
> Question: How do I get items off of the value stack for use in JavaScript?
>
>
> Jim C.
>

Attachment:
user_204344.ezm (zipped)On Fri, Dec 18, 2009 at 6:37 AM, Jim Collings <jlistnews@(protected):
> Here is the answer that I was provided & used:
>
> 1. You can use the ${somethingFromTheValueStack} notation like so:
>
> onclick="onjavaScriptMethod('${value}');"
>
> I tried this but missed the ' marks because it's been so long since I
> did any JavaScript. I haven't tried this trick in an actual embedded
> script or script file. Just jsp's. Would be nice if it worked. Does
> anyone know if it does?
>
>
It'll work fine in <script> tags embedded in your jsp, but it won't work in
external script files.
-Brian

Attachment:
user_204343.ezm (zipped)Hi,
Now I want to build XWork on another machine, this time with a direct
connection to the Internet (no proxy or firewall settings.)
-------------------------------------------------------------------------------
Test set: TestSuite
-------------------------------------------------------------------------------
Tests run: 648, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
29.688 sec <<< FAILURE!
testFailsOnMethodThatThrowsException(com.opensymphony.xwork2.ognl.OgnlValueStackTest)
Time elapsed: 0 sec <<< FAILURE!
junit.framework.AssertionFailedError: Failed to throw exception on EL
method exception
at
junit.framework.Assert.fail (
Assert.java:47)
at com.opensymphony.xwork2.ognl.OgnlValueStackTest.testFailsOnMethodThatThrowsException(OgnlValueStackTest.java:173)
I googled this test failed and it seems it was failing around the last
days of november. Must be some kind of configuration problem since I
have the last version available on trunk.
Again my configuration is: WinXP, Java 6, maven 2.2.1, command: mvn
clean install.
2009/12/17 Gabriel Belingueres <belingueres@(protected)>:
> Thanks Lukasz!
>
> Yes it was a connection problem. I had configured the proxy settings
> in the maven xml file, but for some reason it downloaded the artifacts
> but the test failed.
> I just executed the mvn passing along the proxy information as system
> properties and it worked ok (mvn -DhttpProxy=.... clean install)....
>
>
> 2009/12/17 Lukasz Lenart <lukasz.lenart@(protected)>:
>> 2009/12/17 Gabriel Belingueres <belingueres@(protected)>:
>>> What am I missing?
>>
>> Connection to the Internet - you're probably behind a firewall :P
>>
>>
>> Regards
>> --
>> Lukasz
>> http://www.lenart.org.pl/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>

Attachment:
user_204351.ezm (zipped)That's a bit strange, you can check with Bamboo that everything is ok
http://opensource.bamboo.atlassian.com/browse/XWORK
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_204352.ezm (zipped)I checked out it from https://svn.opensymphony.com/svn/xwork/trunk
I deleted everything and checkout'd it again and still the same test fail.
2009/12/18 Lukasz Lenart <lukasz.lenart@(protected)>:
> That's a bit strange, you can check with Bamboo that everything is ok
> http://opensource.bamboo.atlassian.com/browse/XWORK
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204354.ezm (zipped)2009/12/18 Gabriel Belingueres <belingueres@(protected)>:
> I checked out it from https://svn.opensymphony.com/svn/xwork/trunk
> I deleted everything and checkout'd it again and still the same test fail.
I did the same and found no problems ;-) Try to run maven with -U -up
My environment:
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_11
Java home: c:\Java\jdk1.6.0_11\jre
Default locale: pl_PL, platform encoding: UTF-8
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_204355.ezm (zipped)solved it.
I forgot that I have a JAVA_HOME env variable pointing to a Java5
version...changed it to Java 6 and worked OK. Funny that I didn't get
any compilation error...
Thanks!
2009/12/19 Lukasz Lenart <lukasz.lenart@(protected)>:
> 2009/12/18 Gabriel Belingueres <belingueres@(protected)>:
>> I checked out it from https://svn.opensymphony.com/svn/xwork/trunk
>> I deleted everything and checkout'd it again and still the same test fail.
>
> I did the same and found no problems ;-) Try to run maven with -U -up
>
> My environment:
> Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
> Java version: 1.6.0_11
> Java home: c:\Java\jdk1.6.0_11\jre
> Default locale: pl_PL, platform encoding: UTF-8
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204345.ezm (zipped)Hi,
what exactly does the value-attribute of the select tag require? Is it one element of the list provided to the list-argument? Or is it the value which eventually makes the value-attribute of the html-rendered select tag?
I have something like the following and I do not find a way to work as expected:
public class SelectAction extends ActionSupport
{
private List<TestObject> list = new ArrayList();
private TestObject object;
public String execute()
{
TestObject to1 = new TestObject(1, "foo");
list.add(to1);
TestObject to2 = new TestObject(2, "bar");
list.add(to2);
object = to2;
}
[getters for the stuff above]
}
public class TestObject
{
private Integer id;
private String str;
public TestObject(Integer id, String str)
{
this.id = id;
this.str = str;
}
[getters]
}
And in the template (using Freemarker) I tried:
<@(protected) />
<@(protected) />
<@(protected)}" />
<@(protected)} />
None of the above worked.
Could anybody please tell me what the correct value-argument would be?
Thanks very much,
Philipp

Attachment:
user_204346.ezm (zipped)I believe that the "value" attribute is not used in this tag.
2009/12/18 Philipp Leusmann <philipp.leusmann@(protected)>:
> Hi,
>
> what exactly does the value-attribute of the select tag require? Is it one element of the list provided to the list-argument? Or is it the value which eventually makes the value-attribute of the html-rendered select tag?
>
> I have something like the following and I do not find a way to work as expected:
>
> public class SelectAction extends ActionSupport
> {
> private List<TestObject> list = new ArrayList();
>
> private TestObject object;
>
> public String execute()
> {
> TestObject to1 = new TestObject(1, "foo");
> list.add(to1);
> TestObject to2 = new TestObject(2, "bar");
> list.add(to2);
> object = to2;
> }
>
> [getters for the stuff above]
>
> }
>
> public class TestObject
> {
> private Integer id;
>
> private String str;
>
> public TestObject(Integer id, String str)
> {
> this.id = id;
> this.str = str;
> }
>
> [getters]
> }
>
>
>
> And in the template (using Freemarker) I tried:
>
> <@(protected) />
>
> <@(protected) />
>
> <@(protected)}" />
>
> <@(protected)} />
>
> None of the above worked.
>
>
> Could anybody please tell me what the correct value-argument would be?
>
> Thanks very much,
>
> Philipp
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204347.ezm (zipped)The documentation says it is: <http://struts.apache.org/2.1.8.1/docs/select.html>
But the examples are not really helpful.
Philipp
Am 18.12.2009 um 16:43 schrieb Gabriel Belingueres:
> I believe that the "value" attribute is not used in this tag.
>
> 2009/12/18 Philipp Leusmann <philipp.leusmann@(protected)>:
>> Hi,
>>
>> what exactly does the value-attribute of the select tag require? Is it one element of the list provided to the list-argument? Or is it the value which eventually makes the value-attribute of the html-rendered select tag?
>>
>> I have something like the following and I do not find a way to work as expected:
>>
>> public class SelectAction extends ActionSupport
>> {
>> private List<TestObject> list = new ArrayList();
>>
>> private TestObject object;
>>
>> public String execute()
>> {
>> TestObject to1 = new TestObject(1, "foo");
>> list.add(to1);
>> TestObject to2 = new TestObject(2, "bar");
>> list.add(to2);
>> object = to2;
>> }
>>
>> [getters for the stuff above]
>>
>> }
>>
>> public class TestObject
>> {
>> private Integer id;
>>
>> private String str;
>>
>> public TestObject(Integer id, String str)
>> {
>> this.id = id;
>> this.str = str;
>> }
>>
>> [getters]
>> }
>>
>>
>>
>> And in the template (using Freemarker) I tried:
>>
>> <@(protected) />
>>
>> <@(protected) />
>>
>> <@(protected)}" />
>>
>> <@(protected)} />
>>
>> None of the above worked.
>>
>>
>> Could anybody please tell me what the correct value-argument would be?
>>
>> Thanks very much,
>>
>> Philipp
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_204348.ezm (zipped)I would try
<@(protected)="%{
object.id}" />
-Brian
On Fri, Dec 18, 2009 at 9:30 AM, Philipp Leusmann <
philipp.leusmann@(protected):
> Hi,
>
> what exactly does the value-attribute of the select tag require? Is it one
> element of the list provided to the list-argument? Or is it the value which
> eventually makes the value-attribute of the html-rendered select tag?
>
> I have something like the following and I do not find a way to work as
> expected:
>
> public class SelectAction extends ActionSupport
> {
> private List<TestObject> list = new ArrayList();
>
> private TestObject object;
>
> public String execute()
> {
> TestObject to1 = new TestObject(1, "foo");
> list.add(to1);
> TestObject to2 = new TestObject(2, "bar");
> list.add(to2);
> object = to2;
> }
>
> [getters for the stuff above]
>
> }
>
> public class TestObject
> {
> private Integer id;
>
> private String str;
>
> public TestObject(Integer id, String str)
> {
> this.id = id;
> this.str = str;
> }
>
> [getters]
> }
>
>
>
> And in the template (using Freemarker) I tried:
>
> <@(protected)"
> value=object />
>
> <@(protected)=
> object.id />
>
> <@(protected)"
> value="${object.id}" />
>
> <@(protected)"
> value=${object} />
>
> None of the above worked.
>
>
> Could anybody please tell me what the correct value-argument would be?
>
> Thanks very much,
>
> Philipp
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_204349.ezm (zipped)I do not use the value attribute in my s:select tags & they work fine.
I do always use the headerKey & headerValue attributes though.
Incidentally, the preselected (user-selected) key value is taken (stored)
using the name attribute so in your example your SelectAction should define
"bla" and provide setter & getter for same.
- Bill
On Fri, Dec 18, 2009 at 8:20 AM, Brian Thompson <elephantium@(protected):
> I would try
>
> <@(protected)="%{
> object.id}" />
>
> -Brian
>
>
>
> On Fri, Dec 18, 2009 at 9:30 AM, Philipp Leusmann <
> philipp.leusmann@(protected):
>
> > Hi,
> >
> > what exactly does the value-attribute of the select tag require? Is it
> one
> > element of the list provided to the list-argument? Or is it the value
> which
> > eventually makes the value-attribute of the html-rendered select tag?
> >
> > I have something like the following and I do not find a way to work as
> > expected:
> >
> > public class SelectAction extends ActionSupport
> > {
> > private List<TestObject> list = new ArrayList();
> >
> > private TestObject object;
> >
> > public String execute()
> > {
> > TestObject to1 = new TestObject(1, "foo");
> > list.add(to1);
> > TestObject to2 = new TestObject(2, "bar");
> > list.add(to2);
> > object = to2;
> > }
> >
> > [getters for the stuff above]
> >
> > }
> >
> > public class TestObject
> > {
> > private Integer id;
> >
> > private String str;
> >
> > public TestObject(Integer id, String str)
> > {
> > this.id = id;
> > this.str = str;
> > }
> >
> > [getters]
> > }
> >
> >
> >
> > And in the template (using Freemarker) I tried:
> >
> > <@(protected)"
> > value=object />
> >
> > <@(protected)"
> value=
> > object.id />
> >
> > <@(protected)"
> > value="${object.id}" />
> >
> > <@(protected)"
> > value=${object} />
> >
> > None of the above worked.
> >
> >
> > Could anybody please tell me what the correct value-argument would be?
> >
> > Thanks very much,
> >
> > Philipp
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>

Attachment:
user_204350.ezm (zipped)Thanks Bill, this works fine.
I am still wondering what the value-attribute is good for, then.
Philipp
Am 18.12.2009 um 17:48 schrieb Bill Bohnenberger:
> I do not use the value attribute in my s:select tags & they work fine.
>
> I do always use the headerKey & headerValue attributes though.
>
> Incidentally, the preselected (user-selected) key value is taken (stored)
> using the name attribute so in your example your SelectAction should define
> "bla" and provide setter & getter for same.
>
> - Bill
>
> On Fri, Dec 18, 2009 at 8:20 AM, Brian Thompson <elephantium@(protected):
>
>> I would try
>>
>> <@(protected)="%{
>> object.id}" />
>>
>> -Brian
>>
>>
>>
>> On Fri, Dec 18, 2009 at 9:30 AM, Philipp Leusmann <
>> philipp.leusmann@(protected):
>>
>>> Hi,
>>>
>>> what exactly does the value-attribute of the select tag require? Is it
>> one
>>> element of the list provided to the list-argument? Or is it the value
>> which
>>> eventually makes the value-attribute of the html-rendered select tag?
>>>
>>> I have something like the following and I do not find a way to work as
>>> expected:
>>>
>>> public class SelectAction extends ActionSupport
>>> {
>>> private List<TestObject> list = new ArrayList();
>>>
>>> private TestObject object;
>>>
>>> public String execute()
>>> {
>>> TestObject to1 = new TestObject(1, "foo");
>>> list.add(to1);
>>> TestObject to2 = new TestObject(2, "bar");
>>> list.add(to2);
>>> object = to2;
>>> }
>>>
>>> [getters for the stuff above]
>>>
>>> }
>>>
>>> public class TestObject
>>> {
>>> private Integer id;
>>>
>>> private String str;
>>>
>>> public TestObject(Integer id, String str)
>>> {
>>> this.id = id;
>>> this.str = str;
>>> }
>>>
>>> [getters]
>>> }
>>>
>>>
>>>
>>> And in the template (using Freemarker) I tried:
>>>
>>> <@(protected)"
>>> value=object />
>>>
>>> <@(protected)"
>> value=
>>> object.id />
>>>
>>> <@(protected)"
>>> value="${object.id}" />
>>>
>>> <@(protected)"
>>> value=${object} />
>>>
>>> None of the above worked.
>>>
>>>
>>> Could anybody please tell me what the correct value-argument would be?
>>>
>>> Thanks very much,
>>>
>>> Philipp
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>

Attachment:
user_204356.ezm (zipped)Does anyone know how to differentially color options in struts 2 drop
down.e.g I need one option to be in red other to be in blue etc.I
tried to look for it - looks like has smthng to do with cssSyle but
not sure how can we apply it for different options of the drop
down.FYI : I m populating the drop down using the list attribute from
the database.
Thanks
Vineith