Styling in peopleTable.html

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Styling in peopleTable.html

amit tanwar
Referring the code using url in dwr.war as :dwr/reverseajax/peopleTable.html
in this example output is shown to user with code '<tbody id="peopleTable"></tbody>', and this id(peopleTable) is set using code
'Util.addRows("peopleTable", data)' of updateTableDisplay method.
what if i want to add some styling to this table(basically i want to change look and feel of the table), i searched on net but in all readymade table, CSS is working on td and tr tag and original example is working tbody-->id tag.

Can u direct me to some table styling of code (as used original example tbody-->id()) tag? or original code can be changed from tbody-->id tag code to td tags.
Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

david@butterdev.com
Take a look at the docs, they indicate how to style tr/td:
http://directwebremoting.org/dwr/documentation/browser/util/tables.html



On 03/18/2014 01:51 AM, kamal vijay wrote:

> Referring the code using url in dwr.war as
> :dwr/reverseajax/peopleTable.html
> in this example output is shown to user with code '<tbody
> id="peopleTable"></tbody>', and this id(peopleTable) is set using code
> 'Util.addRows("peopleTable", data)' of updateTableDisplay method.
> what if i want to add some styling to this table(basically i want to
> change look and feel of the table), i searched on net but in all
> readymade table, CSS is working on td and tr tag and original example
> is working tbody-->id tag.
>
> Can u direct me to some table styling of code (as used original
> example tbody-->id()) tag? or original code can be changed from
> tbody-->id tag code to td tags.

Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

amit tanwar
hi, thankx for reply..i read the document and try to understand and want to fit like table as shown in below link
http://red-team-design.com/wp-content/uploads/2011/10/practical-css3-tables-with-rounded-corners-demo.html (Example 1 :Highlighted rows, borders)
but unfortunately not able to do,i am not able to start..Your help is much appreciated.

In run function i am removing all rows and again data[][] is displayed to GUI.
Util.removeAllRows("peopleTable");
Util.addRows("peopleTable", data); Note : Each time run function called, 2d array data size is increasing.


On Tue, Mar 18, 2014 at 4:54 PM, David Marginian <[hidden email]> wrote:
Take a look at the docs, they indicate how to style tr/td:
http://directwebremoting.org/dwr/documentation/browser/util/tables.html




On 03/18/2014 01:51 AM, kamal vijay wrote:
Referring the code using url in dwr.war as :dwr/reverseajax/peopleTable.html
in this example output is shown to user with code '<tbody id="peopleTable"></tbody>', and this id(peopleTable) is set using code
'Util.addRows("peopleTable", data)' of updateTableDisplay method.
what if i want to add some styling to this table(basically i want to change look and feel of the table), i searched on net but in all readymade table, CSS is working on td and tr tag and original example is working tbody-->id tag.

Can u direct me to some table styling of code (as used original example tbody-->id()) tag? or original code can be changed from tbody-->id tag code to td tags.


Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

david@butterdev.com
The example you have shown is straightforward.  You need to copy the css (from the top of their html page) and then add the bordered class to your table:
<table class="bordered">
If each time your run your function the data size is increasing, that is something inside of your code, not DWR.  I can't help you fix this unless you send me all of your JavaScript.

On 03/18/2014 10:49 PM, kamal vijay wrote:
hi, thankx for reply..i read the document and try to understand and want to fit like table as shown in below link
http://red-team-design.com/wp-content/uploads/2011/10/practical-css3-tables-with-rounded-corners-demo.html (Example 1 :Highlighted rows, borders)
but unfortunately not able to do,i am not able to start..Your help is much appreciated.

In run function i am removing all rows and again data[][] is displayed to GUI.
Util.removeAllRows("peopleTable");
Util.addRows("peopleTable", data); Note : Each time run function called, 2d array data size is increasing.


On Tue, Mar 18, 2014 at 4:54 PM, David Marginian <[hidden email]> wrote:
Take a look at the docs, they indicate how to style tr/td:
http://directwebremoting.org/dwr/documentation/browser/util/tables.html




On 03/18/2014 01:51 AM, kamal vijay wrote:
Referring the code using url in dwr.war as :dwr/reverseajax/peopleTable.html
in this example output is shown to user with code '<tbody id="peopleTable"></tbody>', and this id(peopleTable) is set using code
'Util.addRows("peopleTable", data)' of updateTableDisplay method.
what if i want to add some styling to this table(basically i want to change look and feel of the table), i searched on net but in all readymade table, CSS is working on td and tr tag and original example is working tbody-->id tag.

Can u direct me to some table styling of code (as used original example tbody-->id()) tag? or original code can be changed from tbody-->id tag code to td tags.



Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

amit tanwar
hi, very-very thankx for reply, I tried as suggested by u and got success. but stuck up into antoher problem, i have input screen in which user is giving input, on the basis i have to send updtes to browser.(On the basis of input i do searchin in database and result has been shown in output.)
Note : in the backend,values for input, value has been continuolusly changing,so i have to keep update to user.

Input string has been set in ScriptSession.
public void addAttributeToScriptSession(String input) {
            System.out.println(" [Input given by user]ADDING ATTRIBUTE TO SESSION --------------> "+input);
            ScriptSession scriptSession = WebContextFactory.get().getScriptSession();
            scriptSession.setAttribute(SCRIPT_SESSION_ATTR, input);
        }

 @Override
public boolean match(ScriptSession session)
{
    System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);
}

Object inputForRunMethod=null;

public void updateTableDisplay()
{
    // Get the current page.
    String page = ServerContextFactory.get().getContextPath() + "/reverseajax/peopleTable.jsp";
    // Create a new AttributeScriptSessionFilter which will look for an attribute on the ScriptSession
    ScriptSessionFilter attributeFilter = new AttributeScriptSessionFilter(SCRIPT_SESSION_ATTR);

    // Update the page, filters ScriptSessions using attributeFilter.  If the SCRIPT_SESSION_ATTR
    // has not been set on the ScriptSession the page in question will not receive updates.
    Browser.withPageFiltered(page, attributeFilter, new Runnable()
    {
        public void run()
        {
            System.out.println(" INPUT "+inputForRunMethod);
        }
    }
}           

If first time i give input "abc" than output has been displayed by abc.
But if i open a second tab, and give input for "def", than first tab output has been modified.

The reason is that inputForRunMethod has been modified by second value "def".
If there are two user,performing searching simultaneously(different searching string abc and def), then the output of the second user shall be shown to first user,which should not be happen. where i am doing wrong?



On Wed, Mar 19, 2014 at 5:30 PM, David Marginian <[hidden email]> wrote:
The example you have shown is straightforward.  You need to copy the css (from the top of their html page) and then add the bordered class to your table:
<table class="bordered">
If each time your run your function the data size is increasing, that is something inside of your code, not DWR.  I can't help you fix this unless you send me all of your JavaScript.


On 03/18/2014 10:49 PM, kamal vijay wrote:
hi, thankx for reply..i read the document and try to understand and want to fit like table as shown in below link
http://red-team-design.com/wp-content/uploads/2011/10/practical-css3-tables-with-rounded-corners-demo.html (Example 1 :Highlighted rows, borders)
but unfortunately not able to do,i am not able to start..Your help is much appreciated.

In run function i am removing all rows and again data[][] is displayed to GUI.
Util.removeAllRows("peopleTable");
Util.addRows("peopleTable", data); Note : Each time run function called, 2d array data size is increasing.


On Tue, Mar 18, 2014 at 4:54 PM, David Marginian <[hidden email]> wrote:
Take a look at the docs, they indicate how to style tr/td:
http://directwebremoting.org/dwr/documentation/browser/util/tables.html




On 03/18/2014 01:51 AM, kamal vijay wrote:
Referring the code using url in dwr.war as :dwr/reverseajax/peopleTable.html
in this example output is shown to user with code '<tbody id="peopleTable"></tbody>', and this id(peopleTable) is set using code
'Util.addRows("peopleTable", data)' of updateTableDisplay method.
what if i want to add some styling to this table(basically i want to change look and feel of the table), i searched on net but in all readymade table, CSS is working on td and tr tag and original example is working tbody-->id tag.

Can u direct me to some table styling of code (as used original example tbody-->id()) tag? or original code can be changed from tbody-->id tag code to td tags.





PeopleTable.java (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

amit tanwar
Please Reply!


On Thu, Mar 20, 2014 at 2:15 PM, kamal vijay <[hidden email]> wrote:
hi, very-very thankx for reply, I tried as suggested by u and got success. but stuck up into antoher problem, i have input screen in which user is giving input, on the basis i have to send updtes to browser.(On the basis of input i do searchin in database and result has been shown in output.)
Note : in the backend,values for input, value has been continuolusly changing,so i have to keep update to user.

Input string has been set in ScriptSession.
public void addAttributeToScriptSession(String input) {
            System.out.println(" [Input given by user]ADDING ATTRIBUTE TO SESSION --------------> "+input);
            ScriptSession scriptSession = WebContextFactory.get().getScriptSession();
            scriptSession.setAttribute(SCRIPT_SESSION_ATTR, input);
        }

 @Override
public boolean match(ScriptSession session)
{
    System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);
}

Object inputForRunMethod=null;

public void updateTableDisplay()
{
    // Get the current page.
    String page = ServerContextFactory.get().getContextPath() + "/reverseajax/peopleTable.jsp";
    // Create a new AttributeScriptSessionFilter which will look for an attribute on the ScriptSession
    ScriptSessionFilter attributeFilter = new AttributeScriptSessionFilter(SCRIPT_SESSION_ATTR);

    // Update the page, filters ScriptSessions using attributeFilter.  If the SCRIPT_SESSION_ATTR
    // has not been set on the ScriptSession the page in question will not receive updates.
    Browser.withPageFiltered(page, attributeFilter, new Runnable()
    {
        public void run()
        {
            System.out.println(" INPUT "+inputForRunMethod);
        }
    }
}           

If first time i give input "abc" than output has been displayed by abc.
But if i open a second tab, and give input for "def", than first tab output has been modified.

The reason is that inputForRunMethod has been modified by second value "def".
If there are two user,performing searching simultaneously(different searching string abc and def), then the output of the second user shall be shown to first user,which should not be happen. where i am doing wrong?



On Wed, Mar 19, 2014 at 5:30 PM, David Marginian <[hidden email]> wrote:
The example you have shown is straightforward.  You need to copy the css (from the top of their html page) and then add the bordered class to your table:
<table class="bordered">
If each time your run your function the data size is increasing, that is something inside of your code, not DWR.  I can't help you fix this unless you send me all of your JavaScript.


On 03/18/2014 10:49 PM, kamal vijay wrote:
hi, thankx for reply..i read the document and try to understand and want to fit like table as shown in below link
http://red-team-design.com/wp-content/uploads/2011/10/practical-css3-tables-with-rounded-corners-demo.html (Example 1 :Highlighted rows, borders)
but unfortunately not able to do,i am not able to start..Your help is much appreciated.

In run function i am removing all rows and again data[][] is displayed to GUI.
Util.removeAllRows("peopleTable");
Util.addRows("peopleTable", data); Note : Each time run function called, 2d array data size is increasing.


On Tue, Mar 18, 2014 at 4:54 PM, David Marginian <[hidden email]> wrote:
Take a look at the docs, they indicate how to style tr/td:
http://directwebremoting.org/dwr/documentation/browser/util/tables.html




On 03/18/2014 01:51 AM, kamal vijay wrote:
Referring the code using url in dwr.war as :dwr/reverseajax/peopleTable.html
in this example output is shown to user with code '<tbody id="peopleTable"></tbody>', and this id(peopleTable) is set using code
'Util.addRows("peopleTable", data)' of updateTableDisplay method.
what if i want to add some styling to this table(basically i want to change look and feel of the table), i searched on net but in all readymade table, CSS is working on td and tr tag and original example is working tbody-->id tag.

Can u direct me to some table styling of code (as used original example tbody-->id()) tag? or original code can be changed from tbody-->id tag code to td tags.





Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

david@butterdev.com
I am not sure what version of DWR you are using but if you download the latest dwr.war (demos) from http://directwebremoting.org/dwr/downloads/ we have a similar example (server-side clock), which works correctly.  The code you have sent is not accurate for the conditions you describe:

"If first time i give input "abc" than output has been displayed by abc.
But if i open a second tab, and give input for "def", than first tab output has been modified."

Your code is doing a System.out, so no output should be sent to either page.  What does the code that you are actually running look like? 


On 03/25/2014 10:50 PM, kamal vijay wrote:
Please Reply!


On Thu, Mar 20, 2014 at 2:15 PM, kamal vijay <[hidden email]> wrote:
hi, very-very thankx for reply, I tried as suggested by u and got success. but stuck up into antoher problem, i have input screen in which user is giving input, on the basis i have to send updtes to browser.(On the basis of input i do searchin in database and result has been shown in output.)
Note : in the backend,values for input, value has been continuolusly changing,so i have to keep update to user.

Input string has been set in ScriptSession.
public void addAttributeToScriptSession(String input) {
            System.out.println(" [Input given by user]ADDING ATTRIBUTE TO SESSION --------------> "+input);
            ScriptSession scriptSession = WebContextFactory.get().getScriptSession();
            scriptSession.setAttribute(SCRIPT_SESSION_ATTR, input);
        }

 @Override
public boolean match(ScriptSession session)
{
    System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);
}

Object inputForRunMethod=null;

public void updateTableDisplay()
{
    // Get the current page.
    String page = ServerContextFactory.get().getContextPath() + "/reverseajax/peopleTable.jsp";
    // Create a new AttributeScriptSessionFilter which will look for an attribute on the ScriptSession
    ScriptSessionFilter attributeFilter = new AttributeScriptSessionFilter(SCRIPT_SESSION_ATTR);

    // Update the page, filters ScriptSessions using attributeFilter.  If the SCRIPT_SESSION_ATTR
    // has not been set on the ScriptSession the page in question will not receive updates.
    Browser.withPageFiltered(page, attributeFilter, new Runnable()
    {
        public void run()
        {
            System.out.println(" INPUT "+inputForRunMethod);
        }
    }
}           

If first time i give input "abc" than output has been displayed by abc.
But if i open a second tab, and give input for "def", than first tab output has been modified.

The reason is that inputForRunMethod has been modified by second value "def".
If there are two user,performing searching simultaneously(different searching string abc and def), then the output of the second user shall be shown to first user,which should not be happen. where i am doing wrong?



On Wed, Mar 19, 2014 at 5:30 PM, David Marginian <[hidden email]> wrote:
The example you have shown is straightforward.  You need to copy the css (from the top of their html page) and then add the bordered class to your table:
<table class="bordered">
If each time your run your function the data size is increasing, that is something inside of your code, not DWR.  I can't help you fix this unless you send me all of your JavaScript.


On 03/18/2014 10:49 PM, kamal vijay wrote:
hi, thankx for reply..i read the document and try to understand and want to fit like table as shown in below link
http://red-team-design.com/wp-content/uploads/2011/10/practical-css3-tables-with-rounded-corners-demo.html (Example 1 :Highlighted rows, borders)
but unfortunately not able to do,i am not able to start..Your help is much appreciated.

In run function i am removing all rows and again data[][] is displayed to GUI.
Util.removeAllRows("peopleTable");
Util.addRows("peopleTable", data); Note : Each time run function called, 2d array data size is increasing.


On Tue, Mar 18, 2014 at 4:54 PM, David Marginian <[hidden email]> wrote:
Take a look at the docs, they indicate how to style tr/td:
http://directwebremoting.org/dwr/documentation/browser/util/tables.html




On 03/18/2014 01:51 AM, kamal vijay wrote:
Referring the code using url in dwr.war as :dwr/reverseajax/peopleTable.html
in this example output is shown to user with code '<tbody id="peopleTable"></tbody>', and this id(peopleTable) is set using code
'Util.addRows("peopleTable", data)' of updateTableDisplay method.
what if i want to add some styling to this table(basically i want to change look and feel of the table), i searched on net but in all readymade table, CSS is working on td and tr tag and original example is working tbody-->id tag.

Can u direct me to some table styling of code (as used original example tbody-->id()) tag? or original code can be changed from tbody-->id tag code to td tags.






Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

david@butterdev.com
Upon further examination all your match function is doing is checking if
the value is not null, since both users have set it output will be sent
to both browsers.  What you are seeing therefore makes total sense.  
What did you expect?


On 03/26/2014 06:01 AM, David Marginian wrote:
> System.out.println("2----->[only if JSP displayed] Override match
> function is called for attribute-name "+attributeName+" at "+new Date());
>     inputForRunMethod = session.getAttribute(attributeName);
>     System.out.println("3----> Match function:--retrieve attribute
> value from session "+inputForRunMethod+" at "+new Date());
>     return (inputForRunMethod != null);

Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

amit tanwar
hi,
very thankx for reply!
if there are two user having access to two different browser and giving input as "input1' and "input2" simultaneously.(input1 is giving by first browser and input2 is giving by second browser.)
Then output correspond to input1 should be shown to first browser and output correspond to input2 should be shown to second browser.How this can be achieved?
currently in code, second input is overwriting first input in run method, so output is wrong..


On Wed, Mar 26, 2014 at 5:47 PM, David Marginian <[hidden email]> wrote:
Upon further examination all your match function is doing is checking if the value is not null, since both users have set it output will be sent to both browsers.  What you are seeing therefore makes total sense.  What did you expect?



On 03/26/2014 06:01 AM, David Marginian wrote:
System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);


Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

david@butterdev.com
You ScriptSessionFilter needs to check that the value you set in the ScriptSession matches the value that the user has entered on the form on your page, something like:

public class UserValueScriptSessionFilter implements ScriptSessionFilter
{
    public UserValueScriptSessionFilter(String userValue)
    {
        this.userValue = userValue;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.ScriptSessionFilter#match(org.directwebremoting.ScriptSession)
     */
    public boolean match(ScriptSession session)
    {
        String valueInSS = (String)ss.getAttribute(SCRIPT_SESSION_ATTR);       
        return valueInSS.equals(userValue);
    }

    private final String userValue;
}

When you create an instance of UserValueScriptSessionFilter you need to pass in the value the user entered on the form (either stored in the Http Request or Http Session).

On 03/26/2014 11:53 PM, kamal vijay wrote:
hi,
very thankx for reply!
if there are two user having access to two different browser and giving input as "input1' and "input2" simultaneously.(input1 is giving by first browser and input2 is giving by second browser.)
Then output correspond to input1 should be shown to first browser and output correspond to input2 should be shown to second browser.How this can be achieved?
currently in code, second input is overwriting first input in run method, so output is wrong..


On Wed, Mar 26, 2014 at 5:47 PM, David Marginian <[hidden email]> wrote:
Upon further examination all your match function is doing is checking if the value is not null, since both users have set it output will be sent to both browsers.  What you are seeing therefore makes total sense.  What did you expect?



On 03/26/2014 06:01 AM, David Marginian wrote:
System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);



Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

amit tanwar
hi,
Thankx for reply! I have done the changes as suggested by you.
Instantiation of PeopleTable class has been performed in window.onload()=function(){} as
PeopleTable.PeopleTable('<%=(String) request.getParameter("input")%>');

But getting error in firefox web browser console as 'Type Error : PeopleTable.PeopleTable is not a function.'
i am also attacthing PeopleTable.java class and PeopleTable.jsp file.


On Thu, Mar 27, 2014 at 5:04 PM, David Marginian <[hidden email]> wrote:
You ScriptSessionFilter needs to check that the value you set in the ScriptSession matches the value that the user has entered on the form on your page, something like:

public class UserValueScriptSessionFilter implements ScriptSessionFilter
{
    public UserValueScriptSessionFilter(String userValue)
    {
        this.userValue = userValue;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.ScriptSessionFilter#match(org.directwebremoting.ScriptSession)
     */
    public boolean match(ScriptSession session)
    {
        String valueInSS = (String)ss.getAttribute(SCRIPT_SESSION_ATTR);       
        return valueInSS.equals(userValue);
    }

    private final String userValue;
}

When you create an instance of UserValueScriptSessionFilter you need to pass in the value the user entered on the form (either stored in the Http Request or Http Session).


On 03/26/2014 11:53 PM, kamal vijay wrote:
hi,
very thankx for reply!
if there are two user having access to two different browser and giving input as "input1' and "input2" simultaneously.(input1 is giving by first browser and input2 is giving by second browser.)
Then output correspond to input1 should be shown to first browser and output correspond to input2 should be shown to second browser.How this can be achieved?
currently in code, second input is overwriting first input in run method, so output is wrong..


On Wed, Mar 26, 2014 at 5:47 PM, David Marginian <[hidden email]> wrote:
Upon further examination all your match function is doing is checking if the value is not null, since both users have set it output will be sent to both browsers.  What you are seeing therefore makes total sense.  What did you expect?



On 03/26/2014 06:01 AM, David Marginian wrote:
System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);





PeopleTable.java (8K) Download Attachment
peopleTable.jsp (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

david@butterdev.com
1) You can't call a constructor from JS like that.  You need a default constructor for DWR to work (assuming you are using the new creator). 
http://directwebremoting.org/dwr/documentation/server/configuration/dwrxml/creators/new.html

2) What does you dwr.xml look like?  What is the scope of PeopleTable?  If it is application, like the People Table example in our demo, setting an instance variable (userValue) is not thread safe.  This should be obvious to you. 

On 03/31/2014 11:18 PM, kamal vijay wrote:
hi,
Thankx for reply! I have done the changes as suggested by you.
Instantiation of PeopleTable class has been performed in window.onload()=function(){} as
PeopleTable.PeopleTable('<%=(String) request.getParameter("input")%>');

But getting error in firefox web browser console as 'Type Error : PeopleTable.PeopleTable is not a function.'
i am also attacthing PeopleTable.java class and PeopleTable.jsp file.


On Thu, Mar 27, 2014 at 5:04 PM, David Marginian <[hidden email]> wrote:
You ScriptSessionFilter needs to check that the value you set in the ScriptSession matches the value that the user has entered on the form on your page, something like:

public class UserValueScriptSessionFilter implements ScriptSessionFilter
{
    public UserValueScriptSessionFilter(String userValue)
    {
        this.userValue = userValue;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.ScriptSessionFilter#match(org.directwebremoting.ScriptSession)
     */
    public boolean match(ScriptSession session)
    {
        String valueInSS = (String)ss.getAttribute(SCRIPT_SESSION_ATTR);       
        return valueInSS.equals(userValue);
    }

    private final String userValue;
}

When you create an instance of UserValueScriptSessionFilter you need to pass in the value the user entered on the form (either stored in the Http Request or Http Session).


On 03/26/2014 11:53 PM, kamal vijay wrote:
hi,
very thankx for reply!
if there are two user having access to two different browser and giving input as "input1' and "input2" simultaneously.(input1 is giving by first browser and input2 is giving by second browser.)
Then output correspond to input1 should be shown to first browser and output correspond to input2 should be shown to second browser.How this can be achieved?
currently in code, second input is overwriting first input in run method, so output is wrong..


On Wed, Mar 26, 2014 at 5:47 PM, David Marginian <[hidden email]> wrote:
Upon further examination all your match function is doing is checking if the value is not null, since both users have set it output will be sent to both browsers.  What you are seeing therefore makes total sense.  What did you expect?



On 03/26/2014 06:01 AM, David Marginian wrote:
System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);





Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

amit tanwar
 so what should i do changes in the code?


On Tue, Apr 1, 2014 at 5:32 PM, David Marginian <[hidden email]> wrote:
1) You can't call a constructor from JS like that.  You need a default constructor for DWR to work (assuming you are using the new creator). 
http://directwebremoting.org/dwr/documentation/server/configuration/dwrxml/creators/new.html

2) What does you dwr.xml look like?  What is the scope of PeopleTable?  If it is application, like the People Table example in our demo, setting an instance variable (userValue) is not thread safe.  This should be obvious to you. 

On 03/31/2014 11:18 PM, kamal vijay wrote:
hi,
Thankx for reply! I have done the changes as suggested by you.
Instantiation of PeopleTable class has been performed in window.onload()=function(){} as
PeopleTable.PeopleTable('<%=(String) request.getParameter("input")%>');

But getting error in firefox web browser console as 'Type Error : PeopleTable.PeopleTable is not a function.'
i am also attacthing PeopleTable.java class and PeopleTable.jsp file.


On Thu, Mar 27, 2014 at 5:04 PM, David Marginian <[hidden email]> wrote:
You ScriptSessionFilter needs to check that the value you set in the ScriptSession matches the value that the user has entered on the form on your page, something like:

public class UserValueScriptSessionFilter implements ScriptSessionFilter
{
    public UserValueScriptSessionFilter(String userValue)
    {
        this.userValue = userValue;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.ScriptSessionFilter#match(org.directwebremoting.ScriptSession)
     */
    public boolean match(ScriptSession session)
    {
        String valueInSS = (String)ss.getAttribute(SCRIPT_SESSION_ATTR);       
        return valueInSS.equals(userValue);
    }

    private final String userValue;
}

When you create an instance of UserValueScriptSessionFilter you need to pass in the value the user entered on the form (either stored in the Http Request or Http Session).


On 03/26/2014 11:53 PM, kamal vijay wrote:
hi,
very thankx for reply!
if there are two user having access to two different browser and giving input as "input1' and "input2" simultaneously.(input1 is giving by first browser and input2 is giving by second browser.)
Then output correspond to input1 should be shown to first browser and output correspond to input2 should be shown to second browser.How this can be achieved?
currently in code, second input is overwriting first input in run method, so output is wrong..


On Wed, Mar 26, 2014 at 5:47 PM, David Marginian <[hidden email]> wrote:
Upon further examination all your match function is doing is checking if the value is not null, since both users have set it output will be sent to both browsers.  What you are seeing therefore makes total sense.  What did you expect?



On 03/26/2014 06:01 AM, David Marginian wrote:
System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);






Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

