• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to throw error in jsp, if i dont get a value in the map as in below code.  RSS feed

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
protected void bootlink() throws IOException,JDOMException {

String filePath = VBBaseHelper.getValue("groups_xml_path");
// ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_PATH);

SAXBuilder builder = new SAXBuilder();
FileInputStream fis = new FileInputStream(new File(filePath));
Document doc= builder.build(fis);
Element root = doc.getRootElement();

Iterator iter = root.getChildren().iterator();
String scope = null;
String groupName = null;
List allActionEvents = null;
Element actionEvent = null;
Element group = null;
VBActionEvents actionEvents = null;
String actionPath = null;

actionEvents= new VBActionEvents();
group = (Element)iter.next();
// scope = group.getAttributeValue(SCOPE_ATTR);
groupName = group.getAttributeValue(GROUP_NAME_ATTR);
Iterator groupIter = group.getChildren().iterator();
allActionEvents = new ArrayList();
actionEvent = (Element)groupIter.next();
actionPath = actionEvent.getAttributeValue(GROUP_NAME_ATTR);
actionMap.put(actionEvent.getText(), actionPath);
acmMap.put(groupName, actionEvents);

Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post your code within tags.
Have you declared method inside JSP ? What do you want to do after throwing an error in JSP ? If the value of map is null, I suggest you to display a error page with a understandable message.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!