• 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

Struts Question.

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
Need a small help and a real quick one, since i just began to get my hands on struts still am not very comfortable with the framework.
Coming to my problem. I want to know how do i get a Form class on my jsp page.
Explaining it in detail :

I have a page A, on submitting page A i am supposed to go to page B.
I have written a code like
request.getSession().setAttribute("B_FORM",b_form);
in the A_Action class.
When my control comes to page B, i need to use the b_form thing on my page directly.
It works if i use :
<html:text name="B_FORM" property="xyz" size="3" maxlength="3" style="ime-mode isabled;"/>
in B.jsp(xyz being a field on my page).
However the value is not populated in the textfield if i use
<html:text property="xyz" size="3" maxlength="3" style="ime-mode isabled;"/>

I actually want to use the second case as my control might return back to the same page and at that time i do not want session values.
What do i do to get this working ?
I need the solution real quick mates.

Thanks...
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make use of <form-bean>...</form-bean> configuration in struts-config.xml

u got to write a bean class representing the html form. And configure it in struts-config.xml as follows

<action path="<action path>"
type="<Action class>"
name="<form name>"
scope="request"
input="<input jsp >"
validate="false">
</action>

<form-bean name="<form name>" type="<form bean class>"/>
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic