Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

label and style sheet in struts 2

 
hani Ibrahim
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
 
Indrayani Bhoir
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>
 
Merrill Higginson
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!
 
guntur reddy
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
 
kaleeswaran Gounder
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am also having same problem....Help me..

Thanks..
 
Manuel Schenkhuizen
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic