Controller for .gsp/.page

Hello. I’m a very inexperienced developer experimenting with creating a module. I created a .gsp file in the pages section that contains a simple form and created a controller class for it based on the default one I saw. My issue is that when my onGet() method in the controller returns the variable I have set for the view, the browser automatically appends .jsp and I get a 404 error. I tried using the Spring InternalResourceViewResolver to change the default suffix to .page, but that gave me a stack overflow error, and the UrlBasedView Resolver also didn’t seem to work. I’m not sure what else to try at this point.

Thanks

Are you sure you really got stackover flow error, i guess it may not be stackoverflow error. can you paste your log errors in pastebin or share screen shots

@jabanero Sorry about it. Did you have a chance to look at this https://wiki.openmrs.org/display/docs/Creating+Modules and this http://write.flossmanuals.net/openmrs-developers-guide/creating-your-first-module/?

I had taken a look at those pages, thank you. @jwnasambu

Kindly share the manual you were following. Is it creating your first module?

I was mainly looking at setting up controllers with Spring Annotations https://wiki.openmrs.org/display/docs/Annotation-Driven+Spring+MVC (and using other spring tutorials) I also looked at this https://wiki.openmrs.org/display/docs/Create+a+Fragment

This is the pastebin for the error I get at startup: https://pastebin.com/DVFYh4eg

are you sure you want to start with UI framework ?? If your completeely new to openmrs ,its better if you first understood how the old jsp technology worked in openmrs , them it would be easier to understand the UI framework

@jabanero I see! you are far a head. Have you gotten a chance to follow this linkhttps://wiki.openmrs.org/display/docs/Getting+Started+as+a+Developer?

@jabanero this is another link to guide you https://wiki.openmrs.org/display/RES/OpenMRS+Developer+Stages

I’m not quite sure that I understand what you’re saying. Could you explain in more detail?

@jwnasambu I took a cursory glance at that page but didn’t go through it step by step.

Kindly follow them closely they will guide you in every step and help you to evaluate yourself at which point you are. Kindly start with this

what i mean , when you talk about “.gsp pages” , thats rendered by the UI framework , and you must have the UI framework module as a dependence in your module ,and by default , a basic module is not created with that dependence.

So my advise is that if youwant to underatnd the openmrs API, its better to start with the old rendering technology (JSP) that we initially used. from there , it will become much easier getting to the UI framework (GSP).

And the example given in the developer manual uses jsps , the old technology

regarding That error have you looked at https://wiki.openmrs.org/display/docs/UI+Framework??

Here is a you tube tutorial about using the UI framework in openmrs

I think I created by module based on the reference application distribution, which is why it has the UI framework dependency. I thought it would be helpful because of the fragment system, but if it’s best to use the jsp starting out then I guess I’ll use that. But how exactly does using the jsp system translate into using the UI Framework?

1 Like

oh yes your right , a reference application module will be created with the UI-framework dependence.

But as a new new dev , i would advise to start with a platform module, and follow the steps provided here in the dev manual , so from that , it will become much easier for getting along the UI framework. like its better if you learn step by step

@jabanero my advise regarding starting with jsps ,was just for easier learnng . like to easily learn the openmrs API.

If your specifically intrested in the Fragment system , kindly start with this

specifically just follow this tutorial here, youll get a better understanding of the UI framework

Thank you, I’ll make sure to watch that video and look more closely here when I get the chance.