• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts / JSTL - Create ActionLink Dynamically

 
Dane Frazier
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's what I am trying to do...
I have my view elements working (pulling data and displaying).

I have created an "add record" and it works well.

I want to create a link to edit the data.

I have the service object that does so, but if I do this...

in view.jsp...


This prints my collection of hrefs and the related data, however when I choose an href and it goes to the action it loads the form without hitting my querystring attribute...


What do I need to different? Do I need an EditAction class? either way, I need to get at the querystring and I am not seeing it here...

Any ideas are appreciated.
 
Dane Frazier
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stinking emoticons. ARG!
 
Junilu Lacar
Bartender
Pie
Posts: 7749
61
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dane, you can turn off the emoticons by checking the "Disable smilies in this post" option found below the Instant Graemlins palette.

As for your problem, the Struts way to do it would be to make sure that your AdminLevelForm has an adminLevelID attribute and corresponding getter/setter. This would shield you from having to access the request directly to get the query parameters. Your code as it is now is not giving you the results you expected because you should use request.getParameter() rather than request.getAttribute() to get to the values in the query string.
 
John Smith
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another tip, it's good practice to use the <html:rewrite ..> tag if you plan on using a link in that way. This way your application is more portable and the link's href is always valid eg.

 
Junilu Lacar
Bartender
Pie
Posts: 7749
61
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[/qb]<hr></blockquote>

Or you could use the JSTL c:url tag


[ October 21, 2004: Message edited by: Junilu Lacar ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic