Skip to main content
4-Participant
March 6, 2025
Solved

Inquire about applying the user custom.jsp file

  • March 6, 2025
  • 2 replies
  • 609 views

Hi members I want to apply the .jsp page that the user will use as custom on the codebeamer, but I'm going to proceed with it in the following way
1. Create a views folder in the C:\CB-2.2.2\tomcat\webapps\cb\WEB-INF\ path to register a .jsp file to that folder
2. Deploy code to use as a custom controller in the C:\\CB-2.0.2\tomcat\\webapps\cb\\WEB-INF\\lib folder as a JAR file
3. Add settings for my-applicationContext.xm in /tomcat/conf/server.xml and /tomcat/webapps/cb/WEB-INF/classes

If you call the .jsp file through the controller (for example, http://localhost:80/cb/custom/myCreateProject) in the browser, you will get a 404 error. You will be wondering how to set up the class file to be used as the controller and where to locate and use the .jsp file.

Best answer by JoeD_SAI

You should be able to see some success with some small changes. 

Ensure your controller is in the com.intland.codebeamer.controller package.

This controller implementation was working in Codebeamer. It appears that the ".spr" extension in the mapping is critical, removing it caused the same behavior you described. This was compiled and uploaded as a jar to tomcat/webapps/cb/WEB-INF/lib.

@GetMapping({"/helloWorld.spr"})
public ModelAndView helloWorld(HttpServletRequest request) {
 if (!ControllerUtils.isAjaxRequest(request) && !UserAgent.get(request).isRobot()) {
 return new ModelAndView("helloWorld.jsp");
 } else {
 throw new ResponseStatusException(HttpStatus.FORBIDDEN);
 }
}

 Then this jsp content was uploaded to /tomcat/webapps/cb/

<html>
<body>
 Hello! The time is now <%= new java.util.Date() %>
</body>
</html>

No changes to the application context configuration was needed.

2 replies

JoeD_SAI7-BedrockAnswer
7-Bedrock
March 6, 2025

You should be able to see some success with some small changes. 

Ensure your controller is in the com.intland.codebeamer.controller package.

This controller implementation was working in Codebeamer. It appears that the ".spr" extension in the mapping is critical, removing it caused the same behavior you described. This was compiled and uploaded as a jar to tomcat/webapps/cb/WEB-INF/lib.

@GetMapping({"/helloWorld.spr"})
public ModelAndView helloWorld(HttpServletRequest request) {
 if (!ControllerUtils.isAjaxRequest(request) && !UserAgent.get(request).isRobot()) {
 return new ModelAndView("helloWorld.jsp");
 } else {
 throw new ResponseStatusException(HttpStatus.FORBIDDEN);
 }
}

 Then this jsp content was uploaded to /tomcat/webapps/cb/

<html>
<body>
 Hello! The time is now <%= new java.util.Date() %>
</body>
</html>

No changes to the application context configuration was needed.

Catalina
Community Moderator
March 12, 2025

Hi @IL_12699072,

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution or please feel free to detail in a reply what has helped you and mark it as the Accepted Solution. It will help other members who may have the same question.

Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,

Catalina | PTC Community Moderator