Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the url append values in strut

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When i click on the link i am getting like this URL

http://localhost:8080/cyberq/jobapply!add.action?cyberQ1

i want to get cyberQ1 values from the above url.

Please help me how to do this.


Thanks





 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi pankaj,

you can get value of cyberQ1 with two ways.

1) make declaration of cyberQ1 in your action and make getter and setter for cyberQ1 variable. Then you can directly use this cyberQ1.

2 ) Second is you can access it using request object. Like request.getParameter("cyberQ1");



 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But cyberQ1 is not my fix url values it can changes when clicks on hyperlink

like



by click the above url the values changes ever time.
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi,

But if your parameter name cyberQ1 change every time then you have to change at make it same.

Because if you want to access some parameter value at least you have to name of this parameter.

other wise how would you access it. ???

so you have at least name of that.
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Let me explain my problem.

I am have jsp page which showing list of jobs.

for every jobs there is a link ApplyOnline.


When the user click on the link then this url values changer ever time.


joblist jsp page

















 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I think here your parameter cyberQ1 value change but your parameter name always same cyberQ1

so , you can follow my first Answer.

Value does not affect your code.

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nishan,

In first post you gave two answer which one is good.


Thanks
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,


I think both one is good.

But if you don't want to access request object then first one is good.

if you want to access request object you have to implements your action to ServletRequestAware and implement the methid of this interface and then you can aaccess you request object.

So i think first one is good for you.

At last choice is yours.

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nishan i got my solutions.
and i used first approach.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic