This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Request attribute problem

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am trying to pass a paramter form a jsp file to an action.
In the jsp I specify the parameter as following.

<html:link action="/viewPerson" paramId="pId" paramName="person" paramProperty="id">Link Text</html:link>

The action is specified in the struts-config file as follows.
<action path="/viewPerson" type="a.b.c.PersonAction"
scope="request" input="input.page">
<forward name="success" path="/anotherPage.do"/>
</action>

In the execute method of the actions a.b.c.PersonAction action class is the following.

String personId = (String)request.getAttribute("pId");

The problem is that the jobId here is null.
Also when i hover over the link text i can see that the paramter is set in explorer i.e. http://localhost:8080/viewPerson.do?pId=34

Does anyone know what i am doing wrong?

Thanks a lot for the help in advance.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're confusing HttpServletRequest "attributes" with HttpServletRequest "parameters". I think you want
. Hope this helps.
-Jim
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic