You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by ldr <ch...@niro-it.dk> on 2006/07/13 17:01:14 UTC

Im lost.. please help - anyone

I have tried to implement panelnavigation2 just like in the tomahawk examples
(the dynamic one), but when its inside a form it doesnt render the style and
it looks kinda like this:

- menu 1
                - menuItem1
                - menuItem2
- menu 2
- menu 3

but it works fine on clicks actionlistener gets activated and all... but it
looks like crap :(

when I remove the <h:form></h:form> around it the style rendered and it
looks great but it doesn't work???? this is just like the example??? well it
can't be I guess I have added the code below:

////////////////////////////// JSP ////////////////////////////////////////

<t:div id="subnavigation_outer">	
<t:div id="subnavigation">	
    <t:panelNavigation2 id="nav1" layout="list" itemClass="mypage"
activeItemClass="selected">
   <t:navigationMenuItems id="navitems"
value="#{MpSubscriberProxy.panelNavigationItems}" />	
   </t:panelNavigation2>	
</t:div>	
</t:div>

/////////////////////////// CREATING /////////////////////////////////////

        
	public List getPanelNavigationItems() {
        List menu = new ArrayList();
        // Bruger oplysninger
        NavigationMenuItem subscriberInfo = getMenuNaviagtionItem("Bruger
oplysninger", null);
        menu.add(subscriberInfo);
        NavigationMenuItem itemInfo = getMenuNaviagtionItem("Ret dine bruger
oplysninger", "#{MpSubscriberProxy.showSubscriberChangeData}");
        itemInfo.setActive(true);
        itemInfo.setOpen(true);
        subscriberInfo.add(itemInfo);
       
        subscriberInfo.add(getMenuNaviagtionItem("Slet din backup konto",
"#{MpSubscriberProxy.showSubscriberDelete}"));
        NavigationMenuItem item = getMenuNaviagtionItem("Backup historie",
"#{MpSubscriberProxy.showSubcriberHistory}");
        
        subscriberInfo.add(item);
        // Mobiltelefon
        menu.add(getMenuNaviagtionItem("Skift mobiltelefon",
"#{MpSubscriberProxy.showSubcriberChangePhoneModel}"));
        // Data
        NavigationMenuItem data = getMenuNaviagtionItem("Dine data", null);
        menu.add(data);
        data.add(getMenuNaviagtionItem("Eksport dine kontakter",
"#{MpSubscriberProxy.showSubscriberExportContacts}"));
        data.add(getMenuNaviagtionItem("Eksport din kalender",
"#{MpSubscriberProxy.showSubscriberExportCalendar}"));
        
        return menu;
    }

please help, chris
-- 
View this message in context: http://www.nabble.com/Im-lost..-please-help---anyone-tf1937892.html#a5309965
Sent from the MyFaces - Users forum at Nabble.com.


Re: Im lost.. please help - anyone

Posted by ldr <ch...@niro-it.dk>.
I have now made a simple test page where only the panelnavigation2 exist, but
it still doesn't work?

see below:

navigationtest.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://myfaces.apache.org/sandbox" prefix="s"%>

<html>
<head>
	<title>TEST PAGE</title>
 	<link rel="stylesheet" type="text/css"
href="resources/stylesheets/myfaces_ex_basic.css" />
</head>
<body>
<f:view>
	
<t:div id="subnavigation_outer">	
<t:div id="subnavigation">	
<t:panelNavigation2 id="nav1" layout="list" itemClass="mypage"
activeItemClass="selected">	
    <t:navigationMenuItems id="navitems"
value="#{MpSubscriberProxy.panelNavigationItems}" />	
</t:panelNavigation2>	
</t:div>	
</t:div> 
					
</f:view>
</body>
</html>

MpSubscriberProxy.java

// --------------------------------------------------------- PanalNavigation
menu Settings
	public List getPanelNavigationItems() {
        List menu = new ArrayList();
        // Bruger oplysninger
        NavigationMenuItem subscriberInfo = getMenuNaviagtionItem("Bruger
oplysninger", null);
        menu.add(subscriberInfo);
        NavigationMenuItem itemInfo = getMenuNaviagtionItem("Ret dine bruger
oplysninger", "#{MpSubscriberProxy.showSubscriberChangeData}");
        itemInfo.setActive(true);
        itemInfo.setOpen(true);
        subscriberInfo.add(itemInfo);
       
        subscriberInfo.add(getMenuNaviagtionItem("Slet din backup konto",
"#{MpSubscriberProxy.showSubscriberDelete}"));
        NavigationMenuItem item = getMenuNaviagtionItem("Backup historie",
"#{MpSubscriberProxy.showSubcriberHistory}");
        
        subscriberInfo.add(item);
        // Mobiltelefon
        menu.add(getMenuNaviagtionItem("Skift mobiltelefon",
"#{MpSubscriberProxy.showSubcriberChangePhoneModel}"));
        // Data
        NavigationMenuItem data = getMenuNaviagtionItem("Dine data", null);
        menu.add(data);
        data.add(getMenuNaviagtionItem("Eksport dine kontakter",
"#{MpSubscriberProxy.showSubscriberExportContacts}"));
        data.add(getMenuNaviagtionItem("Eksport din kalender",
"#{MpSubscriberProxy.showSubscriberExportCalendar}"));
        
        return menu;
    }


	private static NavigationMenuItem getMenuNaviagtionItem(String label,
String action) {
		
        NavigationMenuItem item = new NavigationMenuItem(label, action);
        item.setActionListener("#{MpSubscriberProxy.TestAction}");
        item.setValue(label);
        return item;
    }
	
	public void TestAction(ActionEvent e)
	{
		String test = e.toString();
		test.endsWith("blah");
	}

public void showSubscriberChangeData(){
		divRenderFalse();
		divSettingsChangeSubData.setRendered(true);	
	}

---
---
---

Thanks again, chris
-- 
View this message in context: http://www.nabble.com/Im-lost..-please-help---anyone-tf1937892.html#a5318098
Sent from the MyFaces - Users forum at Nabble.com.


Re: Im lost.. please help - anyone

Posted by ldr <ch...@niro-it.dk>.
This was the web.xml that I have been using all time... the strange thing is
that it is working when I put the panelnavigation inside a form...


chris
-- 
View this message in context: http://www.nabble.com/Im-lost..-please-help---anyone-tf1937892.html#a5317779
Sent from the MyFaces - Users forum at Nabble.com.


Re: Im lost.. please help - anyone

Posted by Ondrej Svetlik <on...@svetlik.info>.
ldr wrote:
> Hi Ondrej thanks for the reply, here is my web.xml - I have added the
> extensionfilter...
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="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"
>   version="2.4"
>   id="WebApp_ID">
>   <description>debug web.xml</description>
>   <display-name>MpSupport-web</display-name>
>   
>   <context-param>
>     <description>State saving method: "client" or "server" (= default)
>             See JSF Specification 2.5.3</description>
>     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>     <param-value>server</param-value>
>   </context-param>
>   <context-param>
>     <description>This parameter tells MyFaces if javascript code should be
> allowed in the
>             rendered HTML output.
>             If javascript is allowed, command_link anchors will have
> javascript code
>             that submits the corresponding form.
>             If javascript is not allowed, the state saving info and nested
> parameters
>             will be added as url parameters.
>             Default: "true"</description>
>     <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
>     <param-value>true</param-value>
>   </context-param>
>   <context-param>
>     <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
>     <param-value>false</param-value>
>   </context-param>
>   <context-param>
>     <description>If true, rendered HTML code will be formatted, so that it
> is "human readable".
>             i.e. additional line separators and whitespace will be written,
> that do not
>             influence the HTML code.
>             Default: "true"</description>
>     <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
>     <param-value>true</param-value>
>   </context-param>
>   <context-param>
>     <description>If true, a javascript function will be rendered that is
> able to restore the
>             former vertical scroll on every request. Convenient feature if
> you have pages
>             with long lists and you do not want the browser page to always
> jump to the top
>             if you trigger a link or button action that stays on the same
> page.
>             Default: "false"</description>
>     <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
>     <param-value>true</param-value>
>   </context-param>
> 	
> 	<context-param>
>         <param-name>facelets.VIEW_MAPPINGS</param-name>
>         <param-value>*.xhtml</param-value>
>     </context-param>
>     <context-param>
>         <param-name>facelets.DEVELOPMENT</param-name>
>         <param-value>true</param-value>
>     </context-param>
>     <context-param>
>         <param-name>facelets.REFRESH_PERIOD</param-name>
>         <param-value>1</param-value>
>     </context-param>
>     
>   
>   	<listener>
>   	
> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
> 	</listener>
> 
>   <servlet>
>     <servlet-name>Faces Servlet</servlet-name>
>     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
> 
>   <servlet-mapping>
>     <servlet-name>Faces Servlet</servlet-name>
>     <url-pattern>*.jsf</url-pattern>
>   </servlet-mapping>
>  
>  
>  <filter>
>     <filter-name>requestParameterProviderFilter</filter-name>
>    
> <filter-class>org.apache.myfaces.custom.requestParameterProvider.RequestParameterServletFilter</filter-class>
>   </filter>
>   
>   <filter>
> 	<filter-name>MyFacesExtensionsFilter</filter-name>
> 
> <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>   
> <init-param>
>         <param-name>maxFileSize</param-name>
>         <param-value>20m</param-value>
>         <description>Set the size limit for uploaded files.
>             Format: 10 - 10 bytes
>                     10k - 10 KB
>                     10m - 10 MB
>                     1g - 1 GB
>         </description>
>     </init-param>
> 	</filter>
> 	
> 	<filter-mapping>
>     <filter-name>MyFacesExtensionsFilter</filter-name>
>     <!-- servlet-name must match the name of your
> javax.faces.webapp.FacesServlet entry -->
>     <servlet-name>Faces Servlet</servlet-name>
> 	</filter-mapping>
>  
>  	<filter-mapping>
>     <filter-name>MyFacesExtensionsFilter</filter-name>
>     <url-pattern>*.jsf</url-pattern>
> 	</filter-mapping>
> 
> 	<filter-mapping>
>     <filter-name>MyFacesExtensionsFilter</filter-name>
>     <url-pattern>/faces/*</url-pattern>
>   	</filter-mapping> 
> 
>   <filter-mapping>
>     <filter-name>requestParameterProviderFilter</filter-name>
>     <url-pattern>*.jsf</url-pattern>
>   </filter-mapping>
> 
> 
> </web-app>
> 


Hello there,

did it help? Look into the page source, look for any referenced styles 
(via extension filter) and try to access them. It should work, if not, 
your extension filter is not setup well.

Best regards

Ondrej Svetlik

Re: Im lost.. please help - anyone

Posted by ldr <ch...@niro-it.dk>.
Hi Ondrej thanks for the reply, here is my web.xml - I have added the
extensionfilter...

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="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"
  version="2.4"
  id="WebApp_ID">
  <description>debug web.xml</description>
  <display-name>MpSupport-web</display-name>
  
  <context-param>
    <description>State saving method: "client" or "server" (= default)
            See JSF Specification 2.5.3</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
  </context-param>
  <context-param>
    <description>This parameter tells MyFaces if javascript code should be
allowed in the
            rendered HTML output.
            If javascript is allowed, command_link anchors will have
javascript code
            that submits the corresponding form.
            If javascript is not allowed, the state saving info and nested
parameters
            will be added as url parameters.
            Default: "true"</description>
    <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
    <param-value>false</param-value>
  </context-param>
  <context-param>
    <description>If true, rendered HTML code will be formatted, so that it
is "human readable".
            i.e. additional line separators and whitespace will be written,
that do not
            influence the HTML code.
            Default: "true"</description>
    <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
    <param-value>true</param-value>
  </context-param>
  <context-param>
    <description>If true, a javascript function will be rendered that is
able to restore the
            former vertical scroll on every request. Convenient feature if
you have pages
            with long lists and you do not want the browser page to always
jump to the top
            if you trigger a link or button action that stays on the same
page.
            Default: "false"</description>
    <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
    <param-value>true</param-value>
  </context-param>
	
	<context-param>
        <param-name>facelets.VIEW_MAPPINGS</param-name>
        <param-value>*.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.REFRESH_PERIOD</param-name>
        <param-value>1</param-value>
    </context-param>
    
  
  	<listener>
  	
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
	</listener>

  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
 
 
 <filter>
    <filter-name>requestParameterProviderFilter</filter-name>
   
<filter-class>org.apache.myfaces.custom.requestParameterProvider.RequestParameterServletFilter</filter-class>
  </filter>
  
  <filter>
	<filter-name>MyFacesExtensionsFilter</filter-name>

<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>   
<init-param>
        <param-name>maxFileSize</param-name>
        <param-value>20m</param-value>
        <description>Set the size limit for uploaded files.
            Format: 10 - 10 bytes
                    10k - 10 KB
                    10m - 10 MB
                    1g - 1 GB
        </description>
    </init-param>
	</filter>
	
	<filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <!-- servlet-name must match the name of your
javax.faces.webapp.FacesServlet entry -->
    <servlet-name>Faces Servlet</servlet-name>
	</filter-mapping>
 
 	<filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>*.jsf</url-pattern>
	</filter-mapping>

	<filter-mapping>
    <filter-name>MyFacesExtensionsFilter</filter-name>
    <url-pattern>/faces/*</url-pattern>
  	</filter-mapping> 

  <filter-mapping>
    <filter-name>requestParameterProviderFilter</filter-name>
    <url-pattern>*.jsf</url-pattern>
  </filter-mapping>


</web-app>

-- 
View this message in context: http://www.nabble.com/Im-lost..-please-help---anyone-tf1937892.html#a5313348
Sent from the MyFaces - Users forum at Nabble.com.


Re: Im lost.. please help - anyone

Posted by Ondrej Svetlik <on...@svetlik.info>.
ldr wrote:
> I have tried to implement panelnavigation2 just like in the tomahawk examples
> (the dynamic one), but when its inside a form it doesnt render the style and
> it looks kinda like this:
> 
> - menu 1
>                 - menuItem1
>                 - menuItem2
> - menu 2
> - menu 3
> 
> but it works fine on clicks actionlistener gets activated and all... but it
> looks like crap :(
> 
> when I remove the <h:form></h:form> around it the style rendered and it
> looks great but it doesn't work???? this is just like the example??? well it
> can't be I guess I have added the code below:
> 
> ////////////////////////////// JSP ////////////////////////////////////////
> 
> <t:div id="subnavigation_outer">	
> <t:div id="subnavigation">	
>     <t:panelNavigation2 id="nav1" layout="list" itemClass="mypage"
> activeItemClass="selected">
>    <t:navigationMenuItems id="navitems"
> value="#{MpSubscriberProxy.panelNavigationItems}" />	
>    </t:panelNavigation2>	
> </t:div>	
> </t:div>
> 
> /////////////////////////// CREATING /////////////////////////////////////
> 
>         
> 	public List getPanelNavigationItems() {
>         List menu = new ArrayList();
>         // Bruger oplysninger
>         NavigationMenuItem subscriberInfo = getMenuNaviagtionItem("Bruger
> oplysninger", null);
>         menu.add(subscriberInfo);
>         NavigationMenuItem itemInfo = getMenuNaviagtionItem("Ret dine bruger
> oplysninger", "#{MpSubscriberProxy.showSubscriberChangeData}");
>         itemInfo.setActive(true);
>         itemInfo.setOpen(true);
>         subscriberInfo.add(itemInfo);
>        
>         subscriberInfo.add(getMenuNaviagtionItem("Slet din backup konto",
> "#{MpSubscriberProxy.showSubscriberDelete}"));
>         NavigationMenuItem item = getMenuNaviagtionItem("Backup historie",
> "#{MpSubscriberProxy.showSubcriberHistory}");
>         
>         subscriberInfo.add(item);
>         // Mobiltelefon
>         menu.add(getMenuNaviagtionItem("Skift mobiltelefon",
> "#{MpSubscriberProxy.showSubcriberChangePhoneModel}"));
>         // Data
>         NavigationMenuItem data = getMenuNaviagtionItem("Dine data", null);
>         menu.add(data);
>         data.add(getMenuNaviagtionItem("Eksport dine kontakter",
> "#{MpSubscriberProxy.showSubscriberExportContacts}"));
>         data.add(getMenuNaviagtionItem("Eksport din kalender",
> "#{MpSubscriberProxy.showSubscriberExportCalendar}"));
>         
>         return menu;
>     }
> 
> please help, chris

Hello,

do you have correcly configured the extension filter? You should have 
something like this in your web.xml:

<filter>

<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
	<param-name>maxFileSize</param-name>
         <param-value>20m</param-value>
</init-param>

</filter>

<!-- extension mapping for adding <script/>, <link/>, and other resource 
tags to JSF-pages  -->
<filter-mapping>
	<filter-name>MyFacesExtensionsFilter</filter-name>
	<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

<filter-mapping>
	<filter-name>MyFacesExtensionsFilter</filter-name>
	<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>

Best regards

Ondrej Svetlik

Re: Im lost.. please help - anyone

Posted by Paul Spencer <pa...@apache.org>.
Relative to the presentation issues, the examples make heavy use of css.  I would
start by copying all of the relevent css selectors from the stylesheet into your JSP.


Paul Spencer


Mike Kienenberger wrote:
> On 7/13/06, ldr <ch...@niro-it.dk> wrote:
> 
>> I have tried to implement panelnavigation2 just like in the tomahawk 
>> examples
>> (the dynamic one), but when its inside a form it doesnt render the 
>> style and
>> it looks kinda like this:
>> but it works fine on clicks actionlistener gets activated and all... 
>> but it
>> looks like crap :(
>>
>> when I remove the <h:form></h:form> around it the style rendered and it
>> looks great but it doesn't work???? this is just like the example??? 
>> well it
>> can't be I guess I have added the code below:
> 
> 
> Recent versions of tomahawk no longer allow you to have command and
> input elements outside of a form.   Earlier versions automatically
> created a "Dummy form" around these elements, but these dummy forms
> caused other problems, so they are no longer supported.
> 
> This is probably why it works in a form, but no longer works outside of 
> a form.
> 
> I don't know what might be causing your presentation issues, though.
> 
> 


Re: Im lost.. please help - anyone

Posted by Mike Kienenberger <mk...@gmail.com>.
On 7/13/06, ldr <ch...@niro-it.dk> wrote:
> I have tried to implement panelnavigation2 just like in the tomahawk examples
> (the dynamic one), but when its inside a form it doesnt render the style and
> it looks kinda like this:
> but it works fine on clicks actionlistener gets activated and all... but it
> looks like crap :(
>
> when I remove the <h:form></h:form> around it the style rendered and it
> looks great but it doesn't work???? this is just like the example??? well it
> can't be I guess I have added the code below:

Recent versions of tomahawk no longer allow you to have command and
input elements outside of a form.   Earlier versions automatically
created a "Dummy form" around these elements, but these dummy forms
caused other problems, so they are no longer supported.

This is probably why it works in a form, but no longer works outside of a form.

I don't know what might be causing your presentation issues, though.