Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Request attribute problem

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I think you're confusing HttpServletRequest "attributes" with HttpServletRequest "parameters". I think you want
. Hope this helps.
-Jim
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic