• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Dynamically generated link needs to be associated with different form and submitted

 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The issue I am facing must have a solution but somehow i am not able to figureout.
Infact I have done it before but this time its getting too difficult.


I have got a search page wichh is associated with say FormA and ActionA.
clicking on submit it fetches data from database and using iterator i am putting it on the page.
one of the field in iterator needs to be a link which will be submitted to ActionB.
this link need to be associated with another for say FormB. because the data ActionB is to fetch belongs to FormB and should go to the success page of ActionB.

I tried surrounding iterator with a form. and putting a hidden variable with Name=FormB, which says FormB not is scope "request"
I tried using <jsp:setProperty with Name=FormB which throws null pointer Exception
I also tried putting name=FormB in ><html:link> itself n that as well says FormB not in scope Request because it considers "FormA only to be the active form.

it would be really great if someone can lett me know where am I going wrong or how should i handle this.

Thank you.
 
Devaka Cooray
Marshal
Posts: 5168
485
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you may get more helpful responses if you could PostRealCode of your JSPs
 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there..
putting the code here..

<html:form action="/searchAction" method="post">
:
:
some code
:
:
<logic:iterate name="SearchForm" id="salesDetailsForm" property="salesDetailsForms">

<tr>
<td id="squalRef">

<html:link action="/openRequest">
<html:hidden name="salesDetailsForm" property="squalRef" />
<bean:write name="salesDetailsForm" property="squalRef" />
</html:link>

<bean:write name="salesDetailsForm" property="squalRef" /></td>
<td><bean:write name="salesDetailsForm" property="customerId" /></td>
<td><bean:write name="salesDetailsForm" property="custName" /></td>
<td><bean:write name="salesDetailsForm" property="pstn" /></td>
<td><bean:write name="salesDetailsForm" property="fnn" /></td>
<td>

<a href="mailto:<bean:write name="salesDetailsForm" property='salesEmail' />">
<bean:write name="salesDetailsForm" property='salesEmail' />

</td>
<td><bean:write name="salesDetailsForm" property="squalStatus" /></td>
</tr>

</logic:iterate>

:
:
</form>

The bold part is what i am getting stuck at..
i need to go to another page which is suppose to display all the details from salesDetailsForm for that particulat "squalRef".
is there a way to submit with this "salesDetailsForm " as an input for the next page without changing the scope of entire for to Session.??
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put an ID in the link? No form necessary.
 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how will an ID help to pass a form???
also i removed the hidden tag.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It won't help pass a form--but with the limited information given, it's a bit difficult to know what exactly you want.

It *sounded* like you wanted a master/detail relationship: the ID would allow you to retrieve the information from the DB and display it. I don't even know why you *have* a form to display this, since I don't see any form fields--from what you posted (next time please UseCodeTags, by the way) it's just a list--not a form.
 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys(specially David),
Sorry to trouble you with my incomplete code.(Issue is resolved now)

Basically flow of my page was..
user does search on the page, depending on the search criteria the result is displayed,
I was displaying this result using Logic:iterat and the object of this Arraylist also was made up of a bean object. (which was Form for another jsp).

and in the result one of the column was to be displayed as a link and clicking on it should trigger another action which would fetch all the data related to that "SqualRef"

and i did not want to save anything as session variable explicitly.

Finally I changed the Action class to DispatchAction and before submitting the form set the attribut of the same form to the correct "squalRef" and fetched the result and sent it to the success page of this action.


Thanks a lot David for trying to help me out with the limited info present in the post...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!