Bookmark Topic Watch Topic
  • New Topic

regarding reading value of anchor tag in servlet  RSS feed

 
gayatri umesh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have a grid of links in ma jsp..in the href attribute, i ve specified the navigation to a servlet...... in the servlet, i want to read the value of the link that i clicked in the jsp.....

for example, If my link appears to be
<a href="ProductController" target="right">A</a>
in the servlet, i want to read the value of the link i click(here 'A').

Kindly help how do i proceed with this??? can i use JSP custom tag link taglib??? if so, how should i do???Please guide me wit example code... please help!!
 
Jaydeep Mazumdar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
Change the below code to the following:

<a href="ProductController?selectedValue=A" target="right">A</a>

Then in the servlet use the code:

That should do the job!
 
gayatri umesh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
should i give it as

<a href="ProductController?selectedValue="A" target="right">A</a>

Then in the servlet, use request.getParameter("selectedValue");
 
Jaydeep Mazumdar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Report post to moderator
gayatri umesh wrote:should i give it as

<a href="ProductController?selectedValue="A" target="right">A</a>

Then in the servlet, use request.getParameter("selectedValue");


The double quotes for selectedValue="A" are not required. Let me know if it worked.
 
gayatri umesh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
I tried this way..... but it doesnt read the value of the link... i printed the value and saw.. nothin gets printed..... kindly temme wat can i do?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
gayatri umesh wrote:kindly temme wat can i do?


Step 1 is to use real words when posting.
 
gayatri umesh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
ok.. will follow from now..can you help me with a solution?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
gayatri umesh wrote:I tried this way

Step 2: explain "this way"

Making people work hard to try and help you is the best to make sure you get little help.
 
gayatri umesh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
I meant i tried Using request.getParameter() ins ervlet. But the selectedValue is not printed.
 
Max Rahder
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Report post to moderator
FYI: This is cross-posted in the Servlets forum, where I responded. Someone may want to merge the posts (or just delete the other one).
 
Paul Clapham
Sheriff
Posts: 22375
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Let's close this one. It actually doesn't contain any useful information for readers of the other post.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!