• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic link in JSP

 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hii everyone...I have stuck from last 2 days with this problem.
I am creating one application in JSP.In that application , i am selecting only one "Source" using listbox. And multiple "Targets" using checkboxes.
All source and targets names are directly taking from databases.

So, after selecting One source and multiple Targets, i have to generate one table using Three columns i.e. souce name, Target name and Link. and that link should be only specific to ONLY that SOUCE-TARGET pair only. all links should refer to third jsp page which contains some checkboxes, so from that checkboxes , i have to choose some checkboxes n save it in collection.

So, for every link, we can select diff. checkbox and should store in dynamically generated collction.

So, I have stuck with this LINK ...How to generate this dynamic link n all?


I have tried from 2 days much on it. But i am not getting it.
Please, help me.
Thank you in advance.
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in for loop you can add link <a></a>


 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply.

but in <a></> tag..,
If i give particular page,for each page , it is giving that page only.
I have already tried it.
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok so you want to give diffent links for each row,
how many diffrent pages you have can you put them in condition
sone thing like this
 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, depending upon selected target, that link should work out.
If I give click on some link related to one particular target, i should give me That third page(content on third pages are same for all), but on that third page , it contains some checkboxes .So when i select some checkboxes, n save it in another collection.

So like same, when i click on some other link related to other target, it should give that third page(only page containts and not that collection n checked checkboxes.....so for each target, third page collction is different)

So, there may be hundreds of dynamic targets, n hundreds of dynamic links....like this...

So, please guide me.
Waiting for your reply.
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please,can you be specific and paste some code based on that we may help you
 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




I am facing problem in BOld area .....i.e . related to that link n all.
 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cing problem in below code....i think it so....

><a href="BusinessContext.jsp?value1=${target.name}.jsp" target="_new">
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
><a href="BusinessContext.jsp?value1=${target.name}.jsp" target="_new">


i am sorry i might be wrong but this is the first time seeing that some one passing the jsp page as web param..

normally we pass param and in the page we will get the request parameter value based on that we will implement login ..
may i know what are you doing by getting page name..
are you trying to forword it
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you try this way
get the target name and append .jsp to and then farword the request..
 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sorry , i am very new to jsp n java ...so i am doing all these kind of mistakes.
I can get target name...but how to append jsp page n all?


Thank you for your help
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help,
But if i do this, then i have create that x.jsp page .

but, in my application there may be 1000's of target pages. so, .....how it could be?

 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have different options here are your options
1) you can dynamically add the target name which you are getting from DB to anchor href tag
2)as discussed erlier get the target name as webparam,append it and use response.sendredirect to the page
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried this
<a href="${target.name}.jsp" target="_new">

but, suppose my target is "x" , when i click on that link...it goes to x.jsp
But i haven't created the x.jsp

like d same , suppose my target is "y" , when i click on that link...it goes to x.jsp
But i haven't created the y.jsp

in this case, i have to make all jsp pages as number of target list. and it is not feasible.


 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry ...for last post

I have tried this
<a href="${target.name}.jsp" target="_new">

but, suppose my target is "x" , when i click on that link...it goes to x.jsp
But i haven't created the x.jsp

like d same , suppose my target is "y" , when i click on that link...it goes to y.jsp
But i haven't created the y.jsp

in this case, i have to make all jsp pages as number of target list. and it is not feasible.
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cerate a jsp page
and link them to the page you have created
and use this


get the request ... depending on the request param..
writed the logic in that page

this is how you have to do...
if you dont want to create all the 100 pages then create one page which by comparing the request param will generate resonse..
 
rahulj rjagtap
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But please tell me that....how to get request from that link. I know how to take reponce from listbox or checkbox...but dont know in this case.Thaen how to comapre these responce and send it?


I am new to jsp..so facing lots of problems..Please help
 
santosh dhulipala
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

for here its your logic what should be the reponse page and based on your conditions

please let me know if i am discussing out of box..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!