This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Spark in Action and have Jean-Georges Perrin on-line!
See this thread for details.
Win a copy of Spark in Action this week in the Open Source Projects 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts Select Tag

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My action class setting an arrayobject in session.
ArrayList products = null;
try{
ProductProcessor pp = new ProductProcessor();
ProductBean pb = pp.getAllProductsByProductGroup();
products = pb.getProductNames();
}catch(PersistenceException pe){
;
}
session.setAttribute("products", products);
I want to populate the list in a dropdown using <html:select> tag.
Any one have simple example?.
When I placed this select tag it forced me to put under form tag then it forced me to specify action. If I specify an action which does not have a formBean then I am getting exception.If I give an action which have dummy formBean associated with it then I am getting exception like getter method not defined for that bean.Why it is expecting a formBean when I am just trying to populate it?.
Apreacite your reply's.
Thanks
 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK.I just did some changes to my code after reading couple of threds. I have created a form bean with getters and setters and commented this line in my code. //session.setAttribute("products", products);
I am still geting No getter method available exception.
//startForm:
public ArrayList getProducts() {
return products;
}
public void setProducts(ArrayList products) {
this.products = products;
}
//StartAction:

HttpSession session = request.getSession();
ProductProcessor pp = new ProductProcessor();
int debugLevel = servlet.getDebug();
ArrayList products = null;
StartForm startForm = (StartForm)form;

try{
ProductBean pb = pp.getAllProductsByProductGroup();
products = pb.getProductNames();
startForm.setProducts(products);
}catch(PersistenceException pe){
;
}
 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//My JSP looks like this.
<html:form action="/LogonSubmit" >
<html:select property="products">
</html:select>
</html:form>
//struts-config.xml
<form-beans>
<form-bean name="startForm" type="app.StartForm"/>
</form-beans>
<action-mappings>

<action path="/Start" type="app.StartAction" name="startForm" scope="session">
<forward name="start" path="/pages/Start.jsp"/>
</action>
</action-mappings>
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
your JSP calls an Action with the path "/LogonSubmit" - in your config-File your ActionPath says "/Start". I guess these two paths should match together, so try to change your JSP to "/Start" instead of "LogonSubmit".
 
sudhakar Tadepalli
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I resolved this problem.
Thanks.
 
get schwifty. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic