This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Stripes not getting value from form field

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am at a loss. I am trying to do a simple ajax post to an action bean using jquery. I have followed Freddie's book example using partial forms because I have to insert a select tag inside an existing form. I couldn't get that to work so I looked at several online examples. I had another developer look at my code who has Ajax experience and he said it looked fine. But it's not fine.

In my eclipse debugger, I can see in context.request.parameterMap that my data is there in the correct object:

contractTerms.executionMonth=[G2006]

But when I look at the object on the action bean I see this:

BdQBDxuw1FmzhjnwVnB14JwdSNs= this value changes every time I run it.

What is that? Obviously my query fails as there is no such value in my database. I suspect I am missing some simple fundamental element, but I can't see it. Doesn't stripes read the values from the parameterMap? If not, where does it read from? Is JQuery doing this to my object? How do I correct it?

my Ajax looks like this:

function findStrikePrices(field) {
var form = field.form;
var params = $(form).serialize() + '&_eventName=' + 'findStrikePrices';
$.post(form.action, params,
function(data) {
$('#priceList' ).html(data);
}
);
return false;
}


The select tag in my jsp looks like this:

<s:select name="contractTerms.executionMonth" id="executionMonth">
<s:option selected="true" value="">
<fmt:message key="monthList.selectAMonth"/>...
</s:option>
<c:forEach items="${actionBean.executionMonths}" var="month">
<s:option value="${month}">${month}</s:option>
</c:forEach>
</s:select>


The variable on my action bean is defined like this:

private ContractTerms contractTerms = new ContractTerms();

executionMonths is defined in ContractTerms:

private String executionMonth;

I have spent a lot of time debugging, rewriting, and running with both JQuery and Prototype and I just don't understand why this is failing. Any help would be greatly appreciated. I will be happy to send additional code if needed. I am not having fun at this point. I thought Stripes was going to make Java fun again? ;-)
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!