string « Data « JSF Q&A





1. How can I access methods based on strings in an array?    stackoverflow.com

Hello! I'm not even sure if this is possible, but hopefully it is in Java. I know I've done it in PHP by using variable variables and accessing a variable dynamically, but ...

2. JSF, writeAttribute("value", str, null) fails with strings obtained through ValueExpression.getValue()    stackoverflow.com

I'm having a somewhat weird problem with custom JSF component. Here's my renderer code:

public class Test extends Renderer {

 public void encodeBegin(final FacesContext context,
         ...

3. JSF : How can i get the msg from message.property as a String in Java code?    stackoverflow.com

I want to get message.properties's message as a String in Java. How can I get it?

4. JSF: How do I include parameters in an action method's return string?    stackoverflow.com

I'm writing an action method that will store a new object in a database. Once this is done, I want to navigate to view that newly created object. To do this, ...

5. JSF h:outputText line break for long words within strings    stackoverflow.com

Is there a way tell the h:outputText of JSF (2.0) to insert a line break (or event better: a custom string like "- ") into very long words within strings? My problem ...

6. JSF: CSS file as byte[] to String    stackoverflow.com

I have a .css file saved id DB as byte[]. Now i need to include content of that file in a page body. I do it in this way:

class FlowUtils ...

7. How do I set a String variable using inputText in JSF?    stackoverflow.com

I have a flow.xml file that's calling a method on a bean. I just want to have a string that I get from a textbox passed in as a parameter to ...

8. JSF: h:outputText; how to show a dash when the value is empty string?    stackoverflow.com

I'm using h:outputText tags to display readonly data. Ex:

<h:outputText value="Phone Number:" />
<h:outputText value="#{userHandler.user.phoneNumber}" />
When "phoneNumber" is an empty string or a null, I want to display a dash "-" as ...

9. JSF 2.0 query string propagation    stackoverflow.com

I've a page that receives an id number via querystring and shows the relative article. I use <f:viewParams> with preRenderView event and the data are loaded from db in @PostConstruct method:

@Named
@RequestScoped
public class ...





10. Best way to store user preferences on a website?(Not just string entries)    stackoverflow.com

Lets say I want to store user preferences, but they aren't just string and integer preferences. Some of them are say java objects such as Color, JFreeChart chart settings, etc. ...

11. JSF inputText NumberConverter store empty string as null    stackoverflow.com

<h:inputText value="#{testBean.b}"><f:converter converterId="dc" /></h:inputText>

@SessionScoped
@ManagedBean
class TestBean{
    private Double b;
    //getter-setter
}
I have a requirement to store empty values as null and 0 as 0 in a double ...

12. Work around for faulty INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL in Mojarra JSF 2.1    stackoverflow.com

I know there are a number of posts about converting empty string to null in JSF2. The usual prescription is to add the following to web.xml.

<context-param>
  <description>Does not appear to ...

13. jsf boolean to string conversion?    stackoverflow.com

I have a backing bean MyBean, containing a field creditCard it can have two string values('y' or 'n'),it's populated from the DB. now i want to display this in checkbox so ...

14. selectonemenu with the error java.lang.String cannot be cast to javax.faces.model.SelectItem    stackoverflow.com

I want to fill a selectonemenu but always I have this error :

java.lang.String cannot be cast to javax.faces.model.SelectItem
this is the code:
public class ToolsJIRA implements Serializable{

private String myChoicePeriod;

 //getters and setters
}
JSF:
  ...

15. Convert ArrayList < String> to ArrayList    stackoverflow.com

I have an ArrayList<String> named listout, I want to convert it to an ArrayList<SelectItem>. How can I do that? PS: JSF's selectItem

16. How to keep the query string in URL when using Tomahawk Datascroller?    stackoverflow.com

I'm trying to get the Tomahawk dataScroller working correctly. Currently, I have a url with a query string and on the page I have data in a table with a dataScroller ...





17. JSF2 Converting List of String to String[]    stackoverflow.com

having a bit of a spanner moment. I need to convert a List to String Array: List<String> selectedIndicie to String[] targetIndices; The selectedIndicie list is pulled from a backing bean and I ...

18.  Security: is there a way to use a straight reference to char[] instead of a String?    stackoverflow.com

Preamble: This might be a giant noob mistake, all the developers on my team are a little fuzzy at the Java 101 here so if we're worrying about nothing please let ...

19. How do I get selectManyCheckBox to return something other than List?    stackoverflow.com

This is a pattern that I would use over and over again if I get it to work. I have an enum name Log.LogKey that I want to user to ...

20. How can I get the query string    stackoverflow.com

I'm using jsf 1.1 and icefaces 1.8. I have a PartsInv.jsp page and a managed PartsInv.java bean. I've tried messing around with several classes based on google hits I've come across, ...

21. How can I truncate string in JSF?    stackoverflow.com

How can I truncate string in JSF2 ?
Say I have a really long name and I only want to display 5 characters how can I do that? I know I use ...

23. Showing a parameterized string for localization purpose    stackoverflow.com

Is there a way to have a parmeterized string in resource bundle? I need this as the order of nouns can be different in different languages. For e.g. in my English bundle ...

25. how to give database connection string in configuration file    coderanch.com

I recommend defining the connection pool (and the connections themselves) in the tomcat resources (Context). For a couple of reasons: 1. There are actually several different database connection poolers available to Tomcat. The most common one is Apache DBCP, but it's not the only one. If you specify the connection pooler externally as a Tomcat resource, you don't have to rebuild ...

26. Query string in view id got ignored    coderanch.com

Hi, I am currently using JSF 1.2 (MyFaces Impl). I have been trying to specify a query string after the view id as follows: about /main.jsp?page=about And the main.jsp just dynamically and simply includes a page called "about.jsp". However, I find that MyFaces keeps ignoring everything after ".jsp" so I can never get the query parameter from ...

29. Coversion of string to EBCDIC format.    coderanch.com

I don't know that this is the right forum to ask that question in, but maybe this will help. java.lang.String is defined as Unicode. It is the native way to deal with strings in Java apps. It's better NOT to work with EBCDIC internally in an application because of that. So the only times you should normally convert to EBCDIC are ...

34. h:selectOneMenu problem evaluating to empty String    coderanch.com

it string value and it is in jsf page we get it as empty string ie:"" you can check it out be using hutputtext so null value from the select box will never be selected if you provide empty string value it will be selected . if sel has ...

35. using c:forEach to iterate over Map>    coderanch.com

If there's JSF in the code, it gets moved. Otherwise, we waste time with questions like "what's that # doing there?". JSF acts very differently than JSP in may respects and there are usually nuances that will not be known to people in the JSP forum who are not familiar with JSF. So in order to avoid confusing people who are ...

36. How to write boolean expression from string in JSF?    coderanch.com

Resin, Tomcat, WebLogic, doesn't matter. In some cases, you can map Strings directly to booleans, since Java has certain conversion conventions (and I believe they're case-insensitive), but I'm assuming that that didn't work here. Besides, I've fought the same problem myself, since databases rarely support true boolean datatypes. You can create a custom JSF converter to handle this. One side of ...

37. Convert Long to String inside JSF el expression    coderanch.com

Hi Hatem, Its not a good idea to convert anything in an EL expression. It can have some issues with getters and setters if you do that. I would suggest you to do that in the backing bean like setLongvalue(getLongvalue.toString). why do you need to convert it in an EL expression? any specific reason for that. Hope this helps

38. Binding: converting from String to Object    coderanch.com

All binding does is cause the component to be related to a bean method of set and get and others if they are there (at least set and get will) so HtmlOutputText myOuttextcomponent; String myOutputmessage = "Your Login Failed"; public void setMyOutMessage(String myOutputmessage){ this.myOutputmessage = myOutputmessage; } public String getMyOutMessage(){ return myOutputmessage; } public void setMyOutextComponent(HtmlOutputText myOuttextcomponent){ // JSF will set ...

39. TextArea String formatting issue    coderanch.com

44. requiredMessage duplicating returned EL string    coderanch.com

Hi guys, a small but annoying problem I am using a simple requiredMessage attribute to display the validation error message on the listbox below when a data is not selected The error message is correctly showing up in the messages element below, except that it is duplicated. ...

45. Concatinating string to EL    coderanch.com

48. Query string in jsf    coderanch.com

49. Trimming a string in JSF    coderanch.com

I was wondering if there is a way to trim a string that is too long for the display using JSTL functions. So, for example if I had this: My Really Long Display Name and for purposes of the UI, I need to trim the string if it's greater than, say 20 characters to this: My Really Long Disp... I know ...

50. java.lang.NumberFormatException: For input string    coderanch.com

Hi, I am get the following error when trying to dynamically load an htmldatatable: Mar 29, 2011 9:13:43 AM com.sun.facelets.FaceletViewHandler handleRenderException SEVERE: Error Rendering View[/untitled1.xhtml] java.lang.NumberFormatException: For input string: "colA" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) View code: Backing bean code: private HtmlDataTable lbrrtdt; private HibernateDAO hdao = new HibernateDAO (); private HtmlPanelGrid ...

51. convert string to Integer in JSF code only    coderanch.com

yeah, i just changed the type from String to Integer. It was not actually that much of code change it's one of the field of web service request. on web service it has defined it as String, so i have also had it as String now i changed it to Integer and doing parsing while i get the results back from ...

55. formatting a string from backbean    coderanch.com

56. how to set the length of a string    coderanch.com