Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Response issue  RSS feed

 
Samdani masum
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am also facing same problem problem here . i am find out his here .


Exp : after save button , render attribute carry large amount of data .
p1.png
[Thumbnail for p1.png]
 
Samdani masum
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem example :



After Save click save button , it reload combo box , so data size is large , any one give me a solution ,

how to solve this problem for clearing form after save ?

Note : JSF data size problem is not CDI , OR JSF problem .
p3.png
[Thumbnail for p3.png]
 
Samdani masum
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
source code that contain problem of Combo load every time in JSF2.2 , after save click for render attribute
example tested on Glassfish4, wildfly9
i think need to avoid render attribute , and use alternative solution .
Note : clearing form ater save button .

===============================================



=========================================


================================





 
Tim Cooke
Marshal
Posts: 3872
233
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samdani, please UseCodeTags when posting code on the forum. I've added them for you this time, see how much better it looks? You're much more likely to get an answer if you make it as easy as possible for people to understand your question.
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't attach new questions to old question threads. Start your own thread. We do not charge extra for new threads.

Also, you can make your questions more readable - and thus more likely to get help - if you use the "Code" button on our message editor to wrap code tags around your pre-formatted data (Java code, XML, and so forth).

And try and remove as much extraneous code as possible from your examples, leaving only the parts that relate to your problem. Since we don't get paid to do this, we find it difficult to get enthusiastic about wading through a lot of clutter to find the stuff that needs looking at.

Finally, have patience. A lot of us only check in once a day, since we're volunteering our help and usually have other jobs taking up most of our time.

I didn't read your examples in detail (see above), but 2 things did seem to stand out.

First, your AJAX call is improper. It should be in this form:


The EL expression for the AJAX listener is a method reference not a method call. JSF does the calling, not the View (xhtml) and it does so according to strict rules, so all it wants is the method's name, not a method call. Remove the "()".

That probably won't help performance, but at least it will make for a more compliant View Template, and that might avoid unpredictable behaviors.

The main thing I noted was that you said that a lot of data was being sent on the partial page update. If you send a lot of data, it's going to take a long time, regardles of whether it's AJAX or not or even JSF or not. Plus large amount of data on webpage often abuses the eyes of the users. Try and keep things small.
 
Samdani masum
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samdani masum wrote:i am also facing same problem problem here . i am find out his here .


Exp : after save button , render attribute carry large amount of data .
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your refresh() method is meaningless, if not actually dangerous.

JSF AJAX runs through exactly the same lifecycle as ordinary JSF form submits do, excep that they have the option to limit what form data will be submitted and that they will typically be using the "render=" attribute to indicate what parts of the page will be refreshed from the latest values from the backing bean(s). Thus, you're simply attempting to manually re-create what's already happening automatically.

That may be part of the problem.

Another thing to check. If you're using SSL, some appservers disable caching. There's a possibility that 100K or so of JavaScript support code is being sent to the client on each AJAX operation since the code is needed but not cached. Check the datastreams coming from the server using a tool such as firefly.
 
Samdani masum
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes , Refresh button is optional . And My Application server is default configuration . so, no ssl here at this moment .
I also tell that it is not problem of JSF or Ajax jsf life cycle related .


problem : My problem is data size : 1kb for 2 element and another is : 6.5 kb for one editable grid . My application running on local pc.

Q1 : why it transfer lot of data only for 2 element ???

----------------------------------------------------------------------------



I want to send my war file . how to attached war /.zip file ?


 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't mean that the refresh button was meaningless. I meant that the refresh method code you wrote was meaningless. You could code the refresh method like this:


I'm unclear if you do or don't need to specify an action event object parameter for JSF AJAX in order for JSF to match its method signature and invoke it. Last time I read the JavaDocs, it didn't look optional, but other times I've gotten the impression that it is.

In any event, you don't even need to code an action listener at all to get the lifecycle to process and refresh.


Beyond that, do you really consider less than 10K to be "a lot" of data in this day and age? That's actually quite good. Especially since the overhead of XML encoding is fairly substantial and on top of that, there's JSF context data being transmitted.

Any time I can do something with less than 30K coming back I'm very pleased.
 
Samdani masum
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Tim Holloway ,

please consider save button .

<h:commandButton
value="save">
<f:ajax execute="@this" listener="#{customerBean.save()}" render="nb bc"/>
</h:commandButton>



Note : refresh button , method is not my problem . my problem is save method/save button .

give me solution according to save button against .
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, the proper coding for the xhtml is:


Without the parentheses on "save". You should be specifying a reference to the save function, NOT coding it as a direct call. The xhtml doesn't call it - xhtml is a template language, not executable code. JSF does the actual call, using the reference.

According to the Javadocs, the actual java code for the save method must obey the following constraints:

(signature must match public void processAjaxBehavior(javax.faces.event.AjaxBehaviorEvent event) throws javax.faces.event.AbortProcessingException)


So according to that, your method should be:


Incidentally, since HTML is text-only, a better choice for clearing myid and appName would be to set them both to empty strings (""). That's what's going to get sent to the client when you make them null - and what the client will return, so that way logic doesn't get confused because it's sometimes "" and sometimes null.

Your actual complaint, however, was that you thought too much data was coming back when the save function processed. And if you are really only getting less than 20K returned, that's about as good as JSF can do for you.
 
Samdani masum
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found a solution . now it is working fine . data transfer size is low .

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