amit tanwar
dwr.xml


On Wed, Apr 2, 2014 at 5:17 PM, kamal vijay <[hidden email]> wrote:
 so what should i do changes in the code?


On Tue, Apr 1, 2014 at 5:32 PM, David Marginian <[hidden email]> wrote:
1) You can't call a constructor from JS like that.  You need a default constructor for DWR to work (assuming you are using the new creator). 
http://directwebremoting.org/dwr/documentation/server/configuration/dwrxml/creators/new.html

2) What does you dwr.xml look like?  What is the scope of PeopleTable?  If it is application, like the People Table example in our demo, setting an instance variable (userValue) is not thread safe.  This should be obvious to you. 

On 03/31/2014 11:18 PM, kamal vijay wrote:
hi,
Thankx for reply! I have done the changes as suggested by you.
Instantiation of PeopleTable class has been performed in window.onload()=function(){} as
PeopleTable.PeopleTable('<%=(String) request.getParameter("input")%>');

But getting error in firefox web browser console as 'Type Error : PeopleTable.PeopleTable is not a function.'
i am also attacthing PeopleTable.java class and PeopleTable.jsp file.


On Thu, Mar 27, 2014 at 5:04 PM, David Marginian <[hidden email]> wrote:
You ScriptSessionFilter needs to check that the value you set in the ScriptSession matches the value that the user has entered on the form on your page, something like:

