Florian Fogl

Greenhorn
+ Follow
since Nov 04, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Florian Fogl

Hi there,

just stick it in the faces-config.xml in your WEB-INF folder and iniatilize it with the appropriate values and scope.

<managed-bean>
<description>
The "backing file" bean that backs up the guessNumber webapp
</description>
<managed-bean-name>site</managed-bean-name>
<managed-bean-class>form.Site</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>siteName</property-name>
<property-class>String</property-class>
<value>0</value>
</managed-property>

Then write in your JSF file:

<f:view>
<h:form>
<h:inputText binding="#{site.siteName}"></h:inputText>
</h:form>
</f:view>

That's it!

Florian
20 years ago
Hi K Varun,

I thin I know what the problem is. I create the compononent within the method "encodeBegin" of my custom component and it gets never registered with the current FacesContext. So, there is no broadcast to the default action listener and therefore the method is not invoked.

I think I am missing something here! How can I tell my custom component to create a link that acts like a command link and invokes a method? That's what I'm trying to do!

Thanks!
20 years ago

Originally posted by K Varun:


I guess u r missing one line:
htmlCommandLink.setId("put any id here");

For component created programatically, JSF doesn't create the id automatically, you will have to set it up on ur own.



Thanks K Varun for your reply! Alas, it didn't do the trick! The ID is created even if I don't set it manually. Any other ideas?
20 years ago
Hi everybody,

seems like I got stuck with this Problem here: I am trying to create HtmlCommandLink within my custom component that points to a method via method binding. My code looks as follows:

ResponseWriter writer = context.getResponseWriter();
HtmlForm htmlForm = new HtmlForm();
htmlForm.encodeBegin(getFacesContext());
HtmlCommandLink htmlCommandLink = new HtmlCommandLink();
htmlCommandLink.setParent(htmlForm);
MethodBinding methodBinding = getFacesContext().getApplication().createMethodBinding("#{TestAction.defaultAction}", null);
htmlCommandLink.setAction(methodBinding);
htmlCommandLink.encodeBegin(getFacesContext());
writer.write("Link");
htmlCommandLink.encodeEnd(getFacesContext());
htmlForm.encodeEnd(getFacesContext());

The Link is created in the page and I can click on it but the method is not invoked. I can invoke it in the code manually which means the reference to the method is working. Am I missing something here?

Any help appreciated

Florian
20 years ago
Hi everybody,

has anyone of you got a clou why there has to be a seperate Table T1 in the database when I use CMP together with MySQL?

My IDE is WSAD 5.0.0 and I using the built-in test server to run the entitty bean!

Any ideas?
I don't know how to test it properly! Obviously the servlet can't find them. But I don't have a clue why because it works fin from the command line! Any ideas?
Hi all,
I've got a problem using FOP (0.20.5) with external fonts. The funny thing is that everything works fine when I use FOP from the command line whereas using FOP in a servlet on WebSphere (Version 5) I get the following error message:
[ERROR] unknown font Arial,normal,normal so defaulted font to any [02.03.04 14:33:38:651 CET] 33b6ae4d SystemOut
I think it's got something to do with the path names of the userconfig.xml, the font metrics file and the ttf-file. I have placed them in same directory like the .fo-file that I want to be rendered. My Code looks like this:
- userconfig.xml
<fonts>
<font metrics-file="Arial.xml" kerning="yes" embed-file="Arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
<font-triplet name="ArialMT" style="normal" weight="normal"/>
</font>
</fonts>
- servlet
try {
foDir = getFoDir();
File userConfigFile = new File(foDir + "userconfig.xml");
Options options = new Options(userConfigFile);
FileInputStream foFile = new FileInputStream(foDir + file);
log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
MessageHandler.setScreenLogger(log);
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
Driver driver = new Driver(new InputSource(foFile), outStream);
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
driver.run();
byte[] binary = outStream.toByteArray();
response.setContentType("application/pdf");
response.setContentLength(binary.length);
response.getOutputStream().write(binary);
response.getOutputStream().flush();
}
catch (Exception exc) {
exc.printStackTrace();
}
The servlet works fine and the PDF is created but with the wrong font! Does anyone know how to fix this problem.
Thanks!
Florian
Hi all,
since I am fairly new to Enterprise JavaBeans I would like to ask you if you could answer me a few questions on some parts which I didn't quite get from the books I've read so far.
How do I manage 1:n and n:n relationships in an entity bean? Let's say we have a table named 'customer' and a table named 'addresses' and each customer can have several addresses. So if I want to create a list in the browser of all customers with thier addresses grouped by customers do I have to iterate through all the customer bean instances and the instances of the addresses? And how do I handle n:n relationships?
Do I put any business logic in the entity beans or is it better to code it in session beans? Let's say I want to delete a customer: does that mean that a session bean deletes all addresses connected to the customer or does the customer bean delete the addresses itself?
How does a stateful session bean keep track of a web session? After a JSP has been executed you lose the reference to the instance of the session bean, right? How do I know which one it was? Is there I primary key for stateful session beans?
How do I transfer data from the database to the entity bean? Using a resultset means that the entity bean has to have a direct connection to the database since a resultset is not serializable and can't be passed over RMI. Would a DAO be a normal Java class or could it also be implemented as session bean?
As you can see I am a little bit confused about the possibilities and to be honest I don't really see the advantages using EJB. Transaction handling can be done without it and when I first tried to iterate through some instances of an entity bean it took ages in comparison to a simple SQL query.
Basically it comes down to the question if I am missing something here. It doesn't offer something really new except a very complicated way of accessing data.
Any advice appreciated!
Thanks!
Flo