• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Templates in struts 2

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following JSP in my application.



When struts renders the JSP the Labels are displayed in one place and the input in another place. Please see attached screenshot for details.

I want the input fields to be displayed next to the labels.

I was discussing this with a collegue, and he says, I need to modify the templates for this to work. Is this true? Is there no other way than modifying the templates??? May be use CSS???

I want the input fields to be displayed next to the labels.

What would be the best approach???
1.PNG
[Thumbnail for 1.PNG]
 
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rajkumar Katudia wrote:
When struts renders the JSP the Labels are displayed in one place and the input in another place.



There's two options:
1. Use the "label" attribute of the form tag to declare the label. This will create table and row tags around the label-text field pairs
2. Use the "simple" template, which does not create any layout. That should work with your code above.
 
Rajkumar Katudia
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Joe Ess wrote:2. Use the "simple" template, which does not create any layout. That should work with your code above.



Yes, I opened struts core jar. How/Where do I specify that struts should use simple template.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a struts property: struts.ui.theme. You can set it in the struts.properties file, or directly in your struts.xml file using a <constant name=.../> tag. The options are simple, xhtml (the default), css_xhtml and ajax.
 
You don't like waffles? Well, do you like this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic