How to use Link - Command in jsp - java

I am new to jsp and trying to use link-command. I have a page where I need display links. But I was asked to display only 3 links on the page within a section and then provide a "more" link. When user clicks more, it takes them to a new page which will then list all the links that are coming from the database
Say, suppose the database provides 6 links for the product user had selected, the jsp page should link only 3 and a more link. Clicking the more will open a full page with all six links
Currently I am able to disaply all the links coming from the database in the same jsp

You can use JavaScript to dynamically show 3 last links and at jsp generation but some CSS class on all links over 3 first.
If you really want two pages, you can send a post or get parameter to tell the page to show all links or only first ones.

Related

Change driver focus between different page in single window in Selenium

I am a beginner in Selenium Automation, and stuck with a situation, where, if I open a page xyz.com, and login, then there are some text box and dropdown and buttons to be clicked but the thing is, after the driver get to that page, I can see those elements, and can get the ID and necessary tags, but these whole page consist of 3 different (.do) page.
For example:
1. main page is abc.do
2. left panel is mno.do
3. center is xyz.do
Image of Inspect Element in IE
and my elements exists in xyz.do, and links in mno.do.
I am using eclipse to code, Selenium 3.1, IE 11
How can I switch between them so that my driver can find the elements, write now its showing element cannot be found, and when I pulled the source code its providing of only first .do page.
Please help.
Thanks.
It seems the page is using frames or iframes, but because you do not provide a URL, it's only a guess.
So, to switch a frame/iframe, simply use the switchTo method:
driver.switchTo().frame0); // Frame by number
driver.switchTo().frame("iframe1"); // Frame by selector
After that call, you switch into the "context" of that page/frame/iframe.

How to get the size of an article has been displayed in the mobile web page using java?

I want to get an total article size that get displayed in the mobile web page using java in selendroid web driver.
My mobile page contains an article exactly 21 articles. But, in page view it displays only 10 articles. Next 11 get displayed in the next page, that means, I need to scroll the and see the remaining articles.
I have tried with below coding, it prints the size as 10 article only.
How can I able to get the total size of an article present in the mobile web page?
// get articles list
List articleLists = wait.until(ExpectedConditions
.visibilityOfAllElementsLocatedBy(By
.cssSelector(".chTest .media-item")));
int s=articleLists.size();
System.out.println("size="+s);

How to retrieve value from database on selecting value from dropdown using Ajax?

I have a java servlet application where the database is populated by selecting an entry from a dropdown list and entering the values. On another page I have the same dropdown list and also have a find button to display the values that were previously entered by selecting an entry from the dropdown list. I want to get rid of this find button and dynamically display the previously entered values on this page. I heard this can be done using ajax. Please help me out.
Since the code is too much to share I have uploaded the snapshots of both the pages.
https://www.dropbox.com/s/10qmpxzwm8sik8a/1.PNG?dl=0
Here I am entering the values in estimate by selecting the project
https://www.dropbox.com/s/w8macftnm3rez3a/2.PNG?dl=0
Here I want to get the values just by selecting the project from the drop-down without clicking the Find button
You need to be specific with your question.
If I got you right...
You can use a variable in javasceipt to hold the value that was enterd on the other page you got.
Then while using the dropdown on the other page you can retrieve the values that you store and use a simple ajax request with json data to your servelet.
Check here for examples: http://api.jquery.com/jquery.ajax/

I am working on a java Web application.In which i have to show contact detail.used framework is struts 1.3

I am working on a Struts 1.3 project,
I am working on a jsp page in which many links exist and requirement is, if user click any link then ,I have a huge amount of data returned from the calls,i want to display returned data in a table using Display tag in same jsp div element.
and page size of table is 10.
Using Ajax is a way to do that.Can any one explain me how can i do that.
I can display returned data on another page after clicking on links using display tag.
but i can't get way to show returned data on same page using display tag
Thank you

How to add Links in liferay

I am using Liferay 6.0.4 and I have a page which is available to all users including guests. The page is called "Information". The page has already been created.
Right now its an empty page.
I want to add these four links to that page on the left hand side:
1. Calender
2. Forums
3. Blogs
4. Docs
I have created that page with 30:70 layout so that I can place one Web Content showing these four url's on the left side and corresponding link content on the right side. The default content to show is the content of the link Calender.
I am not able to figure out how to achieve it as I am really new to Liferay. Please guide to me to the proper direction and if possible write some steps to follow...
If I understand correctly, you want a menu on the left hand side that updates the right hand side.
For this, you should use the Navigation Portlet on the left hand side, and create 4 child pages "Calendar", "Forums", "Blogs" and "Docs". On each of these pages, just drop the appropriate portlet and you're set.

Categories