my dog learned polymorphism*
The moose likes Other Open Source Projects and the fly likes Displaying a link using display tag. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Displaying a link using display tag." Watch "Displaying a link using display tag." New topic
Author

Displaying a link using display tag.

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi folks,
Im using the display tag to perform pagination , and have been successfully able to implement it , however im not being able to figure out how to call a method by passing a parameter using a hyper link.
My earlier implementation was

I modified it to

However , when I now run the app , the objid is NOT being passed, and neither is the required function being called , why so ?
Any ideas?


Learning and Learning!-- Java all the way!
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

you are doing two things here, setting a link in 'href' and telling it to go to a function. Do one thing at a time. Either go to the jsp or go to the function and submit the page.

and what do you see in the url after Main.jsp? when you use only the 'href' ?


Time is what we want the most, but what we use the worst. -- William Penn
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477


Thanks for replying ,Robin.
When I use only href (the first implementation). I see that upon clicking the link I get a popup that contains the value of the parameter 'objid' in this case and then a corresponding method is called from the supporting class which uses the value of 'objid' as a parameter .However this is not happening in the second case .. Hope I'm being clear.
Thanks.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

thats because they are supposed to do different things. the 'onclick' event goes to a js function and the href goes to that url. So, did you find out what you want to do ?
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Um , okay .Please pardon my ignorance . Im a newbie to programming and this is my first with display tag. Earlier with the href i was intending to assign a link that whose onclick a hidden value in my form is set .I use this value that i recover using a servlet for further processing. Is this not possible using display tag??.
Thank you for taking the time out to reply.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

the displayColumn 'href' attribute should do the usual stuff what an anchor tag 'href' attribute can do.. so try using the anchor tag first and then try the displayColumn and in both the case see the html source.
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Robin John wrote:the displayColumn 'href' attribute should do the usual stuff what an anchor tag 'href' attribute can do.. so try using the anchor tag first and then try the displayColumn and in both the case see the html source.

Are you suggesting something like this?

EDIT :tried this and doesnt work , onclick is not recognized as a valid attribute for display:column . Any hinters on how I could implement it to suit my needs?
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

You can also create a link manually rather than using displaytag which will probably suit your needs:
I haven't tested this, but this is similar to code I was using in my last project.
Hope it helps.

Sean


I love this place!
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi Sean ,
Thank you for replying.It works now .
Im pasting the final snippet below for future reference .
.
Thanks a lot.
 
Consider Paul's rocket mass heater.
 
subject: Displaying a link using display tag.
 
Similar Threads
Dynamic table not displaying.
Pagination using display tag and JSTL.Display problem
Retaining drop down values on page submit
Display tag-Pagination result not working properly.
Jstl not reflecting values back to servlet