• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts question

 
Chris Spierings
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been asked to pick up after someone who has moved on in a project and he has done somethings a bit differently than I might have with Struts. On the JSP he is using a link to call a loadaction which is just fine however the value of the row selected in a list box isn't making it into the form and as a consequence we're getting a null pointer down the road a bit.
When I use a button on the jsp that I've done the updating of the form for the page happens automatically for me. I'd sure appreciate some pointers on how to proceed. I don't have the luxury of changing the jsp to use a button. At least not without a huge fight with the client.
Thanks
Chris spierings@mailbag.com
 
Michael Zalewski
Ranch Hand
Posts: 168
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Spierings:
On the JSP he is using a link to call a loadaction ...
Chris spierings@mailbag.com

Do you mean he has coded the loadaction inside an anchor tag? Like <A HREF=...>? If so, then you might want to consider two possible alternatives.
1) Rplace the <A ...> element with an <INPUT TYPE="IMAGE"...> or <INPUT TYPE="SUBMIT"...>
or
2) Use JavaScript onclick() to make the form submit when the <A ...> element is clicked.
 
smercmu
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not an expert at struts yet, but hopefully this might help you track things down... Was the previous developer using an ActionForm or just the action? Sounds like there might be a problem in how the ActionForm object is being used. Is the drop down box using the struts-html tag library? If so, make sure it references the ActionForm.
 
Chris Spierings
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions. I'm going to see if I can work with the usability folks to get something other than a link in place. Someone higher up the food chain has decided that javascript is a no/no so I'm not sure I've got much of an alternative.
Thanks again
Chris
 
Junilu Lacar
Bartender
Pie
Posts: 6547
21
Java Linux Mac Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have no luck with the usability people and must use a link, and if using JavaScript is out, then the only choice I think you have would be to include the value in the link as a parameter via a JSP expression, like so:
<a href="/myaction.do?theparam=<%= some expression %>">click here</a>
 
Ted Husted
Author
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically, there isn't a great deal of difference between a form button and link. The Struts html:link tag does accept dynamic parameters, either a single property or in a map. I can't be more specific without knowing more about the page you're working on.
HTH, Ted.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic