Adam Kronicki

Ranch Hand
+ Follow
since Sep 01, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
17
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Adam Kronicki

J Butenhoff wrote:Was this ever resolved? Just starting down a very similar path and stumbled into this post. Did notice that the HTTP that works does declare the boundary marker, though not sure how significant that is.



I ended up generating the multipart request 'manually' by submitting string sings to the connection stream. However later on I succeed with the jersey library on Android so I don't have this code any more. But I think you could find some similar solution for dealing with multipart messages with URLConnection class or just read the spec like I did.
11 years ago
I use the same css file and classes in further pages after logging in (.xhtml) and there everything works- the images are loaded. However it seems that for the login .html page the path buts be without 'resources' (the root catalog for css folder, img folder etc.), so now I must in fact have 2 css files which only differ in the img path (the new path doesn't work at .xhtml pages...). Quite annoying to be honest.

11 years ago
JSF
I am using form-based authentication in my JSF2 webapp on Tomcat. On the login page I use css styling. I learned from previous experience with JSF 1.2 that I need to work on the security constrains, so the page could access the css file on the login page. So I did and the css file is loaded properly. The problem is that the images that are used in the css classes (like background-image: url(../res/img/back.png); ) are not loaded. Surprisingly when I use simple img tag on my login site:
<img src="res/img/back.png">
it works... So the images cannot be loaded only from the css file...

My security constrains are:



This didn't happen it JSF 1.2 Why I the images cannot be loaded in the css file? How to fix this?
11 years ago
JSF
I have posted this question on the richfaces jboss discussion board cause it's strictly rich-oriented but had no response and am still stuck in the same place so I hope someone here can tell me what is going on.
I have problem with customizing the column headers in a rich:scrollabledatatable.



The problems are the following:

a)I can't hide white column separators bewteen the header celss

b)I would like to place one long image as a background for the column headers



I tried the following css aproach to achieve that with no results so far:

a) I set all border-right, border-left etc. to 0px in my header classes which assing to the columns by headerClass="myClass". However there is still a white line between each header. I was setting the border, border-right, border-left, border-right-width, border-left-width to 0px in the following classes: .rich-sdt-header-cell, .rich-sdt-hsplit, .rich-sdt-header-cell-body, .rich-sdt-hc. I have also disabled the column resizing by setting

.rich-sdt-hsep {

display:none;

border: 0px;

border-right-width: 0px;

border-left-width: 0px;

}

.dr-sdt-hsep {

display:none;

border: 0px;

border-right-width: 0px;

border-left-width: 0px;

}



I know that this must be some other class than my header classes because I can manipulate all 4 borders within them and I see my changes - so if I set the to 0px they are definitely not shown - it must be something else that is visible and draws this lines.



b) I tried setting the background image in the css class for headers row:

.rich-std-header-row{

width:680px;

height:33px;

background-image: url(resources/table_header.jpg);

background-repeat: no-repeat;

position: absolute;

bottom: 0px;

z-index:10;

}



I was testing each element separately to make sure that I don't make some kind of mistake here. Does any one have some kind of advice here?
11 years ago
JSF
The solution is to change the protected url pattern from /* to i.e. *.faces
11 years ago
JSF
I am using form-based authentication in my JSF webapp and everything was working fine. Until I wanted to enhance the login page to look like the rest of the application - it's only html code, no JSF or JSP tags. However the problem is with the css file and it has 2 levels:
a)the css classes are not loaded at all - everything is plain white with black text
b)when I provide my credentials and hit enter or press the submit button, the pages goes to my css file!!! The url path changes to the css file and I see the file content with classes etc.

Here is my login page:



I wanted to edit the classes for input methods I don't know if this causes the problem (however since the classes are not loaded at all I don't think so):



I tried changing the login file extension from loginpage.jsp to loginpage.html but this did not help. If I delete the link to the css file from page header problem 2 disappears (obviously problem 1 remains). I l have also tried to put all css files in the header <style> tag but then after login, the page redirects to of the pictures used in the css as a background-image. How can I load the css files to the login page?
11 years ago
JSF
I have updated my project to richfaces 4.1.0 and JSF 2.0. I have abviously changed the maven dependencies, updated web.xml, faces-config.xml, swtiched from *.jsp files to *.xhtml files, updated all head,body,form to h:head, h:body, h:form. However, I have significant problems with my page layout and a4j:ajax behavior. I think that it's best if I just list the problems:

-My rich:datatable & rich:calendar skin stopped working. I even tried deleting the columnClass etc. attributes from the tag to leave it with default bluesky skin, but the outcome looks just like a plain html table (no lines, no background, no colors). The same with calendar: when I click on the popup button the calendar is plain transparent text - no background color, nothing. When I click on a date it's changing but the event is not fired.
-the a4j:axjax tag works much worse thatn a4j:support did. For my selectOneMenus I tried event="change" but it doesn't work. Only after adding a valueChangedListener to the tags and tried event="valueChange" it worked.
-Although event="valueChange" worked on selectOneMenu, my a4j:mediaOutput image is not re-rendered. And the chart was the reason why I switched to JSF 2.0 because I needed to use the session-data-helper mechanism to load the images. Is there a special mechanism to rerender (or now 'render' with a4j:ajax) this element when it's using the session-data-helper for loading data?

Moreover I have discovered that apart from my css files the page has only skinning.css file which does not have the classes form calendar & datatable. Shouldn't be more css files with the classes?

Here are the web.xml and index.xhtml files:


index.xhtml


here is a list of .jar files deployed with the webapp:

commons-logging-1.1.1.jar
cssparser-0.9.5.jar
guava-r08.jar
jcommon-1.0.16.jar
jfreechart-1.0.13.jar
jsf-api-2.1.6.jar
jsf-impl-2.1.6.jar
jstl-1.2.jar
mysql-connector-java-5.1.18.jar
oscache-2.3.jar
richfaces-components-api-4.1.0.Final.jar
richfaces-components-ui-4.1.0.Final.jar
richfaces-core-api-4.1.0.Final.jar
richfaces-core-impl-4.1.0.Final.jar
sac-1.3.jar
12 years ago
JSF
Ok I solved my problem (I screwed up the intialisation in @PostConstruct method - obviously sth so simple must have been also a trivial mistake too trivial to notice). However Tim, your post suggest that I do sth. very wrong with the whole process and I don't get the picture you are trying to present here. So if it's not a problem I am interested (and grateful of course) in a clearer explanation...
12 years ago
JSF
Tim thank you for your support but I don't know if we are on the same page here. I try to understand what you are trying to get across but I don't see it relevant. I don't know when, where and how are should I call the methods you have posted... There is no insert, update or save mechanism in my page... Maybe it's my fault but I have a feeling that we are talking about 2 different problems. I will try to explain what my situation is as much detailed and careful as I can:

My problem here is quite simple. I have a very simple page (only the jsp code snippet that you in the first post- nothing more). It's and index page in the whole webapp - so this does not 'come form' any other page. The job is to initialize and populate the SelectOneMenu with values from database, and when the user selects a value he then clicks on a button and the selected value is passed by f:param tag to another page (and bean - the formBean). This all that it is to the situation. The problem I have is already described - the mechanism does not work if the selectOneMenu value is not changed - then f:param is null. I see 2 solutions here:
-find a way to initialize f:param with the default value of selectedOneMenu. So if the user does not 'touch' selectOneMenu element and clicks on the button straight a way a proper value is passed (not null).
-find another way to assign the selectOneMenu value to the f:param (the one I use now with a4j event support was suggested to my on another discussion board).

I hope I don't sound rude, ignorant or anything else, but I just don't see the correlation here...
12 years ago
JSF

Tim Holloway wrote:


If I want to use the first (default) value I need to change it to sth. else and then change again to the first one .

I do not understand what that means. Could you please explain?


The problem is that when the page loads the "selected" param has a null value. When an onchange event occurs at the SelectOneMenu it re-renders the button tag, ergo setting the param value to current indexBean.model.selected_id - this works. However if the user does not change the value of selectOneMenu (leaving it at the default first one) and clicks the button, the "selected" param won't be set and remains at null. So what I meant above is that in order to pass the first default selectOneMenu value to the "selected" param, the user must change the SelectOneMenu value to sth. else and than again to the first value - this would trigger the onchange event, the button is re-rendered and the param is set. It is obviously a bug and a undesired behavior. If I would find a way to initialize the parameter in Java with the first value of selectOneMenu it won't be the case.

Tim Holloway wrote:
@PostConstruct isn't really the best way to handle stuff like this. Generally, it's a good practice to have the requesting function invoke a method in the backing bean to load an existing record or create a new one, and initialize the bean's properties at that time. That does require injecting the editing bean to be injected into the requesting bean, however.


Ok this got me lost somehow. Where should I initialize my bean's fields and value if not in @PostConstruct annotations? The SelectOneMenu values are populated form a database, with some other input parameters - so where is the Java place to run the initialization code? Surely not the bean's constructor. I though @PostConstruct annotation was exactly for this purpose...

I added a snippet form the faces-config.xml file in the first post for further clarification.
12 years ago
JSF
In my page I set a managed-property param with a value selected from selectOneMenu. The code is below.

This works but the problem is that it will only work if the selectOneMenu's value will actually change (so the event is launched and the button is re-rendered). If I want to use the first (default) value I need to change it to sth. else and then change again to the first one . If I just press the button without changing the selectOneMenu value, the parameter is null. Of course in my bean's @postConstruct method I initialize the indexBean.model.selected_id with the first value. Where should I initialise it so that it would also set the "selected" param at startup? (the values are generated from a database so it cannot be hard coded - must be java code).

EDIT: for further clarification I post a snippet of the faces-config.xml file:

12 years ago
JSF
BalusC gave me a solution on stackoverflow. To solve this problem the commandButton must be rerendered when the selectOneMenu value changes.
12 years ago
JSF
Hello,

I have a strange problem which I have been trying to fix for some time but am stuck in one place and don't quite understand what's going on here.

My index page looks like this:




The commandButton sends the user to a next page when I want to get the selected position from the selectOneMenu. The problem is that nothing is sent. When I select some value from the Menu the 'peek' outputText is rerendered properly and I can see the correct selection. However it is not sent to the next page and Bean. Surprisingly when I change the value of the parameter to a fixed String it works!!! So i.e. this:


Is read correctly in the next Bean!!! All of the beans are requested scoped with RichFaces @KeepAlive annotation (I tried without the annotation and it's the same).

Here I post a snippet of the faces-config.xml



Does any one have an idea why this doesn't work? I have used the managed-properties parameters like that in the past and it worked (meaning using some dynamically changed values not a static String).
12 years ago
JSF
I have a problem - I create my SQL queries dynamically and basing on user input options. So the user has 5 parameters (actually it's more) and he can choose to use some of them (all if he wants) or none and specify their value in the query. So I construct my query String (basic the WHERE conditions) by checking if a parameter was selected and if a value was provided. However now there is the problem of special characters like '. I could try to use replaceAll("'", "\\") but this is quite dull and I know that preparedStatement.setString() does the job better. However for me I would need than to check again if the parameter was provided and if the previous one were also (to specify the poison of ? and connect it to the right parameter). This causes a lot of combinations and does not look elegant.

So my question is - can I somehow receive the string preparedStatement.setString() produces? Or is there a similar function that would do the same job and give me the String so I can put it in the query manually.

Maybe the intro was too long but someone might have a better idea and I wanted to explain why I need it.