i need to show an HTML page to users
but every group of users will see parts of this page differently.
for now i have a JSP page in its basic form
and i need that when a user clicks on a button
everyone in his "group" will be notified. say by painting the button blue.
what i thought is that every browser will ask the servlet if a button was clicked
and once a user clicks a button the answer will be "true"
the problem is that EVERYONE gets notified. also users not in his group. all the buttons are painted.
i think it is because i add a class "blue" to the button and then when the other users ask, the JSP is changed (with the class blue to the button)
you need to identify users that are requests your jsp.
Basically there are two ways to achieve this :
using HttpSession, #see tutorial session
using URL parameter, #see tutorial url parameters
As for me ill use session for this :
//ex. for every user in group add a identifier in session.
group 1 => request.getSession().addAttribute("groupId","green");
group 2 => request.getSession().addAttribute("groupId","blue");
//then in jsp
<input type="button" class='<%=request.getSession().getAttribute("groupId")%>'></input>
Related
In a Page Object Model, how do you handle a common button which is there across multiple pages?
Ex: In a search results page, NEXT button.
Condition: I do not want to repeat the action of clicking the button on each page. I want to write the code just once and want to reuse it across pages.How do you do that?
I have three tables in a page. When I click on a button, I update only one of the tables. But since I use request scope on button event, the page reloads fully and updated value gets lost. Can you suggest a solution, so that my data will be displayed after button event.
Have you tried to set partialSubmit="true" in your button? If you set this attribute, you must set in each table a PartialTriggers to the button.
I hope help you.
Marcos.
The data has to be in the viewScope/pageFlowScope depending on whether its in a bounded taskFlow or not.
And in your button event you need to update the data in the viewScope/pageFlowScope and then bind your tables with those data.
All the event handlers can be in backingBean scope and not necessarily be in requestScope.
In form I use PageableListView to iterate TextFields. But when I submit form it only validate current page of PageableListView. Also when I back to eg. Page 1 all values I filled disappear.
When I change PageableListView to standard ListView all works fine – validation and submitting.
I set in ListView: setReuseItems(true).
How validate all items in PageableListView?
You can only validate items that are in the form, on the screen. If you wish to validate stuff on the first page, I think you need a (ajax)FormSubmittingBehavior on the paging controls, so your form is submitted each time you navigate to another page.
If you submit the data, it will also be stored if there are no validation errors.
I am using JAVA STRUTS. I have an html form with an ActionForm class associated with it and the controls are created using tags. As I understand it, STRUTS will persist selections on an html form even if the form is refreshed. I need to prevent this behavior and force it to rebind the values from the ActionForm object.
Basically, I have a form with a radio button group that allows the user to select A, B, or C. I have an ActionForm that has the property "selection = A" set when the form is loaded. If the user selects B and submits it, the form is correctly set to "selection = B" and all is good. However, when I refresh the page, the ActionForm gets reset to "selection = A" (confirmed through debugging), but the radio buttons have B selected!
Does anyone know why this is or how I can prevent it from happening?
Regarding to your post i thought it was belongs to struts2 so,
According to struts2 it is not possible means, you have to give the static value or you have to make in programmatic manner through JPA (or)your java code.
For JPA you refer this link it is helpful JPA way
This explanation is refer to static way
First in jsp page you have to import struts2 tags through taglib uri then it shows the available struts2 tags in those tags you have to select <s:radio></s:radio> tag
eg:
<s:radio label="Selections" name="your name" list="#{'A':'A','B':'B'}" value="2" />
in this code i typed the value as 2 so, it select B as a default if you remove the value it won't select any default values.
Basically what i am trying to say here is without value it won't select any radio buttons
you have to give value through static way or dynamic way.
For dynamic way you can refer this link dynamic radio button
I'm trying to write a GWT app that reuses the same template for every "page" (place). There are 4 main "pages" of the app:
Dashboard page (http://www.mywebapp.com/#dashboard)
Calculator page (http://www.mywebapp.com/#calc)
Configurator page (http://www.mywebapp.com/#config)
Login page (http://www.mywebapp.com/#login)
Each "page" has the same templated look-and-feel: (1) a header section that contains the logo and the navigation menu, (2) a content section that contains "page"-specific content (i.e. will be different for the #dashboard place, #login place, etc.), and (3) a footer section that contains some links. So you see, the only thing that changes from page-to-page is the content section. Just like an ordinary, templated web site.
The thing is, each "page" (place) is actually a fairly complicated UI with many different panels consisting of lots of widgets. As the user interacts with the app, these panels will come into and out of existence and the display will be changing all the time. For instance, on the #calc page, the user can select which "mode" to display a calculator in: either as Basic or as Advanced. When the user selects Advanced, several additional panels will display (in addition to the Basic panel).
It would be nice to be able to keep such actions in history, so that the user can bookmark the app in either Basic or Advanced mode, so something like:
http://www.mywebapp.com/#calc/basic; or
http://www.mywebapp.com/#calc/advanced
Here's the problem:
We already have several "levels" of activities/places going on here. At the "app"-level, we have the template that needs to be displayed to the user when the MyWebAppModule implements EntryPoint downloads. This TemplatePlace is the default/initial place that is registered with the HistoryHandler before calling:
public class MyWebAppModule implements EntryPoint {
#Override
public void onModuleLoad() {
// ...
// The first place we go to when this module downloads.
TemplatePlace templatePlace = getSomehow();
historyHandler.register(placeController, eventBus, templatePlace);
historyHandler.handleCurrentHistory();
}
}
Next, we have all the different "pages": DashboardPlace, CalculatorPlace, etc. that all have their own unique views/displays. For instance when the user clicks the Calculator link to go to CalculatorPlace, it should render a different view than when the identify that they want to use the calculator in Basic or Advanced mode.
Finally, we have the different display regions, panels, etc. inside each page/place, such as the BasicCalculatorPlace and AdvancedCalculatorPlace. This is what I mean by different "levels" of navigation:
Application-level (a template to apply to all pages/places)
Page- or place-level
Display- or panel-level
The question:
I want to achieve bookmarkable URLs (places) for when the user does all of the following:
Goes to the home page (http://www.mywebapp.com)
Goes to any of the "pages" (http://www.mywebapp.com/#calc, etc.)
Uses the pages/places which cause page-specific panel or display configurations (http://www.mywebapp.com\#calc\#advanced, etc.)
How many Activities and Places do I create? How many ActivityManagers? I guess I'm asking for how granular Activities/Places need to be for each "level" of bookmarkable UI. Thanks in advance!
I think you only need one ActivityManager and one Activity per "page". You can make your "header" and "footer" into widgets that can be reused in each page.
You can bookmark different states of the same page by using tokens. For example, you can set a token to "basic" - it would tell the CalculatorActivity to show basic calculator panel. The URL will look like:
www.myApp.com/?#Calculator:basic
When a user clicks on a widget to select an advanced option, you do
PlaceController.goTo(new CalculatorPlace("advanced"));
The CalculatorActivity will get the CalculatorView (which is already displayed), it will see that the token is set to "advanced" and it will instruct this view to show advanced panels.
Note that you can make your tokens as detailed as necessary and then parse them in Activity. For example, you can have something like
www.myApp.com/?#Calculator:option=basic&position=top&theme=pink