I'm Using rich faces 4
I'm using input number slider
<rich:inputNumberSlider value="10" width="500" minValue="1" maxValue="30" step="1" showInput="false" enableManualInput="false" showArrows="false" tooltipClass="" showTooltip="true" label="Days" />
i want to add word "Days" in the tool tip , to be "10 Days" instead of "10" .
RichFaces API on <rich:inputNumberSlider> says:
The "label" attribute is a generic attribute. The "label" attribute
provides an association between the component and the message that the
component (indirectly) produced. This attribute defines the parameters
of a localized error and informational messages that occur as a result
of conversion, validation, or other application actions during the
request processing lifecycle. With the help of this attribute you can
replace the last parameter substitution token shown in the messages.
For example, {1} for "DoubleRangeValidator.MAXIMUM" , {2} for
"ShortConverter.SHORT".
In short - label is used in all components as a parameter for jsf messages.
I have looked into richfaces sources for <rich:inputNumberSlider> ui javascript. It is possible to change javascript in certain places, adding hardcoded 'Days' string. To achieve this I can't think of any other options than recompiling the sources.
I suggest specifying somewhere else, that this slider measures days.
Related
I have a REST service method annotated with
io.swagger.annotations.ApiOperation
#ApiOperation(value = "some string")
I need some string to generate newlines in the HTML page swagger-ui.html
(i.e. in the Swagger UI page where I see my docs and I can test my API methods).
I tried putting <br/> and \n in some string, and anything I could think of,
and anything I could find as suggestions here on SO... but nothing works.
Any ideas? Or is it just not possible?
I see the project uses Swagger 1.5.20 JARs.
That version I cannot change.
swagger-annotations-1.5.20.jar
swagger-models-1.5.20.jar
I am afraid that you cannot put line breaks into the summary field as opposed to description field. Check the comment from a member of Swagger team: Swagger UI ignores line breaks in description
The summary field is displayed as a single line because the summary text is inside of a <span> element. Being an inline element, the span ignores \n characters.
Further, your <br> is not showing up because the summary field is a simple string field, as opposed to description, which is a Markdown field ...
I am using Struts2 with ModelDriven for form submitting.
When I use datetimepicker tag of Dojo and select date from that tag the form is submitted correctly with the form values populated in the ModelDriven object.
But when datepicker tag of jQuery is taken in the form and date is selected the object in ModelDriven have null values.
If date is not selected and form is submitted then it work fine.
Is there any setting required that I missed to resolve the issue ?
I had included following jar for JQuery.
JQuery:
<sx:datepicker name="startDate" id="startDate" label="" cssStyle="width:275px; "
minDate="0" displayFormat="dd/mm/y" changeMonth="true" changeYear="true"
readonly="true" value="%{startDate}"/>
remove readonly="true" and everything will work fine.
readonly attribute default to false tells that whether the input is read-only.
I'm pretty sure that
name="startDate"
should be changed to
name="yourmodel.startDate"
Show more code for a better help...
Struts expects a value to be sent to the server as a locale-independent value, conforming to RFC3 339 (yyyy-MM-dd'T'HH:mm:ss) this is what the default dojo tag (now deprecated) provides: http://struts.apache.org/2.0.12/docs/datetimepicker.html
You can just send: 2013-01-03 the rest is optional.
The jQuery Datepicker I uses mm/dd/yy. To change this format to what struts2 expects either change the defaultFormat used for presentation or set altFormat which changes what was input into the format presented during submission (So if you like "mm/dd/yy" you can just set altFormat to "yyyy-mm-dd" and get the desired effect).
http://jqueryui.com/datepicker/#date-formats
http://api.jqueryui.com/datepicker/
As you can see jQuery easily provides for this, how to do it with the tag... I don't know. Someone else is welcome to take this information and extend it in another answer, with a tag specific technique if possible.
Problem was Dojo takes the date value on JSP as Date in java whereas JQuery takes it as string.
And so struts was finding for setDate(String) and not setDate(Date) for JQuery.
Context : One of the application has a xhtml form where a text area would be rendered as disabled field.
Problem : And when user submits the form, the converter associated with that field doesn't get invoked, but works fine when the text area is not disabled.
Is this how JSF request/response life cycle works or, am I missing something ?
Pseudo Code:
<tag:field id="xyz" label="abc" value="#{something.something}"
disaply="mutable" required="false" styleClass="Text_Area"
disabled="#{somethingelse.something}" rows = "4" cols="50"
converter="freeTextConverter">
</tag:field>
As per HTML specification, the values of disabled input fields are not sent along with the form submit. So JSF simply got null as value and there's nothing to convert. You perhaps want to use readonly instead. This way the value is not editable, but it will be sent along with the form submit. You only need to take into account that the client can still tamper the request and edit the value before it get sent. You'd perhaps want to store the value in a view scoped bean instead and keep the field disabled.
I created a simple input field for an int variable. I want to add validation to it but, but i see no need to create my own validator for it, since the only thing i need is to avoid negative values and characters other than numbers.
So this is what i did:
<h:inputText id="price" value="#{placeAddControler.price}">
<f:validateLongRange minimum="0"/>
</h:inputText>
<h:outputText value="€" />
<br/>
<span style="color: red;"><b><h:message for="price"
showDetail="true" /></b></span>
When i try how it works this is the result for negative values:
And this is the result for characters:
Where in my project can i customize the text of those validation messages?
To change these values you basically have to define your own Resources file, override the properties you want custom messages for and register it in web.xml. This link seems to explain it well, so I've included this rather than try and rewrite the content.
For a simpler solution and as you are JSF 2 you can also use these attributes of the inputText component:
requiredMessage="I am a custom message"
converterMessage="I am a custom message"
validatorMessage="I am a custom message"
This will override any message which the validator itself spits out.
But I'd prefer the Resource bundle, as that promotes consistency of user visible error messages across your application.
You can register a message bundle and customize those messages. This is a pretty decent example/tutorial:
http://www.mkyong.com/jsf2/customize-validation-error-message-in-jsf-2-0/
Just wanted a clear answer for a direct question -- google results have been all over the place or don't address the combos you'll see below.
I'm generally a JSP newbie and have been screwing around with the following code.
<form:input id="theId" path="path.copied.directly.fromSomewhereElse"
cssClass="contentTextInput" cssStyle="width: 229px" />
When I put that into my JSP page and load my website, it works fine and looks as my cssClass defines it. Then I start messing with it because I want it to display a default value.
<form:input id="theId" path="path.copied.directly.fromSomewhereElse"
value="blah" cssClass="contentTextInput" cssStyle="width: 229px" />
Suddenly, HTTP 500, an org.apache.jasper.JasperException! So I decide to remove the path altogether, while leaving in the value. This is just step 1 in something I know works because of prior experience. The code is now:
<form:input id="theId" value="someClass.valueIWantAsDefault"
cssClass="contentTextInput" cssStyle="width: 229px" />
That actually throws an exception, too -- but then I remove the form prefix and it works-- mostly. You see, the cssClass's effects are now gone; it looks like a regular, unaffected input textbox. Here's the code so far.
<input id="theId" value="someClass.valueIWantAsDefault"
cssClass="contentTextInput" cssStyle="width: 229px" />
What exactly do these attributes (and prefix) do that makes this mix-and-match work?
I'm guessing you're dealing with a jsp page that relies on a JSP custom tag library that's part of the Spring Framework. Here are the docs for the <form:input> tag. value is not a valid attribute for this custom tag as you can see in the docs link I provided above. When you remove the form:, you're turning the tag into a plain old HTML <input> tag which is why your error is going away at that point. It's also why your css stops working. cssClass is not the correct attribute for the HTML <input> tag. It's simply class. They called it cssClass in the jsp custom tag lib most likely to avoid a lower level collision with the Object.getClass() method (long story, just take my word for it).