Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How access to content of dynamic page in JSF?  RSS feed

 
Hosein masbough
Greenhorn
Posts: 9
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I have a xhtml file that initialization it with ui:repeat tag in realtime.all tags of this page placed under ui:fragment tag.



When i access to this page and save it as xml in realtime, the tags in xml file saved is empty while it is initialized and everything is working properly.

<edges>
</edges>

How can i access to content of this xhtml page and save it on disk?

Thanks.

 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hosein masbough wrote:

When i access to this page and save it as xml in realtime, the tags in xml file saved is empty while it is initialized and everything is working properly.

Explain more about this. How are you accessing the content as xml and what is the purpose of this? Also when is it working properly and when is it not working properly?
 
Hosein masbough
Greenhorn
Posts: 9
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using this file as a template for sigmajs graph.the graph is drawen properly.

I want save the content of this file as xml for using it in other utility software like Gephi.

graphInfoBean Class:


graph.xhtml:



Unfortunately, the tags is empty.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is JSF involved in this? Why not just use XML generating tools?
 
Hosein masbough
Greenhorn
Posts: 9
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E Armitage wrote:Why is JSF involved in this? Why not just use XML generating tools?


I want used the template xml file to drawing graph in realtime and for saving it for using in other program.

Which tools do I use , these terms?
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to use templates then there are templating apis as well like freemarker which should do what you want. JSF would be for web applications that users interact with.
 
Hosein masbough
Greenhorn
Posts: 9
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E Armitage wrote:If you want to use templates then there are templating apis as well like freemarker which should do what you want. JSF would be for web applications that users interact with.


According to the official website of Freemarker in here freemarker dosen't work with JSF.

Is there any other solution?
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hosein masbough wrote:
E Armitage wrote:If you want to use templates then there are templating apis as well like freemarker which should do what you want. JSF would be for web applications that users interact with.


According to the official website of Freemarker in here freemarker dosen't work with JSF.

Is there any other solution?


My question was why does this need to work with JSF?
 
Hosein masbough
Greenhorn
Posts: 9
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our web application is JSF and we cann't change it.
My main problem is that when i get page in code , it is raw:



and the EL experssons don't run ,



for this reason the tags is empty.how can i call graph.jsf that managedbean have runned.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not suggesting that you change your web application from JSF (if you have a web application). I'm asking why you want to use JSF to generate XML instead of generating the XML in the 'backend' without involving JSF at all. JSF is for generating HTML for display by browsers and that involves making sure tha urls that match the FacesServlet pattern are matched.
 
Hosein masbough
Greenhorn
Posts: 9
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How generating XML in the 'backend' without involving JSF at all?

Thanks.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such thing as a "JSF Server".

JSF is a JEE-standard framework to support forms-based MVC-style application design. It is not a "Master Control Program" that has to get its grubby little hands on each and every incoming HTTP request. A given webapp deployed within a JEE server can have as much or as little of its code be in JSF as is convenient. Including zero. JSF is provided as part of the support environment for JEE servers just like EJBs or JMS and can be incorporated into partial-stack servers (such as Tomcat), but there is absolutely no requirement that you use JSF in any of the webapps any more than that all deployed webapps need use EJB or JMS.

In order to generate non-HTML output from JSF, you have to do violent things to it. It isn't worth the trouble. If you need to generate a PDF, have a traditional servlet generate the PDF. If you need to generate XML, consider using a traditional JSP XML template. Or, for that matter, use Spring MVC to drive an XML template. JSF won't care.

JSF and non-JSF components in a webapp can easily share data, since a JSF session-scope object is exactly the same thing as a non-JSF session-scope object other than the fact that JSF automatically instantiated it on demand instead of requiring manual construction and storage of the session object in user-written code.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hosein masbough wrote:How generating XML in the 'backend' without involving JSF at all?

Thanks.

If the XML starts off with a template and you want to substitute values from POJOs then freemarker can do that easily. You can also generate XML from a POJO using JAXB.
 
Hosein masbough
Greenhorn
Posts: 9
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used this solution and that is best solution:

Stackoverflow
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!