• 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 2 tags with Struts Tiles

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to create a jsp page with the help of struts. Various tile's contents are specified in different jsp pages and the main body tile has some <s:form> tags which is from struts 2 tags library. But when i try to view the page in browser, i am not seeing any form. On looking the generated html file, i can see that tags <s:form> are just included into the new page instead of being transformed.. am i missing something?

what should I do to get this working?

Thanks a ton!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Gopi Chand
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

Thanks for moving the post.

That problem is fixed, that is because i have set the Filter dispatcher servlet only for .action url pattern. I fixed it..

Now i have a problem with radio buttons...

i am using
<s:form action="registerUser.action" onsubmit="return ValidateForm();">
<s:textfield name="username" id="username" label="Username" />
<s:textfield name="email" id="email" label="Email" />
<s:password name="pass1" id="pass1" label="Password" />
<s:password name="pass2" id="pass2" label="Re-Enter Password" />
<s:radio name="sex" list="%{genders}"></s:radio>
<s:submit></s:submit>
</s:form>

and the register user action bean has getGenders method which returns map..

but on execution, i am getting The requested list key '%{genders}' could not be resolved as a collection/array/map/enumeration/iterator type..
I am not sure why am getting this..

Please help me out!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please start new threads for unrelated problems.

The action you're *posting* to has a "genders" getter: does the one that's displaying the form?
 
Gopi Chand
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,

Thanks for your reply..

Am not sure If I understood your questions..
register.jsp page has the <s:form> tag and this form on submit will execute registerUser.action which is mapped to RegisterUserAction..

RegisterUserAction has the getGenders() method.. not sure what do you mean by "one that's displaying the form"..

Forgive my ignorance.. could you please explain what do you mean by that? I am not sure how an action displays a form?

thanks for your patience!
 
Gopi Chand
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, After thinking for a while, I figured out what you mean

The register.jsp page is not directed by execute of any action, if so, the aciton which sent me to register.jsp should have the required setter methods, but that's not the case for me..

register.jsp page is directly accessed by the user by clicking a link to register.jsp page... so now action is involved here

If that's the case, what do I do?

Do I make sense??
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general applications shouldn't mix direct JSP and action pages--all pages should (usually) be accessed through actions.

Your form page should be accessed through an action, and the action would expose the "genders" list with a getter method.

You could also use an immediate list for the genders.
 
Their achilles heel is the noogie! Give them noogies tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic