• 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 use Bean:define

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am trying to build a search page for movie webite.. I am able to show the movie names when I search as links.
My requirment is when I clicked on the movie name I should be able to view the movie details. For which I used bean efine tag.

<logic:iterate id="result" name="searchform" property="arl">
<bean efine id="paramId" name="result" property="movie_id" />

<%params.put("passId",pageContext.findAttribute("paramId"));
pageContext.setAttribute("params",params);%>

<html:link action="/DisplayMovieDetails" name="params">
<bean:write name="result" property="movie_name" /></html:link>
</logic:iterate>

arl is my arraylist.
searchform is my formbean.
When I say Object requestId = request.getParameter("passId");
I am not getting the value:
my struts config is
<action path="/DisplayMovieDetails" type="magfa.actions.DisplayMovieDetailsAction" name="moviedetailsform" scope="request" input="/SearchResults.jsp">
<forward name="success" path="/MovieDetails.jsp">
</forward>

Please tell me the error in this. If possible help me doing this in anyother form.
Thanks
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you just passing one parameter? Looks like it is named "passId". If you just need to pass this one parameter on the url then you should be able to use this code:


- Brent
 
Muni Jampana
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Brent it is working..
But I have a doubt.

When do we use bean efine? In which scenario?
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a link to the docs for the bean efine tag (the 1.1 version of the docs):
http://struts.apache.org/1.1/userGuide/struts-bean.html#define

The bean efine tag is a way of defining a variable that can then be used in some scriplet code.

- Brent
 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic