• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to pass parameter from dispatchto javascript

 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a servlet, I use dispatch and forward to go to another jsp, which contains some javascript code.
I want to pass a parameter in the dispatch and to be used by javascript.

I tried to set the parameter in the url, like blah.jsp?param=value, the forwarded jsp page url ends with blah.jsp, string after '?' is lost. Why would it be like this?

Then I tried to set parameter in the request. the forwarded jsp's javascript still cannot get the parameter value, since I'm not using java to get parameter. I need use javascript.

Can someone help me on this? What's the correct way to set it so that the target jsp page's javascript can access the parameter values.

Thanks.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Servlet:

In Jsp:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic