Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic