• Post Reply Bookmark Topic Watch Topic
  • New Topic

passing dynamic parameter using action  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

please help me with this. newbie with struts.

I have two JSP pages. JSP1 iterates thru a loop to display a list. something like

begin loop
<html:link action='myAction'><%vo.getName();%></html:link>
end loop

struts-config looks something like

<action
path="/myAction"
forward="/jsp2.jsp"/>

my dilemma is how do I pass parameter from JSP1 to JSP2? JSP2 behaves differently depending on the name that is clicked on but that is dynamic .. do i need to set something up like action="myaction.do?name=" ?? how is that achieved in the JSP and XML pages?

thanks in advance.

-V
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This how I pass a value to one JSP to another JSP.

First JSP file I use the following syntax.

<jsp:include page="down.jsp" flush="true">

<jsp aram name="username" value="jsmith" />

</jsp:include>

In this case, I use a username as alience, and passing value is jsmith.

In the next JSP page,I use the following syntax,which take the passing value.

<%= request.getParameter("username") %>

In this code take the passing value.

Which It display the jsmith value in the interface.

That is all ,I know regarding this issue.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are only passing along one additional parameter, this is pretty easy to do using the paramId, paramName and paramProperty attributes of the html:link end. For example, this following will generate a link like "/DisplayEquipment.do?id=1" (where the id comes from calling equipment.getEquipmentId())



- Brent
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!