Help coderanch get a
new server
by contributing to the fundraiser

C Trager

+ Follow
since Aug 04, 2010
Merit badge: grant badges
For More
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 C Trager

I found a solution:

9 years ago
Hello all, I'm having an issue with the jquery DatePicker function. I'm using the Struts2-JQuery plugin (v3.7.0) and jqGrid. In my grid I need to convert one of the filter fields (my grid has a row at the top with input fields to filter the results) into a DatePicker. I tried to run the following but it locks up the table:

I can use the struts2-jquery datepicker tag outside the table, but if I try to run .datepicker() on any field it locks up the page (there's no error displayed) and if I run that function on the field in the table it locks up the grid and gets stuck on the loading notification.

If I use the Struts2-JQuery plugin am not allowed to use the .datepicker()? Are the two mutually exclusive, and if so what other functionality and I losing by using the Struts2-JQuery plugin?

Any help with this is greatly appreciated.
9 years ago
Without more information regarding your overall design this question is difficult to answer. However, Oracle has a very good example of a shopping cart application that you might find helpful.
9 years ago
I have a situation where I have an html help file that is located external to my application. The location and name of this file is held in a database. I want to use the s:include tag to include the html file in a jsp where the associated action reads the table, pulls the help file and location and assigns it to a property, then use the property in the s:include tag.

Works Correctly: The action sets helpFileLink = "c:/AIPP/ApplicationProperties/SccfOperationsHelp.html"
Works Correctly: The JSP sets linkValue = helpFileLink

When I run the code above it throws an exception because s:include adds a relative path to the link: SRVE0190E: File not found: /pages/c:/AIPP/ApplicationProperties/SccfOperationsHelp.html

How do I reference a file outside the application? Or, how do I remove the relative part of the path that is automatically added by the include tag?

Any help is greatly appreciated.
9 years ago
I've got a plain piece of code that calls a stored procedure. The call is made fine, and when rows are returned the first row returned is in the callable statement object and every subsequent row is returned in the ResultSet object. When the SP returns only one row that row is in the Callable Statement object. Is this normal behavior and am I supposed to write the code to check for that first row in the Callable Statement then loop through the result set? It seems that will require a ton of redundant code just for a single row when it can be returned in the result set. Am I doing something wrong?

Here's the parms I have set in my stored procedure.

Hey all, I'm working on a web app based on Struts2, however I think this question should be in the Servlet forum. I have a login page where I validate the user against LDAP through a separate utility. When I validate the user I also pull a list of all the groups that user is in according to LDAP. Now, in my application I have a role defined, and when I deploy I map an Active Directory group to that role. What I'm trying to accomplish is to find the groups that role is mapped to within my application. I'm not concerned with the user being in any of those roles, I'll do that in my separate utility, I just need to pull that role-group mapping that I define when I deploy the application. Is there a way to pull the role-group mappings defined for an application?
13 years ago

Richard Golebiowski wrote:see generics

It works! I'm now able to see the beanList array filled in with my new msgId immediately when I enter the action. I'm assuming when it is made generic then it keeps whatever struts does in the background from putting anything other than my specific bean type into that array. I'll have to dig into generics more as I'm not that familiar with them.

Thanks a ton for the help guys, now I can stop banging my head against my desk and move on to how to use a checkbox in my beanList.

13 years ago

I do make the List generic, then I take my beans and add them to the list.
13 years ago

David Newton wrote:Can't you just make it generic?

Make the bean generic?
13 years ago

Richard Golebiowski wrote:Can you check that it's hitting the setter when you return.

I toggled a breakpoint on the beanList getter/setter, then I went into the getter/setter for msgId in the bean itself and toggled a breakpoint. I don't see where it's hitting the setter for the msgId on the return. However, I'm also see this error for each bean in the list:

[8/4/10 14:31:49:648 CDT] 0000003d ParametersInt E com.opensymphony.xwork2.interceptor.ParametersInterceptor setParameters ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'beanList[10].msgId' on 'class foo: Error setting expression 'beanList[10].msgId' with value '[Ljava.lang.String;@54e054e0'

@David - No, I haven't created a type conversion (I'm researching that in my Struts2 In Action book right now.)
13 years ago

Richard Golebiowski wrote:I think it should be:

That brought me a step closer (though I used status.index as I was already using that to number each line.) So, each field is populating correctly on the JSP for each row. When I return the beanList is initialized to the number of rows on the screen so we know that's it's recognizing that there should be something there; unfortunately there's nothing in the beanList (i.e. I show an array of 36 null values.) Making a change in the msgId textbox doesn't do anything either.

@David - Thanks for the link. It looks like the code from Richard is the same as this item from that link:

"For lists and maps, use index notation, such as people[0].name or friends['patrick'].name. Often these HTML form elements are being rendered inside a loop. For JSP Tags, use the iterator tag's status attribute. For FreeMarker Tags, use the special property ${foo_index}[]. "
13 years ago

David Newton wrote:(1) preface the input element name with the name of the list,

Are you refering to something like this? When I tried this it no longer recognized that property when loading the JSP.

David Newton wrote: (2) same, but use indexed (array) notation to preserve order... as far as I know that still needs to be done manually (the old S1 indexed property tags added it for you). If you look at the rendered HTML you'll see why.

I'm still trying to translate this into something that I can understand looking through the rest of the forums. To bad there aren't any examples that can easily be Googled. :(

13 years ago
I'm new to Struts2 (worked on some Struts1 about 6 years ago) and I'm creating a new app from scratch. I'm running some stored procedures and building a beanList (of varying count) which I'm displaying through a JSP with each bean in the ArrayList displaying on the screen properly. However, when I click a submit button on the page I am wanting to get that beanList back and iterate through the beanList returned from the JSP (one of the bean properties is displayed in a textbox which the user can change the contents of) comparing with one I save in the session to see if there are any changes. Unfortunately the beanList in my action is null on returning from the JSP. If I remember correctly Struts1 handled passing that information back without me having to write code. Am I missing something simple here?

Here's the action (tried to make it more readable by just putting in comments for large chunks of code, the first line in the execute is what I'm trying to figure out).

Here's the JSP code. I removed some to make it easier to read. It does display the rows correctly, and I am able to edit each msgId text field for each row.

Sorry for the noob question, but I must be missing something very simple here as it seems I should be able to get an array of beans (or properties) back from the JSP. If not how and I supposed to get a list of items back from the JSP?
13 years ago