You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by K <ko...@gmail.com> on 2014/06/21 15:14:43 UTC

Error search message in same page

Hi

I am trying to build a web application in which i have to display list of
items on search...

this part has been done but i have to add a errror message in the same page
if the search result comes out null...

I am using DataView for displaying the results. using condition in java is
simple but for the unreachable id that i mention in condition the mark up is
not being rendered if the condition is true.

any help is well appriciated...

Thanks 

-----

K
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Error-search-message-in-same-page-tp4666331.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Error search message in same page

Posted by K <ko...@gmail.com>.
Hi Martin Grogorov

thanks a lot for the reply.
Now i realize that its simple solution...

Thanks
 

-----

K
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Error-search-message-in-same-page-tp4666331p4666357.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Error search message in same page

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can add a FeedbackPanel to the current page and in the 'if' clause you
can use #error(), #warning(), #info() methods to send feedback messages to
the user.
E.g.
if (list.size() == 0)  {
  warning("There are no results for " + JOBNUMBER);
}

// the rest is not in the 'else' clause because you you need to add Java
component for wicket:id="jobs" in both cases. If the list is empty then the
DataView will be empty too
     final DataView dataView = new DataView("jobs", new
ListDataProvider(list)) {

                                @Override
                                protected void populateItem(final Item
item) {
                                        final MYJobBean job = (MYJobBean)
item.getModelObject();
                                        item.add(new Label("label1",
job.getJobNumber()));
                                        item.add(new Label("label2",
job.getJobType()));
                                        item.add(new Label("label3",
job.getJobClass()));
                                }

                        };
                        dataView.setItemsPerPage(10);
                        add(dataView);
                        add(new CustomPagingNavigator("navigator",
dataView));

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 23, 2014 at 9:00 AM, K <ko...@gmail.com> wrote:

