Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Orton K Randy

Ranch Hand
+ Follow
since Aug 12, 2011
Orton K likes ...
Eclipse IDE Firefox Browser Tomcat Server
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Orton K Randy

I have a couple of web apps deployed on the same server. There's a jsp in app1 that I want to access from app2. I enabled cross context access in the tomcat and tried this jstl tag:

The myJSP.jsp uses some struts2 tags itself.

I also made sure the required libraries are on both the app1 and app2's lib directory. During the runtime though, the app2's page won't render and I see this error:

Caused by: java.lang.ClassCastException:
com.opensymphony.xwork2.ognl.OgnlValueStack cannot be cast to
com.opensymphony.xwork2.util.ValueStack at
org.apache.struts2.views.jsp.TagUtils.getStack( at

Any idea why? If I copied the jsp to the app2 and referenced it using the same c:import tag, it works just fine!
5 years ago
Thanks. That was exactly what I was looking for.
True, maven only seems to recognize plugins that belong to maven/codehaus groupIds. So I've had to add my plugin group specification to the settings xml. Not that I'm ok with doing so, but I don't have a choice right now. Cheers for the info, mate.
5 years ago
I've created a MOJO for a specific application need. I've followed maven's guidelines in naming the plugin so that I didn't have to mention the full

for executing my plugin(I've named it to match the format ${prefix}-maven-plugin). I've even included the 'goalPrefix' property in the plugin POM's configuration section. Here's a sniff of what I did to my plugin's POM:

But I'm still unable to execute my plugin just using mvn ${prefix}:goal since it complains it can't find the plugin in any repository. I've still had to use mvn groupId:artifactId:version:goal Any idea why?
5 years ago
What Vijay said. Why even set the form in scope as an attribute and try to retrieve again in an action when you have the form object readily available with you as a parameter of the execute method? I don't just quite get the need for setting and retrieving the form instance as attributes.
6 years ago
The title says it all, I tried to access my webapp through ip, something like :

It says:

works just fine.
Obviously, it has something to configure in tomcat conf files, unfortunately I'm not that good at them. Just so you know, I could ping to the IP(without port no. perhaps) in question successfully, firewall has been disabled. Any help would be appreciated in this regard.
6 years ago

Samuel Lugo wrote:
I had thought of something like this before, but I didn't think "i" would be incremented in a JSTL loop (I'm fairly new to JSTL). I thought I would have to have it in a JavaScript loop. I suppose using a JSTL tag like <c:set var="i" value="${0}" /> and then incrementing it with <c:set var="i" value="${i + 1}" /> could also work. I haven't tried it though.

Sorry for bringing this up, but can anyone confirm if the bold content above would work? I tried that inside a nested:iterate and am getting

error. Any idea why?
6 years ago
If the arraylist exits in any of the formbeans, <jsp:getProperty> should do. Or if you're retrieving from elsewhere in action class, try setting the data in request(or any appropriate scope) and use JSTL(like here). Since yours is an Object, request(or any appropriate) scoped attributes should be fine.
6 years ago

Mike Simmons wrote:

Orton K Randy wrote:If the left is heavier than the right, the conclusion is that the culprit is in the set we placed in the left tray(assuming we're looking for 1 ball that's heavier than the rest).

That particular conclusion only makes sense if we know, in advance, that the ball we're looking for is heavier than the rest. You're making an assumption not present in the problem statement - one I've pointed out previously in this thread.

I DID notice that only after I posted. The rest of your post makes perfect sense as to why it's log with a base of 3 and not 2. My bad, I choose no. of balls per weighing in a not so wise manner. Cheers for the clarification.
Mind using AJAX? Here's a comprehensive solution that you can relate your question to. Here's a bit more insight into the same. Or even this could be of some help.

Not into AJAX? The following code snippet in your servlet is supposed to let you know if the download has completed.

Supposedly, the file download will be completed as soon as the while loop is exited.
Hope that helps.
6 years ago
Watch out for the case of the method names especially the getters in your form. They're NOT in camelCase! And your ActionForm pacjage declaration should have been:

Also post the entire error stacktrace if you get an error again.
6 years ago
Is your form-bean declaration still commented in struts-config?

6 years ago
I'll make it clear, you don't run the Action class yourself, rather you perform the action that would invoke the action class. So, you should have run it as:


or if you intend to use a JSP(index.jsp in your case) to perform the InitAction, here's how you do it.


In your struts-config.xml(after </form-beans>),
6 years ago
Could easily go wrong. You can try that with 8 balls. The outcomes left/right tray being heavier have no particular significance. It's all about
* one tray being heavier than the other,
* or both being equally heavy.

See my point? You could place a set of balls in the left tray and the rest in the right. If the left is heavier than the right, the conclusion is that the culprit is in the set we placed in the left tray(assuming we're looking for 1 ball that's heavier than the rest). If you placed that particular set in the right tray instead of left, you still zero in on the ball the very same way. So there are only 2 significant outcomes although there are 3 possible outcomes.