public class UserValueScriptSessionFilter implements ScriptSessionFilter
{
    public UserValueScriptSessionFilter(String userValue)
    {
        this.userValue = userValue;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.ScriptSessionFilter#match(org.directwebremoting.ScriptSession)
     */
    public boolean match(ScriptSession session)
    {
        String valueInSS = (String)ss.getAttribute(SCRIPT_SESSION_ATTR);       
        return valueInSS.equals(userValue);
    }

    private final String userValue;
}

When you create an instance of UserValueScriptSessionFilter you need to pass in the value the user entered on the form (either stored in the Http Request or Http Session).


On 03/26/2014 11:53 PM, kamal vijay wrote:
hi,
very thankx for reply!
if there are two user having access to two different browser and giving input as "input1' and "input2" simultaneously.(input1 is giving by first browser and input2 is giving by second browser.)
Then output correspond to input1 should be shown to first browser and output correspond to input2 should be shown to second browser.How this can be achieved?
currently in code, second input is overwriting first input in run method, so output is wrong..


On Wed, Mar 26, 2014 at 5:47 PM, David Marginian <[hidden email]> wrote:
Upon further examination all your match function is doing is checking if the value is not null, since both users have set it output will be sent to both browsers.  What you are seeing therefore makes total sense.  What did you expect?



On 03/26/2014 06:01 AM, David Marginian wrote:
System.out.println("2----->[only if JSP displayed] Override match function is called for attribute-name "+attributeName+" at "+new Date());
    inputForRunMethod = session.getAttribute(attributeName);
    System.out.println("3----> Match function:--retrieve attribute value from session "+inputForRunMethod+" at "+new Date());
    return (inputForRunMethod != null);








dwr.xml (816 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Styling in peopleTable.html

david@butterdev.com
In reply to this post by amit tanwar
Option 1:
http://directwebremoting.org/dwr/documentation/reverse-ajax/hints-and-t
ips.html#differentiatingSSByRequestParam

Option 2:
When you set the input value on the ScriptSession, also set it on the
HttpSession, then do a comparison of the value in the HttpSession and
the value in the ScriptSession in your filter.

On a side-note, the questions you are asking imply that you don't spend
a lot of time thinking about solutions or getting familiar with the
tools you are using.  Both of which are very important.  Next time I
suggest you take a bit of time thinking about things instead of asking
questions immediately.