Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   JSP Bean in javascript lead to blank page (http://www.go4expert.com/forums/jsp-bean-javascript-lead-blank-page-t27792/)

kanak09 14Feb2012 15:41

JSP Bean in javascript lead to blank page
Hello everyone !
I'm developping a JSF application. My pages are JSP extension and i have some javascript scripts inside.
My situation is simple but can't solve it. I have to fill in javascript tabs thanks to values provided by my beans.

Here is my code : ( i replaced my true classes ^^)

<%@page language="java" import="com.test.Toto"%>
<jsp:useBean id="totoManager" class="com.test.TotoManager"></jsp:useBean>
 <script type="text/javascript">
  var categories;
  var data;
  var count;
<% for (com.test Toto: totoManager.getJokes()) { %>
                  categories.push(<%= toto.getCategory() %>);
                    title: <%= toto.getTitle() %>,
                    joke:<%= toto.getText() %>     
  <% } %>

Here is the result i'd like to obtain after the loop :

            var categories = ['Poo', 'Funny', 'Toto's Mother'],      var data = [{              title: 'blabla',            joke: 'wonderful joke',          }, {            title: 'foo',            joke: 'so funny',          }]
If i remove the script the page loads correctly, but with the script, it remains blank, with no source code ...
So i might have a problem calling my bean !

Thanks for helping

All times are GMT +5.5. The time now is 03:40.