Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8955
  • Last Modified:

Wrapping text in a label in Jsp

I have a label tag in my jsp page.

<label class="FormLabel" id="titleName_id" ><%= request.getAttribute("titleName") != null ? request.getAttribute("titleName") : "" %></label>

<%= request.getAttribute("titleName") != null ? request.getAttribute("titleName") : "" %>   will give the title name.  When the title name is too long, I need it to be wrapped. Pls help
0
shaan432
Asked:
shaan432
2 Solutions
 
hongjunCommented:
Add this css to the class="FormLabel"

word-wrap:break-word;
0
 
shaan432Author Commented:
I tried that. I added that entry in the css file for the formlabel class as follows.  But it didnt work. What else can be done

.FormLabel {
font-family: arial, sans-serif;
font-size: 10pt;
color: #336699;
text-decoration: none;
font-weight: normal;
line-height: normal;
height: 20px;
padding-top: 1px;
padding-right: 0px;
padding-bottom: 1px;
padding-left: 1px;
word-wrap:break-word;
}


0
 
hongjunCommented:
You can consider adding in a width: XXXXXXpx; to the css.
If you don't add in, then it will be 100% across the width of your browser window.

hongjun
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
shaan432Author Commented:
cant i specify the width in the label tag itself instead in the css file? else it would be applicable to the  labels in the entire application.  whats ur suggestion.
0
 
hongjunCommented:
Yes you can specify the width in the div itself.
For example,

<div class="FormLabel" style="width:200px;">


hongjun
0
 
mrcoffee365Commented:
You can specify a style in a <span> tag for your specific label.  Although you might want to create a class, and use it in your <label> tag.

Also, if your text in the label does not have any spaces or newlines in it, then it will not wrap.  In that case, you have to actually break up the string with code.
0
 
vjc2003Commented:
You can specify  like wrap="soft" or wrap="hard" fro wrapping the text
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now