On Fri, Jun 9, 2017 at 1:17 PM, Sarthak Gupta <[email protected]> wrote: > Hello, > This error occurs when I enter the word "Hello" in the textbox, and then > press the "add glossary" button. > The $newGlossaryReference is not null. It prints "xwiki:Glossary.Hello". > > The code is located in a design sheet "Glossary.GlossarySheet". I have > linked the sheet to the main class "Glossary.GlossaryClass" and added the > "Glossary.GlossaryClass" object on the home page of the application > 'Glossary.WebHome'.
So that's your mistake. Every time a glossary entry is displayed your code is executed since the sheet is executed. You should not use the same sheet for the home page and the entries. > > I expect that when a user enters a text(say hello) in the textbox and press > "Add Glossary" button then it should create a new page with the > title 'hello' using GlossaryTemplate in the Glossary Space. > > Thanks > > On Fri, Jun 9, 2017 at 3:35 PM, Thomas Mortagne <[email protected]> > wrote: > >> Where is this code located ? In "Glossary.Hello" page ? >> >> Are you sure $newGlossaryReference contains what you expect ? Did you >> print it ? If it was null you would get exactly this behavior. >> >> On Fri, Jun 9, 2017 at 11:56 AM, Sarthak Gupta >> <[email protected]> wrote: >> > Hello all, >> > >> > It's been 2 days that I am stuck in a stupid error. >> > I have a "add glossary" button in my application, and when I click that >> > button, the browser gives me the error: "This page isn’t working, >> 127.0.0.1 >> > redirected you too many times." >> > >> > Now this is a redirect loop. And it's caused by the statement >> > $response.sendRedirect($xwiki.getURL($newGlossaryReference, 'inline', >> > "$!{request.queryString}&title=${escapetool.url($glossaryItem)}")) in my >> > code I guess. I am not able to figure out why this is looping even if >> there >> > is no loop. I have tried certain things but there is no progress. >> > >> > Moreover, my title bar appear like this: >> > http://127.0.0.1:8080/xwiki/bin/inline/Glossary/Hello? >> parent=Glossary.WebHome&template=Glossary.GlossaryTemplate& >> createGlossary=true&glossaryItem=Hello&title= >> Hello&title=Hello&title=Hello&title=Hello&title=Hello&title= >> Hello&title=Hello&title=Hello&title=Hello&title=Hello&title= >> Hello&title=Hello&title=Hello&title=Hello&title=Hello&title= >> Hello&title=Hello&title=Hello&title=Hello&title=Hello&title=Hello >> > >> > Here is my complete code: https://pastebin.com/p95DeHMg >> > >> > Could someone please take some time and help me out? >> > >> > IRC:sarthakg >> > >> > Thanks >> > Sarthak Gupta >> >> >> >> -- >> Thomas Mortagne >> -- Thomas Mortagne

