• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying a link using display tag.

 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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' ?
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 281
Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 377
Android Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sean ,
Thank you for replying.It works now .
Im pasting the final snippet below for future reference .
.
Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic