cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Translate the entire conversation x

Inquire about applying the user custom.jsp file

IL_12699072
4-Participant

Inquire about applying the user custom.jsp file

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.

ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

2 REPLIES 2

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.

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
PTC
Announcements



Top Tags