Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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

label and style sheet in struts 2

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
i have 2 questions:
1)I want to separate "Enter your Name" in <td> and textFiled in other <td>
when i do that these 2 td arent appear in the same vertical alignment.
the first one in top and other in bottom i dont know why that happened???
im forced to do like this:
<s:textfield label="Enter your Name" value="" required="true" name="userBean.userName"></s:textfield>

but this option doesnt allow me to give label style sheet and the text field has another style sheet.
2)i build a cascade style sheet but i think it still not taken
please if any body give me tutorial or link for tutorial how to use custom cascade style sheet for using it to Struts2 please
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use <s:text name="" cssStyle="width:125px;"></s:text> tag to display your label and add required css style in cssStyle attribute.
 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i want something to use cascade style.css:

<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/style.css"/>

<s:textfield cssClass="" cssStyle="labelStyle" label="Enter your name" ></s:textfield>

As i see :1)the style wasnt affect.
2)even if it gives the result how can i separate the style of label from the style of textfield !!!.

please consider point 1 more important to me please.
 
Indrayani Bhoir
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

may be seprating your lable and textfield will help you

<td><s:text name="text1" value="Enter your name" cssStyle="labelStyle"></s:text></td>
<td><s:textfield cssStyle="textStyle" name="userBean.userName"></s:textfield></td>
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you follow Indu's suggestion above, you must also specify theme="simple" either at the form level or the element level.
 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not work:
<s:text name="text1" value="Enter your name" cssStyle="labelStyle"></s:text>

because <s:text> tag doesnt take value or cssStyle :
exception
javax.servlet.ServletException: org.apache.jasper.JasperException: /login.jsp(44,0) PWC6131: Attribute value invalid for tag text according to TLD
it just tame:id and name so still we have problrm!
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me sir
ex :<s:textfield name="first name" label="First Name" /> in this example how can i separate textfield and label .please send a one sample example . i am the stating stage of this program



Thanks sir
gvr
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am also having same problem....Help me..

Thanks..
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First you need a file name struts.properties in your classpath
Second write struts.ui.theme=css_xhtml.
Third use cssClass attribute in your tag.
 
Wink, wink, nudge, nudge, say no more, it's a 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