problem with submitting a form urgent
hi, when i am submitting twice only i am able to go to next page.in jsf note 1) if we give right values in dates then there is no problem. 2) if we give r fromdate is grater than to date then validation error comes. 3)even though we rectify that no validation error comes but the values are not submitted so we again have to submitted. what is the error in my code jsp page code in backing bean public void setToDate(String todate){ this.todate=todate; } public String getToDate(){ return todate; } public void setFromDate(String fromdate){ this.fromdate=fromdate; } public String getFromDate(){ return fromdate; } public void fromDateValidate(FacesContext context, UIComponent component, Object value)throws ValidatorException{ try{ date1=(String)value; System.out.println(date1); SimpleDateFormat sdf=new SimpleDateFormat("dd:MMM::HH"); fdate =sdf.parse(date1); } catch(Exception e){ message= new FacesMessage(); message.setSeverity(FacesMessage.SEVERITY_ERROR); message.setDetail("INVALID FORMAT"); message.setSummary("INVALID FORMAT"); throw new ValidatorException(message); } } public void toDateValidate(FacesContext context, UIComponent component, Object value)throws ValidatorException{ try{ date2=(String)value; System.out.println(date2); System.out.println("date1 value is"+date1); SimpleDateFormat sdf=new SimpleDateFormat("dd:MMM::HH"); tdate= sdf.parse(date2); } catch(Exception e){ message= new FacesMessage(); message.setSeverity(FacesMessage.SEVERITY_ERROR); message.setDetail("INVALID FORMAT"); message.setSummary("INVALID FORMAT"); throw new ValidatorException(message); } } public String showreport(){ System.out.println("to date is "+tdate); System.out.println("from date is "+fdate); if(!(tdate.after(fdate))){ FacesContext context=FacesContext.getCurrentInstance(); FacesMessage message = new FacesMessage("TODATE IS ALWAYS GREATER THAN FROM DATE"); message.setDetail("TODATE IS ALWAYS GREATER THAN FROM DATE"); message.setSummary("TODATE IS ALWAYS GREATER THAN FROM DATE"); context.addMessage("HRselforeachappVm", message); return "failure"; } return "showreport"; } -- View this message in context: http://www.nabble.com/problem-with-submitting-a-form-urgent-tf2002171.html#a5498009 Sent from the MyFaces - Users forum at Nabble.com.
Value is not a valid option
Hi, i am using two selectonemenus in my application one selectone is for host (system) second selectone is for cpu (cpus of the system) if i select first host (any hostname)the value change listeners fires and it gives the corresponding cpus of the host from the database and sets to second selectonemenu . but when i submitted to a next form i am getting a error Value is not a valid option This is jsp code. Corresponding java code // this is for value change listener public void hostSelection(ValueChangeEvent e) { FacesContext context = FacesContext.getCurrentInstance(); hostid=(String) e.getNewValue(); getCpuids(); context.renderResponse(); } //this is for host select public Map getHosts(){ try{ openConnection(); selhostnames=new HashMap(); String str="select distinct hostid from system_cpu"; st=con.createStatement(); rs=st.executeQuery(str); while(rs.next()){ hostname=rs.getString("hostid"); System.out.println(hostname); selhostnames.put(hostname,hostname); } return selhostnames; } public String getHost(){ return hostselected; } public void setHost(String hostselected){ this.hostselected = hostselected; } //this is for cpu selection public Map getCpuids(){ try{ if(hostid==null){ System.out.println("if it is null"); // imp note return selcpunames; } openConnection(); String str="select distinct cpuid from system_cpu where hostid=?"; System.out.println("setting cpuids from host"); ps=con.prepareStatement(str); ps.setString(1,hostid); ps.execute(); rs=ps.getResultSet(); while(rs.next()){ cpuname=rs.getString("cpuid"); System.out.println(cpuname); selcpunames.put(cpuname,cpuname); } return selcpunames; } public void setCpuid(String cpuid){ this.cpuid=cpuid; } public String getCpuid(){ return cpuid; } When I am running If its null // in tomcat And cpuids": Value is not a valid option. What is the problem with my code please tell and what to change if any one has guts to solve this problem please solve with regards shannu sarma -- View this message in context: http://www.nabble.com/Value-is-not-a-valid-option-tf1947496.html#a5340222 Sent from the MyFaces - Users forum at Nabble.com.
problem with value change listeners
Hi, i am working with value change listeners. while i am submiting the form again that value change listeners are fireing please tell how to avoid fireing of value change listeners when i am submiiting the form public void hostSelection(ValueChangeEvent e) { FacesContext context = FacesContext.getCurrentInstance(); hostid=(String) e.getNewValue(); getCpuids(); context.renderResponse(); } -- View this message in context: http://www.nabble.com/problem-with-value-change-listeners-tf1930333.html#a5286926 Sent from the MyFaces - Users forum at Nabble.com.
selectonemenuitem problems Value is not a valid option
Hi, I am working with two selectOneListBox in jsf If I selected one item in first list box the corresponding values(from the database (setting that values to preparedstatement)) must displayed in second list box For that I used value change listener . When I am submitting this form I am getting an error cpuids": Value is not a valid option. This is my code. This is jsp code. // this is backing bean code Corresponding java code // this is for value change listener public void hostSelection(ValueChangeEvent e) { FacesContext context = FacesContext.getCurrentInstance(); hostid=(String) e.getNewValue(); getCpuids(); context.renderResponse(); } //this is for host select public Map getHosts(){ try{ openConnection(); selhostnames=new HashMap(); String str="select distinct hostid from system_cpu"; st=con.createStatement(); rs=st.executeQuery(str); while(rs.next()){ hostname=rs.getString("hostid"); System.out.println(hostname); selhostnames.put(hostname,hostname); } return selhostnames; } public String getHost(){ return hostselected; } public void setHost(String hostselected){ this.hostselected = hostselected; } //this is for cpu selection public Map getCpuids(){ try{ if(hostid==null){ System.out.println("if it is null"); // imp note return selcpunames; } openConnection(); String str="select distinct cpuid from system_cpu where hostid=?"; System.out.println("setting cpuids from host"); ps=con.prepareStatement(str); ps.setString(1,hostid); ps.execute(); rs=ps.getResultSet(); while(rs.next()){ cpuname=rs.getString("cpuid"); System.out.println(cpuname); selcpunames.put(cpuname,cpuname); } return selcpunames; } public void setCpuid(String cpuid){ this.cpuid=cpuid; } public String getCpuid(){ return cpuid; } When I am running If its null//in tomcat And cpuids": Value is not a valid option. What is the problem with my code please tell and what to change With regards Shannu sarma -- View this message in context: http://www.nabble.com/selectonemenuitem-problems--Value-is-not-a-valid-option-tf1917733.html#a5249864 Sent from the MyFaces - Users forum at Nabble.com.
Re: tree 2 is not a dynamic tree
Hi, the facet are for "node types", not for "nodes . but i am getting date from databases and as per my requirements i have to set diffenent node types dynamically which i may not be declared in my jsp (predefine( when i click that node it has to go to some page. bu t what happen here is i have to declare all node types (pre define) in jsp like this in tree 2 we have to declare all nodes names in like this in java code TreeNodeBase personNode = new TreeNodeBase("person", "Frank Foo", false); i want to declare my facets also in backing beans with nodestypes so that my tree will become dynamic is there any solutions please give some rough example . with regards shannu -- View this message in context: http://www.nabble.com/tree-2-is-not--a-dynamic-tree-tf1899088.html#a5212173 Sent from the MyFaces - Users forum at Nabble.com.
tree 2 is not a dynamic tree
hi, in sun stdio creator i am getting a dynamic tree without using facets in tree 2 we have to declare all nodes names in like this in java code TreeNodeBase personNode = new TreeNodeBase("person", "Frank Foo", false); why i should declare facet for every nodes in jsp. then how we can call it as a dynamic tree. how to make tree with out using facets. like in sun stdio creatror ide if there is any possibility. with regards shannu sarma -- View this message in context: http://www.nabble.com/tree-2-is-not--a-dynamic-tree-tf1899088.html#a5195222 Sent from the MyFaces - Users forum at Nabble.com.
Re: how i protect my jsf pages from direct access
even though i put it in directory it is not working in tomcat 5.0 http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";> ChartCreatorWebApp protected /protected/*.jsp first.jsp Oracle Datasource example jdbc/myoracle javax.sql.DataSource Container here i am able to access http://localhost:8080/protected/second.jsp -- View this message in context: http://www.nabble.com/how-i-protect-my-jsf-pages-from-direct-access-t1836501.html#a5035684 Sent from the MyFaces - Users forum at Nabble.com.
how can i remove message from faces context
public String login(){ try{ check=false; openConnection(); System.out.println("login action"); ps=con.prepareStatement("select userid,password from epr_users where userid=? and password=?"); ps.setString(1,userid); ps.setString(2,password); ps.execute(); rs=ps.getResultSet(); System.out.println("hai"); while(rs.next()){ System.out.println(rs.getString("userid")); check=true; } if(check){ context=FacesContext.getCurrentInstance(); Iterator iter = context.getMessages("loginForm"); while (iter.hasNext()) { System.out.println("messages is removing"); iter.remove(); } return "success"; } else{ context=FacesContext.getCurrentInstance(); FacesMessage message = new FacesMessage("Invalid Username and/or Password"); context.addMessage("loginForm", message); return "failure"; } } catch(SQLException e){ e.printStackTrace(); } finally{ try{ if(rs!=null) rs.close(); rs=null; } catch(SQLException e){ e.printStackTrace(); } try{ if(ps!=null) ps.close(); rs=null; } catch(SQLException e){ e.printStackTrace(); } try{ close(); } catch(SQLException e){ e.printStackTrace(); } } return "failure"; } } please see this code while login is success if there is any message corresponding to my login form i want to remove message.an but it is not happening why .even though messages are adding to context in context.getMessages("loginForm"); no messages is comming -- View this message in context: http://www.nabble.com/how-can-i-remove-message-from-faces-context-t1839880.html#a5023009 Sent from the MyFaces - Users forum at Nabble.com.
how i protect my jsf pages from direct access
I want to protect these pages : /utilisateur.* /menugen.* sniplet of my web.xml and it security section: index.jsf index.jsp index.html Prevent access to raw JSP pages that are for JSF pages. Raw-JSF-JSP-Pages /utilisateur.* /menugen.* No roles, so no direct access When i directly type the URL : http://localhost:9000/supLegerWebJSF/utilisateur.jsf the page is shown ! what did i miss ? JL PASTUREL -- View this message in context: http://www.nabble.com/how-i-protect-my-jsf-pages-from-direct-access-t1836501.html#a5012556 Sent from the MyFaces - Users forum at Nabble.com.
how can i remove message from faces context
Hi , how can i remove messages from faces context or any alernative for removing the messages i am adding my message like this FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null,new FacesMessage(FacesMessage.SEVERITY_WARN,"Invalid Username or Password","")); how can i remove that message -- View this message in context: http://www.nabble.com/how-can-i-remove-message-from-faces-context-t1835398.html#a5009115 Sent from the MyFaces - Users forum at Nabble.com.
how to know selectoneradio is checked or not
Hi, i am using a selectoneradio button in h:datatable http://www.nabble.com/how-to-know-selectoneradio-is-checked-or-not-t1739394.html#a4726778 Sent from the MyFaces - Users forum at Nabble.com.
doubts about tree control
Hi there, I am using myfaces tree2 and want to be able to select a node that is clicked from a tree and then forward to another JSP page that will have details of the node on it. I have finally managed to work out how to select the node, but am now wondering how I can navigate to the next page. node a b c if i clicked on a i have to a.jsp if i clicked on b i hava e to b.jsp if i clicked on c i havae to in c.jsp Snippet from backing bean public void selectNode(ActionEvent event) { log.debug("ActionEvent: " + event); UIComponent component = (UIComponent) event.getSource(); while (!(component != null && component instanceof HtmlTree)) { component = component.getParent(); } if (component != null) { HtmlTree tree = (HtmlTree) component; TreeNodeBase node = (TreeNodeBase) tree.getNode(); tree.setNodeSelected(event); // how do I now forward to another JSP? if(a selected) a.jsp if(b selected) b.jsp if(c selected) c.jsp } } please give the solution . mail me to [EMAIL PROTECTED] with regards shannu sarma -- View this message in context: http://www.nabble.com/doubts-about-tree-control-t176.html#a4709850 Sent from the MyFaces - Users forum at Nabble.com.
problem with datatable and database
tackTrace(); } } } public void openConnection(){ try{ if(con==null){ DAOFactory Factory =DAOFactory.getDAOFactory(1); con=((OracleFactory)Factory).getConnection(); System.out.println("connection is in select factory"); } } catch(Exception e){ e.printStackTrace(); } } public void close()throws SQLException{ if(con==null){ System.out.println("connection already closed"); return; } con.close(); System.out.println("closed connection"); con = null; } } http://java.sun.com/dtd/web-facesconfig_1_0.dtd";> en en_US test.messages test mypack.SelectClass session with regards shannu sarma -- View this message in context: http://www.nabble.com/problem-with-datatable-and-database-t1733220.html#a4709544 Sent from the MyFaces - Users forum at Nabble.com.
is it possible to wrap message with command button
Hi is it possible to wrap message with command button with regards shannu sarma -- View this message in context: http://www.nabble.com/is-it-possible-to-wrap-message-with-command-button-t1720536.html#a4673576 Sent from the MyFaces - Users forum at Nabble.com.
how to wrapp massages the components inside the datatable
Hi, i am working on data table in java server faces i select a row in the data table and press delete then that row is deleted. if i did'nt select any row and i click a delete button a message has to come. and there is a component inside that data table i.e selectone radio button of myfaces by selectiong that i am deleting a row how to wrap a message with that selectoneradiobutton outside the data table problem. if i using my messagetag outside that data table it is not finding the selectone radio button ID in the data table.' if i placed message in the data table it is looking awkward. please give me the solution. with regards shannu sarma -- View this message in context: http://www.nabble.com/how-to--wrapp-massages--the-components-inside-the-datatable-t1720517.html#a4673541 Sent from the MyFaces - Users forum at Nabble.com.
how to selectOneRadioButton in datatable
Hi, how to use selectOneRadioButton in datatable. i want to use selectOneRadioButton in datatable so that when i select that particular row i can delete ,edit on that particular row. please help me and send me [EMAIL PROTECTED] with regards shannu -- View this message in context: http://www.nabble.com/how+to+selectOneRadioButton+in+datatable-t1697242.html#a4605823 Sent from the MyFaces - Users forum at Nabble.com.
how to put commandlink to my tree node
hi, 1) i have a frame with two parts frame 1 is treecontroller.jsp file is there and tree in treecontroller.jsp is like this tree - a first second while i click a node of that treecontroller i.e if i click a node first it show the first.jsp file in frame 2 and i click a node second it have to show second.jsp file in frame2 how i have to write a code for that in myfaces tree control 2) the nodes are to added dynamically when i click on the root node means when i added a record to the database three while i click a root node which is in collapsed state it have to show latest database results as like this +root when i click root -root first second third will have to come and when i click on third it has to go to some page means i have to add command link to that node dynamically means when i click third it has to go third.jsp and displayed in frame2 please help me because i have to implement this if any body does this please send me mail to [EMAIL PROTECTED] with regards shannui -- View this message in context: http://www.nabble.com/how+to+put+commandlink+to+my+tree+node-t1679306.html#a4553899 Sent from the MyFaces - Users forum at Nabble.com.