> My Java code:
>
>         String JOBNUMBER = params.get("jobnumber").toString();
>                 list = DBUtils.retrieveJob(JOBNUMBER);
>
>                 if(list.size() == 0){
>                         */setResponsePage(SearchError.class);/*
>                 }else{
>                          final DataView dataView = new DataView("jobs", new
> ListDataProvider(list)) {
>
>                                 @Override
>                                 protected void populateItem(final Item
> item) {
>                                         final MYJobBean job = (MYJobBean)
> item.getModelObject();
>                                         item.add(new Label("label1",
> job.getJobNumber()));
>                                         item.add(new Label("label2",
> job.getJobType()));
>                                         item.add(new Label("label3",
> job.getJobClass()));
>                                 }
>
>                         };
>                         dataView.setItemsPerPage(10);
>                         add(dataView);
>                         add(new CustomPagingNavigator("navigator",
> dataView));
>
> And my mark up is :
>
>
>         <br>
>         <wicket: extend>
>         <div wicket:id="navigator"></div>
>
>
>
>
>
>
>                                         <p class="jobdata_p">
>                                                 Job Number
>                                         </p>
>
>
>                                         <p class="jobdata_p">
>                                                 Job Type
>                                         </p>
>
>
>                                         <p class="jobdata_p">
>                                                 Job Class
>                                         </p>
>
>
>
>
>
>                                         <p class="jobdata_p1">
>
>                                         </p>
>
>
>
>                                         <p class="jobdata_p1">
>
>                                         </p>
>
>
>
>                                         <p class="jobdata_p1">
>
>                                         </p>
>
>
>
>
>
>         <div wicket:id="navigator"></div>
>         </wicket: extend>
>
>         I want to replace the "setResponsePage(SearchError.class);" so
> that i can
> get rid of extra page....
>         Initially i tried to add extra label in if condition and mark up
> for that
> but it did not work.
>
>         I am new to wicket and havent got hold of it yet
> Martin Grigorov-4 wrote
> > Hi,
> >
> > What did you try so far ?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Sat, Jun 21, 2014 at 4:14 PM, K &lt;
>
> > kondetiudaykiran@
>
> > &gt; wrote:
> >
> >> Hi
> >>
> >> I am trying to build a web application in which i have to display list
> of
> >> items on search...
> >>
> >> this part has been done but i have to add a errror message in the same
> >> page
> >> if the search result comes out null...
> >>
> >> I am using DataView for displaying the results. using condition in java
> >> is
> >> simple but for the unreachable id that i mention in condition the mark
> up
> >> is
> >> not being rendered if the condition is true.
> >>
> >> any help is well appriciated...
> >>
> >> Thanks
> >>
> >> -----
> >>
> >> K
> >> --
> >> View this message in context:
> >>
> http://apache-wicket.1842946.n4.nabble.com/Error-search-message-in-same-page-tp4666331.html
> >> Sent from the Users forum mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
>
> > users-unsubscribe@.apache
>
> >> For additional commands, e-mail:
>
> > users-help@.apache
>
> >>
> >>
>
>
>
> -----
>
> K
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Error-search-message-in-same-page-tp4666331p4666354.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Error search message in same page

Posted by K <ko...@gmail.com>.
My Java code:

	String JOBNUMBER = params.get("jobnumber").toString();
		list = DBUtils.retrieveJob(JOBNUMBER);
		
		if(list.size() == 0){
			*/setResponsePage(SearchError.class);/*
		}else{
			 final DataView dataView = new DataView("jobs", new
ListDataProvider(list)) {
	
				@Override
				protected void populateItem(final Item item) {
					final MYJobBean job = (MYJobBean) item.getModelObject();
					item.add(new Label("label1", job.getJobNumber()));
					item.add(new Label("label2", job.getJobType()));
					item.add(new Label("label3", job.getJobClass()));
				}

			};
			dataView.setItemsPerPage(10);
			add(dataView);
			add(new CustomPagingNavigator("navigator", dataView));

And my mark up is :


	<br>
	<wicket: extend>
	<div wicket:id="navigator"></div>
	

		
			

					
					<p class="jobdata_p">
						Job Number
					</p>
				
					
					<p class="jobdata_p">
						Job Type
					</p>
				
					
					<p class="jobdata_p">
						Job Class
					</p>
				
			
			

					
					<p class="jobdata_p1">
						
					</p>
				

					
					<p class="jobdata_p1">
						
					</p>
				

					
					<p class="jobdata_p1">
						
					</p>
				
			
		
	

	<div wicket:id="navigator"></div>
	</wicket: extend>
	
	I want to replace the "setResponsePage(SearchError.class);" so that i can
get rid of extra page....
	Initially i tried to add extra label in if condition and mark up for that
but it did not work.

	I am new to wicket and havent got hold of it yet
Martin Grigorov-4 wrote
> Hi,
> 
> What did you try so far ?
> 
> Martin Grigorov
> Wicket Training and Consulting
> 
> 
> On Sat, Jun 21, 2014 at 4:14 PM, K &lt;

> kondetiudaykiran@

> &gt; wrote:
> 
>> Hi
>>
>> I am trying to build a web application in which i have to display list of
>> items on search...
>>
>> this part has been done but i have to add a errror message in the same
>> page
>> if the search result comes out null...
>>
>> I am using DataView for displaying the results. using condition in java
>> is
>> simple but for the unreachable id that i mention in condition the mark up
>> is
>> not being rendered if the condition is true.
>>
>> any help is well appriciated...
>>
>> Thanks
>>
>> -----
>>
>> K
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Error-search-message-in-same-page-tp4666331.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

>> For additional commands, e-mail: 

> users-help@.apache

>>
>>



-----

K
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Error-search-message-in-same-page-tp4666331p4666354.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Error search message in same page

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

What did you try so far ?

Martin Grigorov
Wicket Training and Consulting


On Sat, Jun 21, 2014 at 4:14 PM, K <ko...@gmail.com> wrote:

> Hi
>
> I am trying to build a web application in which i have to display list of
> items on search...
>
> this part has been done but i have to add a errror message in the same page
> if the search result comes out null...
>
> I am using DataView for displaying the results. using condition in java is
> simple but for the unreachable id that i mention in condition the mark up
> is
> not being rendered if the condition is true.
>
> any help is well appriciated...
>
> Thanks
>
> -----
>
> K
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Error-search-message-in-same-page-tp4666331.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>